2010 Jan 28 11:14 AM
Hi Experts,
Is there any system variable to catch the triggered event Like Initialisation, Start of Selection etc.
I have a form which can be called in different events. And i want to display different msgs based on the based on the Event in which the form is called.
The code for this display msg will be written inside the Form.
Could you please advice on how to capture the triggered event.
2010 Jan 28 11:30 AM
Add a additional paramater in form for event. And while calling pass the event name from where its being called.
CONSTANTS : BEGIN OF event ,
init TYPE char01 VALUE 'A' ,
strt TYPE char01 VALUE 'B' ,
ends TYPE char01 VALUE 'C' ,
topf TYPE char01 VALUE 'D' ,
END OF event .
INITIALIZATION.
PERFORM add_please USING 1 1 event-init .
START-OF-SELECTION .
PERFORM add_please USING 2 2 event-strt .
END-OF-SELECTION .
PERFORM add_please USING 3 4 event-ends .
TOP-OF-PAGE .
PERFORM add_please USING 4 4 event-topf .
*&---------------------------------------------------------------------*
*& Form ADD_PLEASE
*&---------------------------------------------------------------------*
FORM add_please USING lv_a TYPE i
lv_b TYPE i
from_event TYPE char01 .
DATA :lv_sum TYPE i .
lv_sum = lv_a + lv_b .
CASE from_event.
WHEN event-init .
WRITE : / 'Initialization' , lv_sum .
WHEN event-strt .
WRITE : / 'Start of Selection' , lv_sum .
WHEN event-ends .
WRITE : / 'End of Selection' , lv_sum .
WHEN event-topf .
WRITE : / 'Top of Page' , lv_sum .
ENDCASE .
ENDFORM. "ADD_PLEASE
Hi Experts,
Is there any system variable to catch the triggered event Like Initialisation, Start of Selection etc.
I have a form which can be called in different events. And i want to display different msgs based on the based on the Event in which the form is called.
The code for this display msg will be written inside the Form.
Could you please advice on how to capture the triggered event.
2010 Jan 28 11:18 AM
Why do you want to know the Events, when you know yourself that in which event you are calling your subroutine.
You can hardCode your message.
2010 Jan 28 11:25 AM
Hi,
I would not like to harcode teh events in my prg.
However i would like to dynamically allocate the event triggered into teh variable in the Form.
Or say its a Function Module. It can be used in any prg and in any event. Then in that case to dynamically allocate the event in which this is called wht can be a probable way.
2010 Jan 28 11:30 AM
Add a additional paramater in form for event. And while calling pass the event name from where its being called.
CONSTANTS : BEGIN OF event ,
init TYPE char01 VALUE 'A' ,
strt TYPE char01 VALUE 'B' ,
ends TYPE char01 VALUE 'C' ,
topf TYPE char01 VALUE 'D' ,
END OF event .
INITIALIZATION.
PERFORM add_please USING 1 1 event-init .
START-OF-SELECTION .
PERFORM add_please USING 2 2 event-strt .
END-OF-SELECTION .
PERFORM add_please USING 3 4 event-ends .
TOP-OF-PAGE .
PERFORM add_please USING 4 4 event-topf .
*&---------------------------------------------------------------------*
*& Form ADD_PLEASE
*&---------------------------------------------------------------------*
FORM add_please USING lv_a TYPE i
lv_b TYPE i
from_event TYPE char01 .
DATA :lv_sum TYPE i .
lv_sum = lv_a + lv_b .
CASE from_event.
WHEN event-init .
WRITE : / 'Initialization' , lv_sum .
WHEN event-strt .
WRITE : / 'Start of Selection' , lv_sum .
WHEN event-ends .
WRITE : / 'End of Selection' , lv_sum .
WHEN event-topf .
WRITE : / 'Top of Page' , lv_sum .
ENDCASE .
ENDFORM. "ADD_PLEASE
2010 Jan 28 11:48 AM
Hi,
Thanks for the code. However my requirement is this function module or form can be called inside any prg. Hence i will not have access to code in the calling program.
Anyways, I just found out there is a FM SYSTEM_CALLSTACK that returns the event in which this form of function module is called.
Thanks anyways.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |