cancel
Showing results for 
Search instead for 
Did you mean: 

calling a BAPI by selecting a row of a table

Former Member
0 Kudos

hi

I have two BAPIs used by my application and my first BAPI is being called after I give input parameters in the first screen.

Now on calling first BAPI, the results are being displayed in the table format in second screen, now on selecting any row from that table, that should take the input for tha secind BAPI and call the second BAPI.

I am not able to get through that.

Can anybody help me in this issue.

thanks and regards

gopi krishna

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

closing the ticket

Former Member
0 Kudos

HI Armin

The problem is not yet solved.

I am still not able to call the second BAPI.

can you guide me further

thanks and regards

gopi

Former Member
0 Kudos

hi Armin

I am calling the particular BAPI for that particular onLeadSelection Action.

I am not sure whether the method is being called or not.

I am passing the particular order_number parameter but the BAPI is not being called.

yes I called invalidate() after the BAPI execute().

Maybe there is any problem in my mapping of the context.

Or should I send you my code, can you just help me if any thing has to be added.

thanks and regards

gopi

Former Member
0 Kudos

Gopi,

Can you post the complete code here.. (event handler code for onLeadSelection and the code of the function which calls the second BAPI).

Regards

Bharathwaj

Former Member
0 Kudos

hi Bharathwaj

I am posting the complete code this one is for the execution of the second BAPI.

public void executeZ_vf_Lennox_Final( java.lang.String Sd_Doc )

{

//@@begin executeZ_vf_Lennox_Final()

try

{

// Calls remote function module BAPI_FLIGHT_GETLIST

wdContext.currentZ_vf_Lennox_InputElement().modelObject().execute();

// Synchronise the data in the context with the data in the model

wdContext.nodeI_Order_Details().invalidate();

}

catch (Exception ex)

{

// If an exception is thrown, then the stack trace will be printed

ex.printStackTrace();

wdComponentAPI.getMessageManager().reportSuccess("call BAPI2 with order number " + Sd_Doc);

}

//@@end

}

And for the action handler where I am calling the second BAPI.

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

{

//@@begin onActioncallZ_vf_Lennox1(ServerEvent)

wdThis.wdFirePlugToOrderStatusDetails();

wdThis.wdGetOrderStatusCustController().executeZ_vf_Lennox_Final(wdContext.nodeSales_Order_List_Output().currentSales_Order_List_OutputElement().getSd_Doc());

//wdThis.wdGetOrderStatusCustController().executeZ_vf_Lennox_Final();

//@@end

}

can u please suggest me what has to be modified.

thanks and regards

gopi

Former Member
0 Kudos

Try this:

Call invalidate() on the <b>output</b> node of the BAPI and move the debug message statement before the try-catch-block.

Armin

Former Member
0 Kudos

Hi,

You have passed the sd_doc value as an argument for the execute function.

Now you have take this value and set t as input for the second bapi.

<z_vf_..element>.setSd_doc(sd_doc); and then execute the function.

Check this link on how to do it..

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/761eba66-0401-0010-b982-d5f...

Regards

Bharatwhaj

Message was edited by: Bharathwaj R

Former Member
0 Kudos

hi Bharathwaj

Thankd for your response.

Now in my application I am only using one custom controller, all my BAPIs binding is done in the same custome controller.

You have mentioned that we have to set the input for the second BAPI after doing this step.

<z_vf_..element>.setSd_doc(sd_doc); and then execute the function

can you tell me where exactly where this has to be done.

thanks and regards

gopi krishna

Former Member
0 Kudos

HI ,

DO it in the executeXXXXX function u have written ..(before modelobject.execute..).

On steps for how to do it.. check the link i had givn in the previous post..that should help you out.. !

Regards

Bharathwaj

Former Member
0 Kudos

Hi Bhardwaj,

Could you pls tell me where can I bind ,call second BAPI .

Means I created Only one Customecontroller in that only I called the first BAPI. But I need the first BAPI Input as a input for the second BAPI.

For that reason Where can I Bind the second BAPI And where can i give the Input parameter To second BAPI.

How it goes dynamically .I.E Selection of pirticular link in the output table of first BAPI Result.

I have Only SearchView and Resultview and FinalView

For control CustomControlView only.

I am struk in calling dynamically pls

guide me how to solve this.

Thanks& Regards

Former Member
0 Kudos

Assign an action to the "onLeadSelect" event of the table. In the action handler, call the (component/custom) controller method that calls the BAPI.

Armin

Former Member
0 Kudos

hi Armin

Thanks for you quick response.

My problem is that on clicking a row in the table, the column "order_number" shpuld go as the input value to the second BAPI.

I am very new to Web dynpro, can you be more clear regarding the syntax what I have to implement.

thanks and regards

gopi krishna

Former Member
0 Kudos

First, think about how you want to trigger the action that calls the BAPI.

Should it be triggered when

- the table row selection changes

- when some button e.g. in a toolbar is pressed

- when a link inside the table row is pressed

In the action handler (view controller method on<ActionName>), you have to get the order number that should be passed to the BAPI.

In case, you want the order number of the currently (lead-) selected table row, this is exactly the order number in the current (lead-selected) node element of the table's data source node "X":

wdContext.nodeX().currentXElement().getOrderNumber()

assuming the attribute storing the order number is named "OrderNumber".

Armin

Former Member
0 Kudos

hi Armin

Thanks for the reponse.

I have created an action on the table onLeadSelection option and I have given the fireplug to next screen and also passed the execute method of the second BAPI in that.

Now on clicking any row in the table, the order number from that particular row should be the input for the second BAPI that I have to call.

So how should I go about this, by selecting any row in the table, such that it picks the order number from that row coming from first BAPI

And then it has to be passed to the second BAPI as input.

Please suggest me as what has to be done in order to achieve that.

thanks and regards

gopi

Former Member
0 Kudos

Suppose you have a component controller method "callBAPI2" with a parameter "orderNumber" that calls the second BAPI.

First, declare a "controller usage" for the component controller from the view controller.

Doing so, you will get a method wdGet<ComponentController>() in the view controller.

In the action handler, you then call something like

wdGet<ComponentController>().callBAPI2
(
  wdContext.nodeX().currentXElement().getOrderNumber()
);

where "X" is the table's data source node.

Armin

Former Member
0 Kudos

hi Armin

I have done as you said, but on clicking the row of a table the second BAPI is not being called and the table is not being populated.

So you mean to say that I have to define the second BAPI mothod with one input parameter.ie order number in this case.

Is there anything that I am missing, can you help me out.

thanks and regards

gopi

Former Member
0 Kudos

hi

Is there anything that I have to declare in the implementation of the second BAPI method.

rgds

gopi

Former Member
0 Kudos

Add a statement like

wdComponentAPI.getMessageManager.reportSuccess("call BAPI2 with order number " + orderNumber);

inside method callBAPI2().

Is this method called when you select a row, if yes, which parameter is passed?

Do you call invalidate() after the BAPI execute()?

Armin