cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Salesorder via Bapi_Salesorder_Createfromdat2

StefanReitz
Explorer
0 Kudos

Hello Experts,

i'm trying to create a Salesorder via Web Dynpro Java and Bapi_Salesorder_Createfromdat2. Therefore i followed this Blog:

Part1: /people/perumal.kanthan/blog/2005/03/09/handling-structuretable-transactions-using-bapis-in-web-dynpro-part-i

Part2: /people/perumal.kanthan/blog/2005/03/09/handling-structuretable-transactions-using-bapis-in-web-dynpro-part-ii

If i copy/paste the Code of Perumal the input1... - Elements cannot be solved so i added the following:

<i>Bapi_Salesorder_Createfromdat2_Input input1 = new Bapi_Salesorder_Createfromdat2_Input();

Bapi_Transaction_Commit_Input Commit = new Bapi_Transaction_Commit_Input();</i>

This is what my "executeBapi_Salesorder_Createfromdat2_Input ( )" - Method looks like:

<i> public void executeBapi_Salesorder_Createfromdat2_Input( )

{

//@@begin executeBapi_Salesorder_Createfromdat2_Input()

//$$begin Service Controller(835578104)

IWDMessageManager manager = wdComponentAPI.getMessageManager();

try{

wdContext.currentBapi_Salesorder_Createfromdat2_InputElement().modelObject().execute();

wdContext.nodeOutput().invalidate();

} catch(WDDynamicRFCExecuteException ce) {

manager.reportException(ce.getMessage(), false);

}

//$$end

Bapi_Salesorder_Createfromdat2_Input input1 =

new Bapi_Salesorder_Createfromdat2_Input();

Bapi_Transaction_Commit_Input Commit =

new Bapi_Transaction_Commit_Input();

Bapisdhd1 header = new Bapisdhd1();

Bapisdhd1X headerx = new Bapisdhd1X();

// ### Kopfdaten setzen!

header.setDoc_Type("TA");

headerx.setDoc_Type(true);

header.setSales_Grp("001");

headerx.setSales_Grp(true);

header.setSales_Org("0001");

headerx.setSales_Org(true);

header.setDistr_Chan("01");

headerx.setDistr_Chan(true);

header.setDivision("01");

headerx.setDivision(true);

header.setPurch_No_C("0000458726");

headerx.setPurch_No_C(true);

input1.setOrder_Header_In(header);

input1.setOrder_Header_Inx(headerx);

// Partnerdaten setzen!

Bapiparnr partner1 = new Bapiparnr();

Bapiparnr partner2 = new Bapiparnr();

partner1.setPartn_Role("AG");

partner1.setPartn_Numb("0000000005");

partner2.setPartn_Role("WE");

partner2.setPartn_Numb("0000000005");

input1.addOrder_Partners(partner1);

input1.addOrder_Partners(partner2);

// Itemdaten setzen!

Bapisditm ItemNode1 = new Bapisditm();

Bapisditmx ItemNode1x = new Bapisditmx();

ItemNode1.setItm_Number("10");

ItemNode1.setMaterial("27");

ItemNode1x.setMaterial(true);

ItemNode1.setTarget_Qty(new BigDecimal(10));

ItemNode1x.setTarget_Qty(true);

ItemNode1.setTarget_Qu("ST");

ItemNode1x.setTarget_Qu(true);

// Einteilungsdetails setzen!

Bapischdl schedule1 = new Bapischdl();

Bapischdlx schedule1x = new Bapischdlx();

schedule1.setItm_Number("10");

schedule1.setReq_Qty(new BigDecimal(10));

schedule1x.setReq_Qty(true);

input1.addOrder_Items_In(ItemNode1);

input1.addOrder_Items_Inx(ItemNode1x);

input1.addOrder_Schedules_In(schedule1);

input1.addOrder_Schedules_Inx(schedule1x);</i>

...followed by the Method: "executeBapi_Transaction_Commit_Input( )"

Further on i created a Form with the Order_Header_In - Parameters, a Button and two Tables containing the Item and Schedule - Parameters.

If i click the Action-ButtonI get the Error-Message:

Mandatory parameter ORDER_HEADER_IN of method BAPI_SALESORDER_CREATEFROMDAT2 missing

Could anybody explain this to me? Is it because i manually added the two Lines at the Beginning? I, by the way, tested the Parameters on the SAP-Side and the Bapi worked fine. I checked if anything arrived at the SAP-Backend doing this:

--> /people/achim.hauck/blog/2004/10/27/how-to-debug-bapirfc-calls-in-web-dynpro - nothing there.

I'd appreciate any help!

Best Regards

Stefan

Accepted Solutions (0)

Answers (2)

Answers (2)

StefanReitz
Explorer
0 Kudos

Hello Ignacio,

thanks for your reply. I added the binding and now at least the generation of the Table works. Unfortunately, i'm still getting the Error-Message:

<i>Mandatory parameter ORDER_HEADER_IN of method BAPI_SALESORDER_CREATEFROMDAT2 missing</i>

Regards

Stefan

Former Member
0 Kudos

hi Stefan,

I think that you are forgetting the bind method call

wdContext.node<ModelNodeName>().bind( input1 ) ;

after this line

Bapi_Salesorder_Createfromdat2_Input input1 = new Bapi_Salesorder_Createfromdat2_Input();

Regards,

Ignacio.