on 2004 Mar 09 1:20 PM
I need to know a way to find out the name of the currently running method.
eg:
method abc.
data: m_name type abap_methname.
m_name = xxx->current_method( ).
endmethod.
m_name should be 'ABC'.
If course i know the name on design time but it is not my aim to use literals.
So does anyone know how to get the method name?
TIA Joachim
Request clarification before answering.
try this (I got it to work, but let me know if it works for you:
data: f1(100) type c.
get parameter id 'DBG_SOURCE_PROGRAM' field f1.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry Paul,
this is nothing but the started program.
I need the methodname, so above mentioned function module or following snippet is useful:
types:
begin of t_abap_callstack_entry,
mainprogram type dbgsrepid,
include type dbgsrepid,
line type dbglinno,
eventtype type dbglevtype,
event type dbglevent,
flag_system type c length 1,
end of t_abap_callstack_entry,
t_abap_callstack type standard table of t_abap_callstack_entry with default key.
DATA: l_tab_aut_callstack TYPE lcl_abapunit_callstack=>t_abap_callstack,
l_str_aut_callstack TYPE lcl_abapunit_callstack=>t_abap_callstack_entry.
call 'ABAP_CALLSTACK'
id 'DEPTH' field -10
id 'CALLSTACK' field l_tab_aut_callstack.
Regards;
Joachim
Hi Martin,
sorry for the typo, in the snippet the class lcl-abapunit_callstack is not needed.
Rememeber the function module but for those interested in the correct snippet:
types:
begin of t_abap_callstack_entry,
mainprogram type dbgsrepid,
include type dbgsrepid,
line type dbglinno,
eventtype type dbglevtype,
event type dbglevent,
flag_system type c length 1,
end of t_abap_callstack_entry,
t_abap_callstack type standard table of
t_abap_callstack_entry with default key.
DATA: l_tab_aut_callstack TYPE t_abap_callstack,
l_str_aut_callstack TYPE t_abap_callstack_entry.
call 'ABAP_CALLSTACK'
id 'DEPTH' field -10
id 'CALLSTACK' field l_tab_aut_callstack.
Regards;
Joachim
Postscriptum:
Classes lcl_abapunit* are not identical to ABAP Unit as part of ABA >=640
shorly u will always no the name of the method or have a variable containing its name.. wont you?, otherwise how will you call it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In the sap.devel.lang.abap i got the right hint.
Use the call stack via function module system_callstack.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Maybe you can use FM SYSTEM_CALLSTACK for that purpose.
Christian.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.