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 Function Module name when executing it

Former Member
0 Likes
3,283

hi,

i would like to check if the zFM that executed is allowed to be used or not.

when the control comes to zFM, i need to check against a customised table. if the FM is maintained in the table then zFM can be executed else control should come out of the zFM.

i check sy-repid but it is stored the main program name and not the zFM name.

may i know how to get the zFM name?

thanks

rgds

3 REPLIES 3
Read only

Former Member
0 Likes
1,046

Hi,

I don't think there is a field for function module. You can just check if there is any runtime field for the same in structure SYST.

Regards,

Atish

Read only

Former Member
0 Likes
1,046

Hello ,

You are right in the sense that we have the program name of the function group available in sy structure and not the function module name....

I will suggest you a work around... .create only one function module under a function group and definitely the name of function group and function module be the same....

So when a function module is executed the program name for the function group will be displayed as SAPLXXXX

where XXXX is the function group name

check if the ztable holds the value after the first 4 characters SAPL,ie XXXX in the ztable..using sy-repid..

Please let know if you found a variable for the same

Reward if helpful

Regards

Byju

Read only

Former Member
1,046

Hi,

please check the following in fm:

DATA: xt_ctm_rfc_call              TYPE  sys_callst. "Callstack Table

DATA: xs_ctm_rfc_call              TYPE  sys_calls.  "Callstack Line

  CLEAR                                  xt_ctm_rfc_call.

                                                                                                                                                                                                                                                             

  CALL FUNCTION 'SYSTEM_CALLSTACK'

    IMPORTING

      et_callstack                    =  xt_ctm_rfc_call.

                                                                                                                                                                                                                                                             

  READ  TABLE  xt_ctm_rfc_call    INDEX  1

                                   INTO  xs_ctm_rfc_call.

                                                                                                                                                                                                                                                             

  xv_ctm_rfc_fm                       =  xs_ctm_rfc_call-eventname.

Regards,

Klaus