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

Alv grid display

Former Member
0 Likes
2,482

Hi,

I have used a alv grid in which a row has to be selected and using the value in that row i have to display few values.

I have written a coding where the output is like alv grid is displayed but the user command does not work.can anyone  please tell me what is wrong?

Thanks in advance.

Hi,

I have used a alv grid in which a row has to be selected and using the value in that row i have to display few values.

I have written a coding where the output is like alv grid is displayed but the user command does not work.can anyone  please tell me what is wrong?

Thanks in advance.

15 REPLIES 15
Read only

Amarpreet
Active Participant
0 Likes
2,396

Hi Sharon ,

i'm not sure about how you're using Events ,

have a look at the code at the following link.

http://www.erpgreat.com/abap/an-interactive-alv-report.htm

it's very well commented.

hope this helps .

good luck

Read only

Former Member
0 Likes
2,396

I tried your code and it works fine. How come did you say that user command does not work?

Regards,

Jake

Read only

0 Likes
2,396

I tried to use a write statement to check whether its working inside my user command and top of page but nothing got displayed so i thought its not working...my actual requirement is that when i click on the value an order list should be displayed in smartform and when back button is pressed it has to be redirected to a screen..do u have any idea about it..thanks for replying Jake

Read only

Former Member
0 Likes
2,396

Hello sharon..

please evaluate code...i have writing here.. just understand the logic... this is sample code.

(sample : Alv column click to navigate PO (me23n) )

FORM DISPLAY_ALV_REPORT.

  GD_REPID = SY-REPID.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

       EXPORTING

            I_CALLBACK_PROGRAM      = GD_REPID

*            i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM

            i_callback_user_command = 'USER_COMMAND'       <<<<<<< this is perform for below code     

*            i_grid_title           = outtext

            IS_LAYOUT               = GD_LAYOUT

            IT_FIELDCAT             = FIELDCATALOG[]

*            it_special_groups       = gd_tabgroup

*            IT_EVENTS                = GT_XEVENTS

            I_SAVE                  = 'X'

*            is_variant              = z_template

       TABLES

            T_OUTTAB                = IT

       EXCEPTIONS

            PROGRAM_ERROR           = 1

            OTHERS                  = 2.

  IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  ENDIF.

ENDFORM.                    " DISPLAY_ALV_REPORT

''

''

''

''

''

''

''

"
"
"
"
"
"

FORM USER_COMMAND USING UCOMM TYPE SY-UCOMM

                        SELFIELD TYPE SLIS_SELFIELD.

  CASE UCOMM.

      WHEN '&IC1'.

          READ TABLE IT INDEX SELFIELD-TABINDEX INTO WA.

          IF SY-SUBRC EQ 0.

            IF SELFIELD-FIELDNAME = 'EBELN' ."AND NOT WA-LIFNR IS INITIAL.

                SET PARAMETER ID 'BES' FIELD WA-EBELN.

                CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.

              ENDIF.

           ENDIF.

    ENDCASE.

  ENDFORM.

hope this helps......

Read only

Former Member
0 Likes
2,395

ur code is perfectly fine.

u can check by placing a break-point in the very begning of user_command form.

this subroutine (form ...end form ) will get fired when u double click on any cell or row of alv grid.

Read only

0 Likes
2,395

Thank you Abhishek..please read my reply to Jake

Read only

0 Likes
2,395

Hi Sharon,

Once you have created your smartform you can call it from your user command this way:

DATA: gv_fm_name  TYPE rs38l_fnam.

DATA: gs_output   TYPE ssfcompop.
DATA: gs_cparam   TYPE ssfctrlop.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname                 = 'ZSMARTFORM'
*   VARIANT                  = ' '
*   DIRECT_CALL              = ' '
   IMPORTING
     fm_name                  = gv_fm_name
   EXCEPTIONS
     no_form                  = 1
     no_function_module       = 2
     OTHERS                   = 3
            .

gs_output-tdnewid = 'X'.
gs_output-tdimmed = 'X'.
gs_output-tdfinal = 'X'.
gs_output-tdarmod = '1'.
gs_cparam-getotf    = 'X'.
gs_cparam-no_dialog = 'X'.

***form call:
    CALL FUNCTION gv_fm_name
      EXPORTING
*       archive_index              = gs_arc
*       ARCHIVE_INDEX_TAB          =
*       ARCHIVE_PARAMETERS         =
       control_parameters         = gs_cparam
*       MAIL_APPL_OBJ              =
*       MAIL_RECIPIENT             =
*       MAIL_SENDER                =
       output_options             = gs_output
*       USER_SETTINGS              = 'X'
     IMPORTING
*       DOCUMENT_OUTPUT_INFO       =
       job_output_info            = gs_job_info
*       JOB_OUTPUT_OPTIONS         =
*    TABLES

     EXCEPTIONS
       formatting_error           = 1
       internal_error             = 2
       send_error                 = 3
       user_canceled              = 4
       OTHERS                     = 5
              .

Where ZSMARTFORM is the name of your smartform

I hope it helps

Regards

Read only

0 Likes
2,395

ya but how do i redirect it to a different screen when i press the back button in smartform ?

Read only

0 Likes
2,395

you could use SET screen or CALL screen after the smartform call.

best regards,

swanand

Read only

Former Member
0 Likes
2,395

you could use SET screen or CALL screen after the smartform call.

best regards,

swanand

Read only

0 Likes
2,395

It should get redirected to a different screen only when i press the back button not always..

Read only

0 Likes
2,395

check sy-ucomm when u press back from smartform and do the coding for the screen call.

Read only

0 Likes
2,395

Do you mean i should check sy-ucomm in the program for the back which is in smartform  ??

Read only

0 Likes
2,395

you should check what sy-ucomm returns when you press back of smartform and in your program code accordingly.

Read only

0 Likes
2,395

ok thank you Swanand Lakka....