on 11-07-2014 2:24 PM
I am beginner in sap -jco . I have used this simple piece of code to fetch standard price for a material using BAPI_MATERIAL_GET_DETAIL .But I am not getting the value . I can see the standard price is there for that material using sap - client .
I am able to fetch "MATERIAL_GENERAL_DATA" but not the "MATERIALVALUATIONDATA" which consists the Standard Cost :
{UNIT_DIM=, IND_SECTOR=M, CONTAINER=, CHANGED_BY=DEMO1, TEMP_CONDS=, WIDTH=0.000, MANU_MAT=, CREATED_ON=2014-11-11, PAGEFORMAT=, EMPTIESBOM=, VOLUME=13.000, CREATED_BY=DEMO1, UNIT_OF_WT_ISO=KGM, PROD_MEMO=, MATL_DESC=Test Material, STOR_CONDS=, LAST_CHNGE=2014-11-11, OLD_MAT_NO=, STD_DESCR=, PROD_HIER=, EAN_CAT=, BASIC_MATL=, BASE_UOM_ISO=EA, GROSS_WT=12.000, HEIGHT=0.000, UNIT_DIM_ISO=, UNIT_OF_WT=KG, MATL_TYPE=KMAT, VOLUMEUNIT=CCM, VOLUMEUNIT_ISO=CMQ, EAN_UPC=, SIZE_DIM=, LAB_DESIGN=, NET_WEIGHT=10.000, BASE_UOM=EA, MATL_CAT=, DIVISION=01, BASIC_MATL_NEW=, MFR_NO=, LENGTH=0.000, MATL_GROUP=}
public static void step5WorkWithTable() throws JCoException{
JCoDestination destination = JCoDestinationManager.getDestination(DESTINATION_NAME2);
JCoFunction function = destination.getRepository().getFunction("BAPI_MATERIAL_GET_DETAIL");
System.out.println(function);
//function = destination.getRepository().getFunction("BAPI_COMPANYCODE_GETDETAIL");
JCoParameterList listParams = function.getImportParameterList();
listParams.setValue("MATERIAL", "346");
//listParams.setValue("PLANT", "SN02");
//function.execute(destination);
JCoParameterList resultParams = function.getExportParameterList();
JCoStructure fieldList = resultParams.getStructure("MATERIALVALUATIONDATA");
//function.execute(destination);
Hashtable<String, String> returnHash = new Hashtable<String, String>();
if(fieldList.getFieldCount() > 0){
for(JCoFieldIterator fI = fieldList.getFieldIterator();fI.hasNextField();){
JCoField tabField = fI.nextField();
returnHash.put(tabField.getName(), tabField.getString());
}
}
System.out.println(returnHash);
}
Name: BAPI_MATERIAL_GET_DETAIL
Input:
|------------------|------------|----|----|----------|
| PARAMETERS 'INPUT'
|------------------|------------|----|----|----------|
|MATERIAL |MATERIAL_EVG|PLAN|VALU|VALUATIONT|
|------------------|------------|----|----|----------|
|012345678901234567| |8901|2345|6789012345|
|------------------|------------|----|----|----------|
| |MATERIAL_EVG| | | |
|------------------|------------|----|----|----------|
Changing:
null
Output:
|-----------------|---------------------|---------------------|------|
| PARAMETERS 'OUTPUT'
|-----------------|---------------------|---------------------|------|
|MATERIALPLANTDATA|MATERIALVALUATIONDATA|MATERIAL_GENERAL_DATA|RETURN|
|-----------------|---------------------|---------------------|------|
| | | | |
|-----------------|---------------------|---------------------|------|
|MATERIALPLANTDATA|MATERIALVALUATIONDATA|MATERIAL_GENERAL_DATA|RETURN|
|-----------------|---------------------|---------------------|------|
Tables:
null
{PRICE_UNIT=0, PRICE_CTRL=, CURRENCY_ISO=, STD_PRICE=0.0000, MOVING_PR=0.0000, CURRENCY=}
What is the mistake I am doing here.
It is fixed at last , The problem was I was setting only
listParams.setValue("MATERIAL", "346"); to fetch standard data ( MATERIALVALUATIONDATA ) .
To fetch MATERIALVALUATIONDATA which consist of Standard Price and Currency we need to set this parameters also.
listParams.setValue("PLANT", "ZRP3");
listParams.setValue("VALUATIONAREA", "ZRP3");
And you will get the complete MATERIALVALUATIONDATA data structure then .
|-|------------------------|------------------------|--------|-----|---|
| STRUCTURE 'BAPIMATDOBEW'
|-|------------------------|------------------------|--------|-----|---|
|P|MOVING_PR |STD_PRICE |PRICE_UN|CURRE|CUR|
|-|------------------------|------------------------|--------|-----|---|
|0| 1 2 3 4 5 6| 7 8 9 0 1 2| 3 4|56789|012|
|-|------------------------|------------------------|--------|-----|---|
|S|00000000000000000000000C|00000000000000000100000C|00001C00|INR |INR|
|-|------------------------|------------------------|--------|-----|---|
{PRICE_UNIT=1, PRICE_CTRL=S, CURRENCY_ISO=INR, STD_PRICE=10.0000, MOVING_PR=0.0000, CURRENCY=INR}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.