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

How to identify a BAPI call?

Former Member
0 Likes
3,040

Hi,

When creating a sales order, may I know how to identify if it is created manually using VA01 transaction, BDC method via EDI IDoc processing or through 'BAPI_SALESORDER_CREATEFROMDAT2' call?
To differentiate EDI from VA01, I may refer to system variable syst-binpt.
How about the BAPI call? How can I identify that the order is being created using a BAPI?
Thanks much for your guidance.

Thanks, Nick

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,752

You could also look for the BAPI FM in the stack (not valid when in update task of course, but there it is always too late), the code could look like :

CALL FUNCTION 'SYSTEM_CALLSTACK'
   IMPORTING
     et_callstack = lt_callstack.
LOOP AT lt_callstack TRANSPORTING NO FIELDS WHERE eventname CS 'BAPI'.
   EXIT.
ENDLOOP.
IF sy-subrc NE 0 " Not a BAPI
AND sy-batch IS INITIAL " Not a background job
AND sy-binpt IS INITIAL. " Not a batch input

Regards,
Raymond

3 REPLIES 3
Read only

JarosBaw
Active Participant
0 Likes
1,752

Hi,

Check function DIALOG_GET_STATUS.

Regards,

Jarek

Read only

arindam_m
Active Contributor
0 Likes
1,752

Hi,

You have to may be enhance the VBAK table to add custom fields and record the T-Code in a custom field. You can code in the  USEREXIT_SAVE_DOCUMENT or USEREXIT_SAVE_DOCUMENT_PREPARE exits and perform modifications you need to internal table vbak and xvbap.Standard SAP program will then update the database tables for you.

Cheers,

Arindam

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,753

You could also look for the BAPI FM in the stack (not valid when in update task of course, but there it is always too late), the code could look like :

CALL FUNCTION 'SYSTEM_CALLSTACK'
   IMPORTING
     et_callstack = lt_callstack.
LOOP AT lt_callstack TRANSPORTING NO FIELDS WHERE eventname CS 'BAPI'.
   EXIT.
ENDLOOP.
IF sy-subrc NE 0 " Not a BAPI
AND sy-batch IS INITIAL " Not a background job
AND sy-binpt IS INITIAL. " Not a batch input

Regards,
Raymond