Skip to Content
author's profile photo
Former Member

how to FORM "user command" in ALV without using PERFORM.

kindly let me know the steps for user command not the ALV full program.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • author's profile photo
    Former Member
    Posted on Aug 20, 2007 at 10:31 AM

    Hi,

    It should be coded in the normal way only,

    If Sy-UCOMM = BACK.

    Leaeve to screen 0.

    ELSEIf Sy-UCOMM = CANCEL.

    .....

    ENDIF.

    <b>Reward if helpful.</b>

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 20, 2007 at 10:51 AM

    Hi Divya,

    i) Create a new PF status with the application tool bar containing the required button(icon) and the user command(ok code associated with it).Use T-code SE41 (menu painter)

    ii) Declare new form (for eg: form user_command_1) in the program and handle the events in this form .

    for eg:

    -


    form pf_status_1.

    set pf-status 'PF_STATUS_1'.

    endform.

    form user_command_1.

    case sy-ucomm.

    when 'SAVE'.

    "Save button functionality goes here

    when 'BACK'.

    " Back button functionality goes here

    endcase.

    endform.

    iii) Refer the required 'PF status' and 'User command' to be used using the ALV FM 'REUSE_ALV_LIST_DISPLAY'.

    for eg:

    -


    CALL FUNCTION 'REUSE_ALV_LIST_DISLPAY'

    EXPORTING

    -


    -


    I_CALLBACK_PF_STATUS = 'PF_STATUS_1' " form name, should be in uppercase

    I_CALLBACK_USER_COMMAND = 'USER_COMMAND_1' "Form name, should be in uppercase

    Like this you can handle any no of user commands in the ALV output.

    Regards,

    Dilli

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      When creating PF Status for ALV report, you are best to copy it from PF Status Standard of program SAPLSALV - this way you still have all the standard functionality the ALV supplies.

      When you declare the forms to process the PF Status and User Command, the format must match that required by the ALV:

      FORM pf_status_1 USING rt_extab TYPE slis_t_extab.

      FORM user_command_1 using LV_UCOMM like SY-UCOMM
                                                 LV_FIELD    type SLIS_SELFIELD.

      In the User command you check the input field LV_UCOMM instead of SY-UCOMM to see what button the user selected.

      Andrew

  • author's profile photo
    Former Member
    Posted on Aug 20, 2007 at 11:44 AM

    Hi,

    check this code :

    CASE SY-UCOMM.

    WHEN 'BACK' OR 'LEAV' OR 'CANC' .

    LEAVE PROGRAM.

    ENDCASE.

    where BACK , LEAV , CANC are the names I have given in the pf status for the screen to the specific buttons in the Application tool bar.

    Add comment
    10|10000 characters needed characters exceeded