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

Do Function-Modules know their own name ?

Former Member
0 Likes
415

Hello,

can a function-module send its own name ? If I use sy-repid, I only get the Function group.

I also need this for methods in classes.

Any idea ?

Thanks for all

Stefanie

3 REPLIES 3
Read only

Former Member
0 Likes
389

You could cheat and create a constant with the name of the function module, method, class, etc... in the appropriate place and then reference that?

Read only

Former Member
0 Likes
389

Hey Gurus,

I found a solution myself:


FUNCTION ZTESTSTACK.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  EXPORTING
*"     REFERENCE(E_MAINPROG) TYPE  SY-REPID
*"     REFERENCE(E_INCLUDE) TYPE  SY-REPID
*"     REFERENCE(E_EVENT) TYPE  ABDBG-LEVENT
*"----------------------------------------------------------------------
  TYPES:
  begin of abap_call_stack_entry,
    mainprogram like sy-repid,
    include like sy-repid,
    line type i,
    eventtype like abdbg-leventtype,
    event like abdbg-levent,
    flag_system type c,
  end of abap_call_stack_entry.
  DATA:
  acse type abap_call_stack_entry,
  tab type table of abap_call_stack_entry.
  CALL 'ABAP_CALLSTACK' ID 'DEPTH' FIELD 2
  ID 'CALLSTACK' FIELD tab.
  read table tab index 2 into acse.

  e_mainprog = acse-mainprogram .
  E_include = acse-include.
  E_event = acse-event.

ENDFUNCTION.

This Fm returns the actual function. Hte first entry in itab would be the FM ZTESTSTACK itself. So I have to take the second one.

Read only

former_member787646
Contributor
0 Likes
389

Hi Stefanie,

Good Research. I Appreciate it. I may be helpful to me in the future.

Thanks

Murthy