cancel
Showing results for 
Search instead for 
Did you mean: 

pass value of "ucomm" in ALV to a screen

former_member182371
Active Contributor
0 Kudos

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>.

Accepted Solutions (1)

Accepted Solutions (1)

former_member182371
Active Contributor
0 Kudos

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.

ssimsekler
Active Contributor
0 Kudos

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>

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Answers (2)

Answers (2)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

Why nor simply use a global variable where you save the UCOMM code?

Hope that helps (please reward me if it does),

Joerg