on 05-18-2005 3:56 PM
Hi,
in my ALV i use this method:
METHOD handle_user_command." Handleown functions defined in thetoolbar
CASE <b>e_ucomm</b>.
WHEN 'CHANGE'.
PERFORM change_details.
WHEN 'INSERT'.
PERFORM insert_record.
WHEN 'DELETE'.
PERFORM delete_record.
ENDCASE.
ENDMETHOD.
within the different routines shown (e.g. insert_record) i call a screen.
<u>How can i get the value of e_ucomm once i am within the screen (PBO or PAI)?</u>.
hi,
i´ve declared e_ucomm as a global variable and it does not work either.
The program and the screen are in the same program.
i use this class:
CLASS lcl_event_receiver DEFINITION DEFERRED.
*----
-
C L A S S E S
*----
-
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object e_interactive,
handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING
e_ucomm
.ENDCLASS.
Best regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi calsadillo
Within the implementation of <i>handle_user_command</i>, assign <i>e_ucomm</i> to a global variable.
<u>e.g.</u>
DATA gv_ucomm_alv LIKE sy-ucomm .
...
METHOD handle_user_command .
...
gv_ucomm_alv = e_ucomm .
...
ENDMETHOD .
In fact, I recommend to encapsulate the ucomm as an attribute within the handler class, however the above way will solve your question in a classical approach.
Regards
*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>
Hi,
Try this out
<b>IN PBO,</b>
SET HANDLER o_eventreceiver->handle_user_command FOR o_Alvgrid.
SET HANDLER o_eventreceiver->handle_toolbar FOR o_Alvgrid.
-
<b>CLASS lcl_event_receiver DEFINITION.</b>* event receiver definitions for ALV actions
PUBLIC SECTION.
CLASS-METHODS:
Status bar
handle_user_command
FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm,
Tool bar
handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object
e_interactive.
ENDCLASS.
________________________________________________________
CLASS lcl_event_receiver IMPLEMENTATION.
create the relevant buttons on the toolbars
<b> METHOD handle_toolbar.</b>
This method handles the user interaction with the tool bar.
w_action(12) TYPE c.
CASE w_action.
WHEN 'SELECT'.
**========================
REFRESH i_toolbar.
PERFORM f1000_toolbar_create USING: '3' '' '' '' '' '',
'0' 'FCODE' icon_modify
text-006 '' '',
'0' 'RFBACK' icon_arrow_left
text-007 '' ''.
*
LOOP AT i_toolbar INTO w_toolbar.
APPEND w_toolbar TO e_object->mt_toolbar.
ENDLOOP.
*
*
WHEN OTHERS.
*
REFRESH i_toolbar.
PERFORM f1000_toolbar_create USING: '3' '' '' '' '' '',
'0' 'FCODE' icon_checked
text-008 '' text-005.
*
LOOP AT i_toolbar INTO w_toolbar.
APPEND w_toolbar TO e_object->mt_toolbar.
ENDLOOP.
ENDCASE.
*
ENDMETHOD.
<b>
METHOD handle_user_command.</b>
In event handler method for event USER_COMMAND: Query your
function codes defined in step 2 and react accordingly.
*
<b> CASE e_ucomm.</b>
*
WHEN 'FCODE'.
*
CALL METHOD o_alvgrid->get_selected_rows
IMPORTING
et_index_rows = i_selected_rows
ET_ROW_NO =
.
*
IF i_selected_rows[] IS INITIAL.
MESSAGE i153 WITH text-009.
LEAVE LIST-PROCESSING.
ENDIF.
*
Clear: w_reviewed_mat.
*
w_reviewed_mat-reviewed = C_X.
w_reviewed_mat-reviewedby = sy-uname.
w_reviewed_mat-reviewedon = sy-datum.
*
Loop at i_selected_rows into w_selected_rows.
Read table i_output into w_output index w_selected_rows-index.
If sy-subrc eq 0.
w_reviewed_mat-matnr = w_output-matnr.
Endif.
Append w_reviewed_mat to i_reviewed_mat.
Clear: w_reviewed_mat-matnr.
Endloop.
*
Modify ZZCS_MAT from table i_reviewed_mat.
*
WHEN OTHERS.
*
ENDCASE.
ENDMETHOD.
Check this out.
Thanks & Regards,
Judith.
Hi Calsadillo,
In the code snippet you have shown above, contrary to what I suppose you're assuming, <b>e_ucomm</b> is not declared as a global variable.
For the variable to be global, you have to declare it outside the class definition. That is because, you want to use that variable Outside the objects of that class - i.e., <i>in the PBO of the next screen</i>.
The code given above by Serdar does exactly that. try to implement it and see if you still run into any problems. Get back if you do.
Regards,
Anand Mandalika.
As long as you e_ucomm is moved to a global variable or it itself is declared as a global variable and your screen processing logic is also in the same program as your ALV program, you should be able to just use that value.
Are your ALV program and your screen program different or are they same?
Srinivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Why nor simply use a global variable where you save the UCOMM code?
Hope that helps (please reward me if it does),
Joerg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.