‎2008 Jun 30 6:13 PM
hi guys,
suppose , we have 2 report programs, 'X' and 'Y'.
Now, progam 'X' is getting executed, during the execution, we submit program 'Y', later the control is taken back.
The issue i have is , during the execution of program 'Y' ,i want to know whether the program 'Y' is executed by itself or the program 'Y' is called from another program(like progam 'X' ).
If program 'Y' is called from another program, how can i know the name of the calling program???
plz help me as soon as possible...
points will be rewarded....
thnx, shivaa...
‎2008 Jun 30 6:18 PM
check whether the program name is passing with the variable in the submit.
‎2008 Jun 30 6:19 PM
Hi Shiva,
We can achieve this by using the system variable SY-CPROG.
SY-CPROG gives the name of the calling program.
Hope this helps you. \[removed by moderator\]
Any queries, get back to me.
Regards,
Chandra Sekhar
Edited by: Chandrasekhar Gandla on Jun 30, 2008 7:26 PM
Edited by: Jan Stallkamp on Jul 1, 2008 4:32 PM
‎2008 Jun 30 6:32 PM
no, chandra sy-cprog is not showing correct value...
from program 'X', we call program 'Y'.
at some point in program, 'Y' I keep debug-point and check for sy-cprog value..instead of program 'X'., we r getting program 'Y'.
can you guys suggest me another way.....
‎2008 Jun 30 6:38 PM
May be u can use FM SYSTEM_CALLSTACK. By reading the call stack u can find out whether prog. Y is called by some other prog. or not.
CALL FUNCTION 'SYSTEM_CALLSTACK'
IMPORTING
ET_CALLSTACK = t_syst.
Regards,
Joy.
‎2008 Jun 30 6:38 PM
Hello shivaprasad,
If you want to know whether your program 'Y' is executed by another then the system field is:
SY-CALLD
It contains X if the program was started using CALL TRANSACTION, CALL DIALOG, or SUBMIT u2026 [AND RETURN]. Space if the program was started using LEAVE TO TRANSACTION or using a transaction code from a screen. SY-CALLD is always space when a batch input session is being processed.
If you want to know what program has called your program then the system field is:
SY-CPROG
It contains the name of the calling program in an external routine, otherwise the name of the current program.
you can also check this system field SY-REPID
It returns the name of the current ABAP program. For externally-called procedures, it is the name of the main program of the procedure. If you pass SY-REPID as an actual parameter to an external procedure, the formal parameter does not contain the name of the caller, but that of the main program of the procedure. To avoid this, assign SY-REPID to an auxiliary variable and use that in the call, or use the system field SY-CPROG.
Hope you find it useful
Regards
Indu.
Edited by: Indu Rayepudi on Jun 30, 2008 7:42 PM
‎2008 Jun 30 6:51 PM
no luck again, sy-cprog is giving the value of 'Y', not 'X'.
i dont understand why???
in program 'X', v have stmt---> submit Y and return.
when, program 'Y', is running i keep debug point and check for value sy-cprog, its still showing 'Y',not 'X'.
‎2008 Jun 30 7:00 PM
Try to call FM SYSTEM_CALLSTACK from prog. Y and in debug mode check the table t_syst's content.If should have an entry that indicates from where this prog. is getting called.
CALL FUNCTION 'SYSTEM_CALLSTACK'
IMPORTING
ET_CALLSTACK = t_syst.
Regards,
Joy.
‎2008 Jun 30 7:10 PM
even wid FM SYSTEM_CALLSTACK, i am not getting 'X' value.....
‎2008 Jun 30 8:00 PM
Can you pl. tell me what are the entries u r getting when then the prog is called from another prog. in table t_syst?
CALL FUNCTION 'SYSTEM_CALLSTACK'
IMPORTING
ET_CALLSTACK = t_syst.