Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Run time parameter to check BAPI call

Former Member
0 Likes
3,573

Hi All,

I have one exit which is called during PO change. I want to distinguish whether this exit is called through BAPI or ME22N. Is there any runtime parameter which can show us that we are inside BAPI?

Note:I can not put check ( If sy-tcode NE ME22n) to check BAPI.

Hi All,

I have one exit which is called during PO change. I want to distinguish whether this exit is called through BAPI or ME22N. Is there any runtime parameter which can show us that we are inside BAPI?

Note:I can not put check ( If sy-tcode NE ME22n) to check BAPI.

7 REPLIES 7
Read only

eduardo_hinojosa
Active Contributor
0 Likes
1,920

Hi

Try it with the value of SY-TCODE.

Regards

Eduardo

Read only

Former Member
0 Likes
1,920

I believe there is NO system parameter for identifying the BAPI called behaviour, if you don't want to use sy-tcode option then use EXPORT/IMPORT option.

EXPORT a flag from either a custom wrapper BAPI over standard BAPI or use implicit enhancement of standard BAPI for it.

BR,

Diwakar

Read only

Former Member
0 Likes
1,920

You could use the FM 'SYSTEM_CALLSTACK' in your exit, this would give you the origin of the call to the exit.

Vikranth

Read only

Former Member
0 Likes
1,920

It depends on which exit you are using. For example, in the BADI "ME_PROCESS_PO_CUST" you can identify whether the method Implementation is executed from a BAPI call by tracking the value of instance attribute "FOR_BAPI"( value 'X' if called from BAPI and ' ' otherwise) of class CL_PO_HEADER_HANDLE_MM (Refer to parameter IM_HEADER type IF_PURCHASE_ORDER_MM of badi method PROCESS_HEADER).

Regards, Vinod

Read only

0 Likes
1,920

Hi,

SY-TCODE won't work as it will return the original program name where from BAPI is call and there can be many such program.

IMPORT/EXPORT is also not a option , as said that there can be many program in system calling BAPI and many new programs could be written, so not a generalize solution.

We are updating one custom table in standard peace of code( modification to standard ) , so no parameter exist as suggested like in some BADI.

Will check for call stack.

Isn't any parameter where business object behind the current BAPI call is available? Any hint will be very helpful.

Thanks all for your inputs and help so far.

Read only

deepak_dhamat
Active Contributor
0 Likes
1,920

Hi Anurag ....

WHen you are executing me22n or me21n or me59n ... there will be value in sy-tcode . user exit are nothing but function module only .

if bapi is executed using zreport then its transaction code will be there i.e SE38 / transaction code if any given for report .

so you can check for me22n . if it is me22n then only execute other code else not .

regards

Deepak.

Read only

jasonmelo72
Explorer
0 Likes
1,920

Try checking global variable 'call_bapi'. If it is 'X', then it is a BAPI call. CALL_BAPI will be blank otherwise.