cancel
Showing results for 
Search instead for 
Did you mean: 

urgent : calling BAPI in webdynpro

Former Member
0 Kudos

i have an application in which i got the table . Inside this table , i got the details from one Bapi.

In the next view, I have one more table to get the details from other BAPI.

How should i write the code..so that the output of the first BAPI is the import parameter to the second BAPI and get the item level details.

I am able to see the data from first BAPI..but i m not getting the details in the second BAPI.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi ,

Did u mean to ask send the output of the first bapi to second bapi?

If ok then

In second bapi execute method u create a instance of second bapi. and passing the parameter to that instance.

BAPI2 output=new BAPI2();

wdContext.nodeBAPI2().bind(output);

// Calls remote function module

output.set<Second bapi input>wdContext.node<first bapi out put node>().currentElement().getFieldname());

wdContext.currentBAPI2Element().modelObject().execute();

this might works.

Do u need more reply me.

Thanks

Mandapati

Former Member
0 Kudos

hi nagesh,

Eg:- There are BAPI1 and BAPI2. I m using BAPI1 in first screen and BAPI2 in second screen.

in first screen ..i got BAPI1 details like Empno, name, description.

In the second screen, i have table in which i am calling one more BAPI.

I have to take Empno. as the input to the second BAPI and display the details in second screen.

If u give me coding it ll be appreciated.

Former Member
0 Kudos

how do i pass the parameter to that instance ???

Former Member
0 Kudos

Hi ,

In controller u have execute method inthat u write like this.

execute()

{

BAPI2 output = new BAPI2();

output.nodeBAPI2().bind(output);

output.setempno(wdContext.nodeof firstBAPIoutputnode().currentURBAPIoutnodeelement.getEmpno());

wdcontext.currentBAPI2element().modelObjet().execute();

}

this execute method call in the first view table Onleadselection like as Action method .

I mean to say create method onclick() in that implementation call like this

pluin for first view to second view and

call the execute method.

{

wdthis.FirePlug();

Wdthis.wdGetCustomcontroller().execute() method.

}

This should works

If any query let me know.

Thaks

Mandapati

Message was edited by: Mandapati Nageswara Rao

Former Member
0 Kudos

it is showing error BAPI2 is not of type

Former Member
0 Kudos

hi

give me ur two bapi details and input details.

Thanks

Mandapti

Former Member
0 Kudos

FIRST BAPI(Z_WAPI_WRAPPER) output is a table called "worklist". In this table we have to take parameter <b>wi_id</b> as the input to the SECOND BAPI which is SAP_WAPI_GET_WORKITEM_DETAIL and to display the details.

Former Member
0 Kudos

Hi,

First BAPI is Z_WAPI_WRAPPER.

SecondBAPI is SAP_WAPI_GET_WORKITEM_DETAIL .

In custom/component controller create a execute method.

this method implementation is

execute()

{

SAP_WAPI_GET_WORKITEM_DETAIL output = new SAP_WAPI_GET_WORKITEM_DETAIL ();

wdContext.currentSAP_WAPI_GET_WORKITEM_DETAIL().bind(output);

output.setwi_id(wdContext.node<firstBAPIOutputNode>().currentNodeSAP_WAPI_GET_WORKITEM_DETAILElement().getwi_id();

wdcontext.currentSAP_WAPI_GET_WORKITEM_DETAILElement().modelObject().execute();

wdcontext.nodeSAP_WAPI_GET_WORKITEM_DETAILOutput().invalidate();

}

After this u can goto ur first view outline and click the table and goto the properties.In the Properties u can find OnLeadSelection there u create a action method for plug-in pass from first view to second view.

u need to give inbound and outbound plugins

Let us say that method is Onclick()

{

wdThis.Fireplug();

wdThis.wdGetController().execute();

}

U can implement like this .

thanks

Mandapati

Former Member
0 Kudos

Hi Christopher,

Try this

Execute the First BAPI

and assign the input like

wdContext.currentSAP_WAPI_GET_WORKITEM_DETAILElement().setWi_id(

wdContext.currentworklist().getWi_id());

and execute the second BAPI

you can get the result

Kind Regards

Mukesh