Skip to Content
0
Former Member
Dec 31, 2005 at 05:21 AM

Have a look at my RFC call, it doesn't return anything

17 Views

Hi all,

In my project, I create a RFC Model named 'SCO' which will call bapi function 'BAPI_SALESORDER_CREATEFROMDAT1', if successfully a SALEDOCUMENT should return.

below is the code in my custom controller

public void wdDoInit()

{

//@@begin wdDoInit()

Bapi_Salesorder_Createfromdat1_Input input =

new Bapi_Salesorder_Createfromdat1_Input();

wdContext.nodeCSOC_Input().bind(input);

input.setOrder_Header_In(new Bapisdhead());

input.addOrder_Items_In(new Bapiitemin());

input.addOrder_Partners(new Bapipartnr());

//@@end

}

public void executeBapi( )

{

//@@begin executeBapi()

try {

wdContext.currentCSOC_InputElement().modelObject().execute();

} catch (WDDynamicRFCExecuteException e) {

// TODO Auto-generated catch block

System.err.println(e.getMessage());

e.printStackTrace();

} finally {

// wdContext.nodeCSOC_Input().invalidate();

}

//@@end

}

In my view(TestSOCView) I mapped a node named SOC_Input has the structure

Order_Header_In

-Distr_Chan

-Division

-Doc_Type

-Sales_Org

Order_Partnr_In

-Partn_Numb

-Partn_Role

Order_Items_In

-Material

-Req_Qty

Output

-Return

--Message

--Type

-Salesdocument

I have a very simple view which has only one button and two textview (one bind to Output-Salesdocument, another to Output-Return-Message)

In my action method, I have the code

public void onActionCreateSO(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionCreateSO(ServerEvent)

IOrder_Header_InElement newHeader =

wdContext.currentOrder_Header_InElement();

IOrder_PartnersElement newPartner =

wdContext.createOrder_PartnersElement(new Bapipartnr());

IOrder_Items_InElement newItem =

wdContext.createOrder_Items_InElement(new Bapiitemin());

newHeader.setSales_Org("1000");

newHeader.setDoc_Type("OR");

newHeader.setDistr_Chan("10");

newHeader.setDivision("00");

// wdContext.nodeOrder_Header_In().addElement(newHeader);

newPartner.setPartn_Role("SP");

newPartner.setPartn_Numb("1000");

wdContext.nodeOrder_Partners().addElement(newPartner);

newItem.setMaterial("TEST2");

newItem.setReq_Qty("00001000");

wdContext.nodeOrder_Items_In().addElement(newItem);

wdThis.wdGetSOCControllerController().executeBapi();

//@@end

}

This is all my implementation, I dont know why there's always nothing retrieved, even no Return Message.

I of course have the right JCO connection, if not, this view will not display.

My wonder is my initilization for two table maybe wrong:

...

input.addOrder_Items_In(new Bapiitemin());

input.addOrder_Partners(new Bapipartnr());

...

because I know there's a method

set<Node>(AbstractList)

but this is not java.util.AbstractList, I dont know how to initiate this list.

And if I follow the turtorial which will enable the line after execution

wdContext.nodeCSOC_Input().invalidate();

This will make my application run only one time, the second time a NullPointerException will be thrown. So there's also a question: what's the usage of this line?

Any one have a look at my problem? Thanks in advance

And at last,

Happy New Year to everyone.

Wish you all a nice new year.

best regards,

William