Calling SAP BAPI from WebMethods

Hi all.

I am calling a BAPI directly from my service, e.g. BAPI_REQUISITION_GETDETAIL. I mapped both the input and output fields in the pipeline. When I test it using a valid requisition number, I get the values of REQUISITION_ITEMS table in the Result tab. If I put an invalid requisition number, the REQUISITION_ITEMS table is empty which is expected but I also expect to have something in the RETURN table unfortunately, even the RETURN table itself is not in the Result tab. Actually, regardless if it is valid or not, I don’t see the RETURN table in the Result tab. In SAP, when you try the BAPI, the RETURN table is empty if requisition is found otherwise it will give you the error message it encountered. This is what I’m after in the Result tab.

I have a theory but not sure if this is true. I noticed that if a table in BAPI is marked as optional, it doesn’t get passed to webMethods. I tried it by inquiring a requisition with texts. It did not pass the ITEM_TEXT table even if I set the text indicator to X but as usual if I try it in SAP, I get the texts in ITEM_TEXT table. Did somebody experienced a similar problem before?

Thanks in advance.
Miles

I have come across it quite frequently.
You need to pass in an empty row as an input and then you get values back.
Greg.

Hi Greg,

Thanks for the reply. Not sure if I can pass an empty row to the BAPI since the RETURN table is not an Input parameter too? The BAPI might dumped due to inconsistent parameters passed.
If I did not get your suggestion correctly, can you please explain further?

Thanks.
Miles

Miles,

In my experience, the tables in SAP RFC function modules (BAPIs) are available as input and output parameters - you can specify INPUT and OUTPUT parameters that are not tables, but tables are effectively both.
I just pipe in an empty row into RETURN as an input and that seems to take care of it.

In SAP functions I have written that use tables I can actually see the empty row passed in and if it is going to be used for output then I clear the table out before adding the appropriate records.

Greg.

Hi Greg,

I tried it and it worked! Thanks a lot.
I am not familiar on how BAPIs work outside of SAP. I’m so used to just passing the input parameters and get the results as expected.
But I really appreciate your help though it proved my theory wrong

Thanks once again.
Miles

Hi,

one year later - and still somebody neede this hint.
Thanks so much !

Joe from Berlin

Hello everybody outside there,

6 years later i got the same problem, find the same thread and my OWN reply !! :slight_smile:

Cheers Joe

Thanks All.

This is still helping :slight_smile:

Deepika