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 get the main funciton name when calling another function inside?

Former Member
0 Likes
1,239

for eg, one RFC named A,inside A,a funtion B is called.when the processing is at B now,how can i get the main RFC name(A)?

any help will be much appricated.

9 REPLIES 9
Read only

Former Member
0 Likes
1,194

Run the report in SE30, you will see the program flow. From there you can find out which FM is calling another.

Another way is using new Debugger, put a break-point in the FM and go to 'Standard' tab of debugger, here you will get the event log of the program.

Thanks,

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,194

To know it programmatically, you can use SYSTEM_CALLSTACK function module (search SDN for more information)

Read only

0 Likes
1,194

thanks to all.

in self program the FM 'SYSTEM_CALLSTACK' works.but i have another question:I need to get the main program id of the system process in my program,so i use FM 'TH_WPINFO' to get these process data,just like SM50 shows.

but the program id of the process that FM ''TH_WPINFO' gives to me is the current processing one, not the beginning one(the main program).so how can i get these main program id?

Read only

0 Likes
1,194

probably you need to call Th_WPINFO in main program and store the value in memory and retrieve from memory in sub program

Thanks

Bala Duvvuri

Read only

0 Likes
1,194

> I need to get the main program id of the system process in my program

Do you mean the frame program of the internal session = the one which is called by SUBMIT AND RETURN, or CALL TRANSACTION (etc.)?

It should be the first program in the call stack.

Read only

0 Likes
1,194

just see SM50,there is a column called 'Report',it shows the program id the proess is now processing.but i don't know its main program or say it 'the process's first excuting program',how can i get it programmatically?

Read only

0 Likes
1,194

> just see SM50,there is a column called 'Report',it shows the program id the proess is now processing.but i don't know its main program or say it 'the process's first excuting program',how can i get it programmatically?

I'm still not sure to understand. The program in SM50 is the current main program (not the first). It is stored in SY-REPID system variable. Or use this code:


DATA lt_callstack_long TYPE abap_callstack.
DATA ls_callstack_long TYPE LINE OF abap_callstack.
CALL FUNCTION 'SYSTEM_CALLSTACK'
      IMPORTING
        callstack    = lt_callstack_long.
READ TABLE lt_callstack_long INDEX 1 INTO ls_callstack_long.
WRITE : / 'current main program is:', ls_callstack_long-mainprogram.

If you want to know the frame program (the first called), use SY-CPROG, or use this code:


DATA lt_callstack_long TYPE abap_callstack.
DATA ls_callstack_long TYPE LINE OF abap_callstack.
CALL FUNCTION 'SYSTEM_CALLSTACK'
      IMPORTING
        callstack    = lt_callstack_long.
" read last line = first called program
DESCRIBE TABLE lt_callstack_long. "to make sy-tfill = number of lines
READ TABLE lt_callstack_long INDEX sy-tfill INTO ls_callstack_long.
WRITE : / 'First main program is:', ls_callstack_long-mainprogram.

Read only

0 Likes
1,194

Hi Sandra,

Maybe you have an idea on how I can access the portal sessiona and the correpsonding stack and or memory? I am in need of including a custom popup before displaying the area group page. I don't want to have to put a mo into the JAVA stack of th ecurrent ESS solution.I am hooking into the Fm hrxss_ser_getmenudata. and that works if I have a server session with a popup. But I would need a WD server that is hosted by the ESS server. Any idea how I can start this? The problem is that the RFC doe not allow any GUI or WD components to start. I wa sreading that could have to do with some basis settings. Any ideas?

Thx,

Andreas

Read only

0 Likes
1,194

I don't know. Could you ask the question in the Web Dynpro forum, I think that Thomas Jung could help you more on that topic...