cancel
Showing results for 
Search instead for 
Did you mean: 

Bapi_SalesOrder_Change

Former Member
0 Kudos

has anyone used the BAPI_SALESORDER_CHANGE and knows how to set the value of ORDER_HEADER_INX?

i've tried to set the value update flag:

//@@begin onActionSave(ServerEvent)

wdContext.currentOrder_Header_InxElement().setUpdateflag("X");

wdThis.wdGetOdvCompController().executeBapi_Salesorder_Change();

//@@end

but in debug mode it says wdContext.currentOrder_Header_InxElement() = null how can i pass this value?

notes: the view inputfield takes the attribute value from BAPI_SALESORDER_GETLIST output

thanks,

Daniele

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Daniele,

I haven't worked with the BAPI in the question..

But, what I would do in this case

1) I would check the size of the Order_Header_Inx node by wdContext.nodeOrder_Header_Inx().size(). If it is 0, means there is no element of that type.

2) I would create an element of that type and then set the value of its property.

Try this...hope it helps

Regards,

Mausam

Answers (3)

Answers (3)

Former Member
0 Kudos

it's long but the node i'm tring to set is

Bapi_Salesorder_Change_Input

>Order_Header_Inx

>>...

>>...

>>Updateflag

Former Member
0 Kudos

In form


<Root>
 -- Node A (singleton, 0..1)
    -- Node B (non-singleton, 0..n)
    -- Node C (non-singleton, 1..n)
    ...

Use [ code ] [ /code ] tags (without extra spaces) to keep formatting.

VS

Former Member
0 Kudos

[ code ]

root

Bapi_SalesOrder_Change_Input (singleton,0..n)

...

Order_Header_Inx (singleton,0..n)

...

[ /code ]

Former Member
0 Kudos

1. Make sure supplyingRelationRole is set for Order_Header_Inx.

2. Do the following in action handler:


final Bapi_SalesOrder_Change_Input query = 
  wdContext
    .currentBapi_SalesOrder_Change_InputElement()
      .modelObject();
final Order_Header_Inx headerLine;
if ( query.getOrder_Header_Inx() == null ||
     query.getOrder_Header_Inx().size() == 0)
  query.addOrder_Header_Inx
  ( 
    headerLine = new Order_Header_Inx() 
  );
else
  headerLine = (Order_Header_Inx)query.getOrder_Header_Inx().get(0);
headerLine.setUpdateflag("X"); 
wdThis.wdGetOdvCompController().executeBapi_Salesorder_Change();

VS

Former Member
0 Kudos

ok now works but when i try to execute the BAPI_TRANSACTION_COMMIT or BAPI_TRANSACTION_ROLLBACK occurs an error:

java.lang.NullPointerException in the custom controller

 //@@begin executeBapi_Transaction_Commit()
	IWDMessageManager manager = wdComponentAPI.getMessageManager();
		try {
		wdContext.currentBapi_Transaction_Commit_InputElement().modelObject().execute();
		wdContext.nodeBapi_Transaction_Commit_Input().invalidate();
		} catch (WDDynamicRFCExecuteException ce){
		manager.reportException(ce.getMessage(), false);
		}
    //@@end

it's because the node is empty?

what does it need do do the commit/rollback?

thanks,

Daniele

Former Member
0 Kudos

Daniele,

Yes, it seems there is no node elements.

Add the following prologue to method


if ( null == wdContext.currentBapi_Transaction_Commit_InputElement() )
  wdContext.nodeBapi_Transaction_Commit_Input()
    .bind( new Bapi_Transaction_Commit_Input() );

Former Member
0 Kudos

Daniele,

Please post structure of node that corresponds to Bapi_Salesorder_Change_Input model class.

VS

Former Member
0 Kudos

Hi Daniele,

Order_Header_Inx is a structure.

Page 9 of <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/linking%20rfc%20to%20web%20dynpro.pdf">this</a> PDF shows how to set values of params in structures. It's a very good resource about calling RFC's from WebDynpro in general, have a look at it.

Best regards,

Patrick.