cancel
Showing results for 
Search instead for 
Did you mean: 

Calling BAPI from another BAPI

Former Member
0 Kudos

hi all,

the scenario is--

i have executed a BAPI which would display the workitems for a particular user.

after executing the first BAPI a table will be displayed with the list of workitems. now on

choosing a particular row from the table and pressing a button would execute another BAPI which would

display more detail information about the particular workitem.

the input for the second BAPI is the workitems "Workitem ID"

my requirement is--

how to call the "Workitem ID" from the first BAPI and give it as the input value for the

second BAPI.

the BAPI's used are--

<b>SAP_WAPI_WORKITEMS_BY_TASK - First BAPI

SAP_WAPI_WORKITEM_DESCRIPTION - Second BAPI</b>

kindly give me an idea of how to call the workitem ID from the first BAPI.

please let me know if i need to be more clear

Regards,

Ajay

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

You can set use the new Custom controller or wite a method in the same Custom controller to execute the modelobject as you have done for the first BAPI.

Since you want to execute the second BAPI on selecting the row of the table, you have to set the parameters of the second BAPI in the action itself and then call the method to execute the model of the second BAPI which may be in the new Custom Controller or in the same Custom Controller for your first BAPI as per your design.

Regards,

Ajay

Former Member
0 Kudos

Hi

Here you are displating the WorkItems coming from first BAPI in the table.

You must have bound the node for the workitems(WORKLIST Iguess) to this table.

Now there is a field for WorkItem Id say WI_ID.

Now you create an action Say getWorkItemDetails and assign it to the event onAction of your Button.

In this action you can get the Work Item Id of the selected row by using following method.

String wid = wdContext.currentWorklistElement().getWI_ID();

and set this value to input parameter of you second BAPI

as

wdContext.currentSAP_WAPI_WORKITEM_DESCRIPTIONElement().setWORKITEM_ID(wid);

Or you can directly set it by

wdContext.currentSAP_WAPI_WORKITEM_DESCRIPTIONElement().setWORKITEM_ID(wdContext.currentWorklistElement().getWI_ID());

Regards,

Ajay

Former Member
0 Kudos

Hi Ajay,

thanks for the response.

you have rightly understood my problem.

now iam able to understand how to give the input values for the second BAPI. but do i need to create another custom controller in order to execute the second BAPI.

after getting the Workitem ID from the getWorkItemDetails Action, where should i set the input values whether in custom controller WdoInit method or in the action itself.

eagerly waiting for your replies...

Regards,

Ajay

Former Member
0 Kudos

Hi Ajay,

You can create another custom controller or can be able to maintain it in the same custom controller using different Service Controller and Relate Context Attributes.

You can give the input for the second BAPI in the action itself.

kind regards,

Mukesh.