Skip to Content
avatar image
Former Member

Execute Adaptive RFC 2 Model Issue

I follow this guide: Using an Adaptive RFC 2 Model in Web Dynpro for Java(Using an Adaptive RFC 2 Model in Web Dynpro for... | SCN) to excute ARFC2

BAPI_FLIGHT_GETLIST like this:

-------------------------

public void wdDoInit() {

//@@begin wdDoInit()

// Set the class wide reference to the component's message manager

msgMgr = wdComponentAPI.getMessageManager();

// Create a new model

flightModel = new FlightModel();

// Using the model, create an executable model object for the BAPI

bapiGetFlightList = new Bapi_Flight_Getlist_Input(flightModel);

}

--------------------------------

public void call_BAPI_FLIGHT_GETLIST( ) {

//@@begin call_BAPI_FLIGHT_GETLIST()

// Call BAPI_FLIGHT_GETLIST by using the class wide reference to the

// model object. This style of coding makes the coding easier to

// understand, and bypasses the need to traverse the context to locate

// the node to which the model object is bound, and then finally call

// execute() method. It is much simpler to invoke the execute() method

// directly on the model object

try {

bapiGetFlightList.execute();

// In ARFC2, it is no longer necessary to call the invalidate()

// method of the context node that corresponds to the output side of

// the BAPI's interface

checkBapiReturn(bapiGetFlightList.getOutput().getReturn());

}

catch(ARFC2ModelExecuteException ex) {

// If the call to the ABAP system goes pear-shaped, then the most

// meaningful message to show the user is usually found by calling the

// exception object's getNestedLocalizedMessage() method

msgMgr.reportException(ex.getNestedLocalizedMessage());

// Also write the exception to the system log

// Please make it a habit to add this simple line of code because it

// makes solving CSN messages *so* much easier!

logger.catching(ex);

}

//@@end

}

-----------------------

public void checkBapiReturn( java.util.List returnStruct ) {

//@@begin checkBapiReturn()

// Check that we've actually got a return value here

if (!returnStruct.isEmpty()) {

Bapiret2 returnMsg;

// Process all the messages found in the return structure

for (int i = 0; i < returnStruct.size(); i++) {

returnMsg = (Bapiret2)returnStruct.get(i);

// What king of message was returned?

switch(returnMsg.getType().toCharArray()[0]) {

// Error

case 'E':

msgMgr.reportException(returnMsg.getMessage());

break;

// Warning

case 'W':

msgMgr.reportWarning(returnMsg.getMessage());

break;

// Success or Information

case 'S':

case 'I':

// msgMgr.reportSuccess(returnMsg.getMessage());

break;

// Something else...

default:

msgMgr.

reportSuccess("Received message type " + returnMsg.getType() +

" with text " + returnMsg.getMessage());

}

}

}

else

msgMgr.reportWarning("Empty return structure after BAPI call");

//@@end

}

------------------------------------

//@@begin others

IWDMessageManager msgMgr;

FlightModel flightModel;

Bapi_Flight_Getlist_Input bapiGetFlightList;

//@@end

------------------------------------------------

when I execute rfc output-Flight_List is null in table UI

but When I set external breakpoint to debug in ecc I find output-Flight_List is not null

I know about it in netweaver 7.0 but 7.3 or 7.4 is different

can anybody help me to solve this issue..

thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Oct 03, 2014 at 08:58 AM

    Hi,


    The model binding is missing.

    bapiGetFlightList = new Bapi_Flight_Getlist_Input(flightModel);

    wdContext.node<RFC_Node>_Input().bind(bapiGetFlightList);

    Kind regards,

    Hermann

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 03, 2014 at 03:15 PM

    use wizard to generate code for calling rfc, don't write by your own.

    Add comment
    10|10000 characters needed characters exceeded