Gui status (AT USER-COMMAND) trigger at first

Hello all,
I wrote a basic list  shown below.
In it , AT USER-COMMAND and AT LINE-SELECTION events are used all.
when i double click on line in the list, I think the at line-selection should be trigger at first. but  in fact ,the AT USER-COMMAND trigger.
and the sy-ucomm get the first button value in the GUI-STATUS BAR(There's only one button on it).
how can i solve it .
any answers should be appreciated.
START-OF-SELECTION.
  SET PF-STATUS 'ZSATMM24F1'.
  write :  \ 'aaaaaaaaaaaa'
  write :  \ 'aaaaaaaaaaaa'
  write :  \ 'aaaaaaaaaaaa'
  write :  \ 'aaaaaaaaaaaa'
AT USER-COMMAND.
  CASE sy-ucomm.
    WHEN 'TO_a'.
      PERFORM to_a.
  ENDCASE.
AT LINE-SELECTION.
  write : 'test'.
best regards,
daniel.

Please make sure to add the fcode PICK to the F2 function code in your gui status and try again.
Regards,
Rich Heilman

Similar Messages

  • Pf status and user-command

    hi
    can any one explain me about pf-status and user-command?  what is the difference between this two and how to display icons in it.
    max reward points for good answer
    thanks
    alka

    Hi alka ritu  ,
    Check the following websites for good documentation o n pf status and user-command
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba34635c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba99935c111d1829f0000e829fbfe/content.htm
    1. How to set pf-status
    set pf-status ‘ZZBILSTA’.
    2. How to set pf-status excluding/including single menu items
    You can exclude menus by using exclude :
    set pf-status ‘ZZBILSTA’ excluding ‘PST’.
    Note: Can also be used with include instead of exclude
    3. How to set pf-status excluding/including several menu items
    You have to use an internal table to store the status you wan’t to ex- or include:
    DATA:BEGIN OF I_PF_STATUS_TAB OCCURS 10,
    FCODE,
    END OF I_PF_STATUS_TAB.
    FORM SET_PF_STATUS_POSTER.
    REFRESH I_PF_STATUS_TAB. MOVE ‘PST’ TO I_PF_STATUS_TAB. APPEND I_PF_STATUS_TAB. MOVE ‘ART’ TO I_PF_STATUS_TAB. APPEND I_PF_STATUS_TAB. SET PF-STATUS ‘ZZBILSTA’ EXCLUDING I_PF_STATUS_TAB.
    ENDFORM.
    4. Setting PF status to the (SAP) system default
    set pf-status ‘BASIC’.
    5. How to check for pf-status
    AT USER-COMMAND.
    CASE SY-UCOMM. WHEN ‘ART’. PERFORM STYR_ARTSKONTI. WHEN ‘PST’. PERFORM STYR_POSTER. WHEN ‘BIL’. PERFORM VIS_BILAG. ENDCASE.
    6. Use of SY-PFKEY
    You can use the system variable sy-pfkey to retrieve the name of the current pf status
    USER-COMMAND:
    If the user chooses a function code during list processing that is neither processed by the system, or PICK or PFnn, the system triggers the event AT USER-COMMAND. For this event, you must define your own GUI status for a list. To react to your own function codes in a program, you must define the following event block:
    AT USER-COMMAND.
      statements.
    In this event block, you can use an IF or CASE structure to differentiate between the function codes. They are available in the system field sy-ucomm. There are further system fields that are filled in list events, such as sy-lsind and sy-pfkey, that allow you to make further case distinctions.
    Triggering a List Event from the Program
    You can trigger a list event from the program as follows:
    SET USER-COMMAND fc.
    This statement takes effect after the current list is completed. Before the list is displayed, the event assigned to function code fc is triggered, regardless of the dialog status you are using.
    The effect is the same as when the user chooses the function. In other words, predefined list function codes are trapped and processed by the runtime environment, the function codes PICK and PFnn trigger the AT LINE-SELECTION and AT PFnnevents, and user-defined function codes trigger the AT USER-COMMAND event block.
    Function code PICK triggers an event only if the cursor is located on a list line.
    Using this statement in conjunction with the function codes reserved for system functions, you can call the system functions from the program. For example, you can use SET USER-COMMAND '%SC' to call the Find dialog box directly, or to position the list correctly before it is displayed.
    If you use several SET USER-COMMAND statements while creating a list, the system executes only the last one.
    Example of AT USER-COMMAND.
    REPORT demo_list_at_user_command NO STANDARD PAGE HEADING.
    START-OF-SELECTION.
      WRITE: 'Basic List',
           / 'sy-lsind:', sy-lsind.
    TOP-OF-PAGE.
      WRITE 'Top-of-Page'.
      ULINE.
    TOP-OF-PAGE DURING LINE-SELECTION.
      CASE sy-pfkey.
        WHEN 'TEST'.
          WRITE 'Self-defined GUI for Function Codes'.
          ULINE.
      ENDCASE.
    AT LINE-SELECTION.
      SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
      PERFORM out.
      sy-lsind = sy-lsind - 1.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'FC1'.
          PERFORM out.
          WRITE / 'Button FUN 1 was pressed'.
        WHEN 'FC2'.
          PERFORM out.
          WRITE / 'Button FUN 2 was pressed'.
        WHEN 'FC3'.
          PERFORM out.
          WRITE / 'Button FUN 3 was pressed'.
        WHEN 'FC4'.
          PERFORM out.
          WRITE / 'Button FUN 4 was pressed'.
        WHEN 'FC5'.
          PERFORM out.
          WRITE / 'Button FUN 5 was pressed'.
      ENDCASE.
      sy-lsind = sy-lsind - 1.
    FORM out.
      WRITE: 'Secondary List',
           / 'sy-lsind:', sy-lsind,
           / 'sy-pfkey:', sy-pfkey.
    ENDFORM.
    Example of AT USER-COMMAND.
    REPORT demo_list_set_user_command NO STANDARD PAGE HEADING.
    START-OF-SELECTION.
      SET USER-COMMAND 'MYCO'.
      WRITE 'Basic List'.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'MYCO'.
          WRITE 'Secondary List from USER-COMMAND,'.
          WRITE: 'sy-lsind', sy-lsind.
          SET USER-COMMAND 'PF05'.
      ENDCASE.
    AT pf05.
      WRITE 'Secondary List from PF05,'.
      WRITE: 'sy-lsind', sy-lsind.
      SET CURSOR LINE 1.
      SET USER-COMMAND 'PICK'.
    AT LINE-SELECTION.
      WRITE 'Secondary List from LINE-SELECTION,'.
      WRITE: 'sy-lsind', sy-lsind.
      SET USER-COMMAND '%SC'.
    http://maxdb.sap.com/currentdoc/94/90ee41c334c717e10000000a155106/content.htm
    cheers!
    gyanaraj
    ****Pls reward points if u find this helpful

  • PF Status and User Command in CALL METHOD alv_grid_ob- set_table_for_first_

    Hi Can anyone please advice me how can we have PF Status in User Command in Object Oriented ALV Grid Display.
    * display alv grid
      CALL METHOD alv_grid_ob->set_table_for_first_display
        EXPORTING
    *    IS_VARIANT                    =
    *    I_SAVE                        =
          i_default                     = 'X'
          is_layout                     = t_lay
    *    IT_TOOLBAR_EXCLUDING          =
        CHANGING
          it_outtab                     =
          it_fieldcatalog               = t_field_catalog
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

    Hi,
    you can directly handle that in PBO module of the screen....
    you can give a direct
    set PF-status statement in any of the module in PBO...
    and you can handle in PAI
    Regards,
    Siddarth

  • Set PF Status and At-Line Selection & At User-Command

    Hi All
    I've used set PF status, at user command and at-line selection in my program. initially when i click on the material number it was not drilling further that is it was not taking to secondary list. i commented the PF status and tried. then it was working fine. Later, after checking on couple of doc i added F.code PICK in my PF status and uncommented the set-PF status in my program it was working fine. Now my question is why this kind of behaviour. When i uncomment the PF status  and run the program without the f.code PICK in my PF status(se41)  it was not working but after inlcuding the F.code in my PF it is working. Any good explanation?
    thks   
    Prabhu

    hi,
    generally fuction code is useful for the system to find on which button or in which area the user has clicked in. based on the function code the system executes the satatements that are in user command.  in your case i think u didnt gave any functionality in user-command. when at-user command is a event in interactive reporting which is triggered based on the button u had clicked.
    at line-selection event uses two system variables
       1. sy-lsind [ current list index number ]
       2. sy-lisel  [ contains the current area in which user ckicked ].
       3. sy-ucomm [ function code of clicked button ].
    using these 3 vars we can drill down to 21 lists [ including 1st list ]
    if helpful reward some points.
    with regards,
    suresh.

  • Regarding user command

    hi,
    how to write the user command on alv report and the output should ne upload into va02,
    My requirement is i have developed a alv report,in that the requiremnt is one pushbutton they want,when they clicked it the output should be upload into va02 transaction.
    Thanks and Regards,

    Hi Ali,
    For user command in alv,
    First set the PF Status of that ALV,
    and in the FM Reuse_alv_grid_display pass the subroutine name fr user command,
    in its parameter  -->      i_callback_user_command           = 'COMM'
    Then to catch the function module you have to write like for eg,
    FORM comm USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
      DATA: okcode TYPE sy-ucomm.
      okcode = ucomm.
      CASE okcode.
        WHEN 'REF'.
        CALL FUNCTION 'POPUP_TO_INFORM'
          EXPORTING
            titel         = 'MANSI'
            txt1          = 'CREATED BY'
            txt2          = SY-UNAME
          TXT3          = ' '
          TXT4          = ' '
    That is on that buttons click you can use set parameter id statement to move your
    control from this screen to the required screen.
    Hope it helps you
    Regrds
    Mansi

  • User-command and pf-status

    Hi can anybody please give tell me what is the user-command and what is pf-status.
    please provide me a sample code how to create these step by step.
    and how to copy standard pf-status to user defined one.
    thanks in advance
    kp

    hi,
    The Standard List Status
    As with normal screens, you can define your own GUI status for lists and attach it to a list level using the SET PF-STATUS statement. If you do not set a particular GUI status, the system sets a default list status for the list screen in an executable program. In other programs, for example, when you call a list from screen processing, you must set this status explicitly using the statement
    SET PF-STATUS space.
    This default interface always contains at least the functions described in the Standard List section.
    Unlike normal dialog statuses, the default list status is affected by the ABAP program.
    If you define event blocks in your program using the event keywords AT LINE-SELECTION or AT PF]
    This statement sets the status  parameters. To display an ampersand character ‘&’, repeat it in the title ‘&&’.
    Examples
    Example for dialog status in a list.
    REPORT demo_list_menu_painter.
    START-OF-SELECTION.
      SET PF-STATUS 'TEST'.
      WRITE:  'Basic list, SY-LSIND =', sy-lsind.
    AT LINE-SELECTION.
      WRITE:  'LINE-SELECTION, SY-LSIND =', sy-lsind.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'TEST'.
          WRITE:  'TEST, SY-LSIND =', sy-lsind.
      ENDCASE.
    This program uses a status TEST, defined in the Menu Painter.
    Function key F5 has the function code TEST and the text Test for demo.
    Function code TEST is entered in the List menu.
    The function codes PICK and TEST are assigned to pushbuttons.
    The user can trigger the AT USER-COMMAND event either by pressing F5 , or by choosing List ® Test for demo, or by choosing the pushbutton Test for demo.The user can trigger the AT LINE-SELECTION event by selecting a line.
    Example of setting a dialog status for the current list
    REPORT demo_list_set_pf_status_1.
    DATA: fcode TYPE TABLE OF sy-ucomm,
          wa_fcode TYPE sy-ucomm.
    START-OF-SELECTION.
      wa_fcode = 'FC1 '. APPEND wa_fcode TO fcode.
      wa_fcode = 'FC2 '. APPEND wa_fcode TO fcode.
      wa_fcode = 'FC3 '. APPEND wa_fcode TO fcode.
      wa_fcode = 'FC4 '. APPEND wa_fcode TO fcode.
      wa_fcode = 'FC5 '. APPEND wa_fcode TO fcode.
      wa_fcode = 'PICK'. APPEND wa_fcode TO fcode.
      SET PF-STATUS 'TEST'.
      WRITE: 'PF-Status:', sy-pfkey.
    AT LINE-SELECTION.
      IF sy-lsind = 20.
        SET PF-STATUS 'TEST' EXCLUDING fcode.
      ENDIF.
      WRITE: 'Line-Selection, SY-LSIND:', sy-lsind,
           / '                SY-PFKEY:', sy-pfkey.
    AT USER-COMMAND.
      IF sy-lsind = 20.
          SET PF-STATUS 'TEST' EXCLUDING fcode.
        ENDIF.
        WRITE: 'User-Command, SY-LSIND:', sy-lsind,
             / '              SY-UCOMM:', sy-ucomm,
             / '              SY-PFKEY:', sy-pfkey.
    Suppose that the function codes FC1 to FC5 are defined in the status TEST and assigned to pushbuttons: The function code PICK is assigned to function key F2 .
    When the program starts, the user can create detail lists by selecting a line or choosing one of the function codes FC1 to FC5. For all secondary lists up to level 20, the user interface TEST is the same as for the basic list:
    On list level 20, EXCLUDING ITAB deactivates all function codes that create detail lists. This prevents the user from causing a program termination by trying to create detail list number 21.
    Example of setting a dialog status for the current list
    REPORT demo_list_set_pf_status_2.
    START-OF-SELECTION.
      WRITE: 'SY-LSIND:', sy-lsind.
    AT LINE-SELECTION.
      SET PF-STATUS 'TEST' IMMEDIATELY.
    After executing the program, the output screen shows the basic list and the user interface predefined for line selection (with function code PICK).
    When you choose Choose, the user interface changes. However, since the AT LINE-SELECTION processing block does not contain an output statement, the system does not create a detail list: The status TEST is defined as in the previous example.
    Example: Titles of detail lists.
    REPORT demo_list_title .
    START-OF-SELECTION.
      WRITE 'Click me!' HOTSPOT COLOR 5 INVERSE ON.
    AT LINE-SELECTION.
      SET TITLEBAR 'TIT' WITH sy-lsind.
      WRITE 'Click again!' HOTSPOT COLOR 5 INVERSE ON.
    Regards,
    Sreevani.

  • Pf status & user-command in alv grid

    Hi Friends,
    I have one query for ALV grid.
    Actually my requirement is like that
    Whenever the user double click on grid the control moves to transaction 'VA01' tcode.
    I also wanted to set the gui status in ALV grid.
    How to do it??
    Plz tell me in detail.

    Very simple....
    copy paste this code.... remember I have created a GUI Status called ZALV_STATUS.
    So u will have to create this status to run ur program.
    U can come back if u have any doubts...
    *& Report  Z_ALV_TRAINING_LIST_HOTSPOT
    REPORT  Z_ALV_TRAINING_LIST_HOTSPOT.
    Type Pools Used  **********
    TYPE-POOLS : SLIS.
    Internal Tables Declare  ************
    DATA : it_document   type standard table of bkpf initial size 0 with header line,
           IT_FIELD_CAT  TYPE SLIS_T_FIELDCAT_ALV,
           it_alv_event  type SLIS_T_EVENT,
           fl_layout     type slis_layout_alv.
    Select Data  ***********
    start-of-selection.
    select * from bkpf into table it_document.
    Make Field Catalog  ******
    PERFORM MAKE_FIELD_CATALOG.
    Make Layout  *********
    perform sub_fill_layout.
    Make Events Table  *******
    perform sub_Fill_alv_event.
    Display ALV  *********
    PERFORM DISPLAY_ALV_LIST.
    *&      Form  make_field_catalog
          text
    -->  p1        text
    <--  p2        text
    FORM MAKE_FIELD_CATALOG .
    data : wa type slis_fieldcat_alv.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
      EXPORTING
      I_PROGRAM_NAME               =
      I_INTERNAL_TABNAME           =
       I_STRUCTURE_NAME             = 'bkpf'
      I_CLIENT_NEVER_DISPLAY       = 'X'
      I_INCLNAME                   =
      I_BYPASSING_BUFFER           =
      I_BUFFER_ACTIVE              =
      CHANGING
        CT_FIELDCAT                  = it_field_cat
    EXCEPTIONS
      INCONSISTENT_INTERFACE       = 1
      PROGRAM_ERROR                = 2
      OTHERS                       = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    read table it_field_cat into wa index 3.
    wa-hotspot = 'X'.
    modify it_field_cat index 3 from wa.
    ENDFORM.                    " make_field_catalog
    *&      Form  display_alv_list
          text
    -->  p1        text
    <--  p2        text
    FORM DISPLAY_ALV_LIST .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM             = sy-repid
       I_CALLBACK_PF_STATUS_SET       = 'SET_MY_PF_STATUS'
      I_CALLBACK_USER_COMMAND        = ' '
       IS_LAYOUT                      = fl_layout
       IT_FIELDCAT                    = it_field_cat[]
      IT_SORT                        =
      I_DEFAULT                      = 'X'
       I_SAVE                         = 'X'
      IS_VARIANT                     = '/TEST_VV'
        IT_EVENTS                      = it_alv_event
      TABLES
        T_OUTTAB                       = it_document.
    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_list
    *&      Form  sub_my_pf_event
          text
    -->  p1        text
    <--  p2        text
    FORM sub_my_pf_event using p_comm type sy-ucomm p_sEL_FIELD TYPE SLIS_SELFIELD.
      read table it_document index p_sel_field-tabindex.
      set parameter id 'BLN' field it_document-belnr.
      set parameter id 'BUK' field it_document-bukrs.
      set parameter id 'GJR' field it_document-gjahr.
      case p_comm.
        when 'PICK'.
          call transaction 'FB03' and skip first screen.
      endcase.
    ENDFORM.                    " sub_my_pf_event
    *&      Form  sub_Fill_alv_event
          text
    -->  p1        text
    <--  p2        text
    FORM sub_Fill_alv_event .
      data : wa type slis_alv_event.
      wa-name = 'USER_COMMAND'.
      wa-form = 'SUB_MY_PF_EVENT'.
      append wa to it_alv_event.
    ENDFORM.                    " sub_Fill_alv_event
    *&      Form  sub_fill_layout
          text
    -->  p1        text
    <--  p2        text
    FORM sub_fill_layout .
      fl_layout-f2code = 'PICK'.
      fl_layout-box_fieldname = 'BELNR'.
    ENDFORM.                    " sub_fill_layout
    *&      Form  SET_MY_PF_STATUS
          text
    -->  p1        text
    <--  p2        text
    FORM SET_MY_PF_STATUS USING    p_rt_extab TYPE slis_t_extab.
    SET PF-STATUS 'ZALV_STATUS'.
    ENDFORM.                    " SET_MY_PF_STATUS
    Plz award points if it was helpful....
    Message was edited by:
            Varun Verma

  • Wht's the Diff bet AT-USER command and AT-PF STATUS

    Can Anybody explain me the diffarence between At user command and At-pf status.
    Thanks,
    Srik

    Hi Srikanth,
    AT USER-COMMAND - Event in interactive reporting
    This event is executed whenever the user presses a function key in the list or makes an entry in the command field .
    Some functions are executed directly by the system and thus cannot be processed by programs. These include:
    PICK See variant AT LINE-SELECTION PFn See variant AT PFn /... System command %... System command PRI Print BACK Back RW Cancel P... Scroll function (e.g.: P+ , P- , PP+3 , PS-- etc.)
    Instead of this functions, you can use the SCROLL statement in programs.
    Since many of these system functions begin with "P", you should avoid using this letter to start your own function codes.
    Otherwise, the effect is as for AT LINE-SELECTION ; also, the current function code is stored in the system field SY-UCOMM .
    Example
    DATA: NUMBER1 TYPE I VALUE 20,
          NUMBER2 TYPE I VALUE  5,
          RESULT  TYPE I.
    START-OF-SELECTION.
      WRITE: / NUMBER1, '?', NUMBER2.
    AT USER-COMMAND.
      CASE SY-UCOMM.
        WHEN 'ADD'.
          RESULT = NUMBER1 + NUMBER2.
        WHEN 'SUBT'.
          RESULT = NUMBER1 - NUMBER2.
        WHEN 'MULT'.
          RESULT = NUMBER1 * NUMBER2.
        WHEN 'DIVI'.
          RESULT = NUMBER1 / NUMBER2.
        WHEN OTHERS.
          WRITE 'Unknown function code'.
          EXIT.
      ENDCASE.
      WRITE: / 'Result:', RESULT.
    After entry of a function code, the appropriate processing is performed under the event AT USER-COMMAND and the result is displayed in the details list.
    AT PFn - Event in interactive reporting
    Here, n stands for a numeric value between 0 and 99.
    This event is executed whenever the user presses a function key that contains the function code PFn in the interface definition. The default status for lists contains some of these functions.
    Otherwise, the effect is as for the variant AT LINE-SELECTION . The cursor can be on any line.
    To ensure that the chosen function is executed only for valid lines, you can check the current HIDE information. This variant should be used only for test or prototyping purposes, since the default status is not normally used. Instead, you should set a program-specific status with SET PF-STATUS . This should not contain any function codes beginning with " PF ".
    Example
    DATA NUMBER LIKE SY-INDEX.
    START-OF-SELECTION.
      DO 9 TIMES.
        WRITE: / 'Row', (2) SY-INDEX.
        NUMBER = SY-INDEX.
        HIDE NUMBER.
      ENDDO.
    AT PF8.
      CHECK NOT NUMBER IS INITIAL.
      WRITE: / 'Cursor was in row', (2) NUMBER.
      CLEAR NUMBER.

  • How to use both At USER-COMMAND and AT LINE-SELECTION in one abap program

    I am trying out a program where I need to use both line selection and user command events in one program. Suggest me how to do it.

    USE the okcode 'PICK'. (I mean add a 'PICK' in the GUI staus or the menu.) When ever u use both the events u have to use PICK to trigger the at line selection.
    U just need to add the PICK in the GUI status and ofcourse write code in the program.
    AT LINE-SELECTION.
    CASE sy-ucomm.
    WHEN 'PICK'.
    write:/ 'HELLO WORLD'.
    ENDCASE.

  • AT USER COMMAND is not getting triggerd

    Hi Techie's
    I have two fields on the selection screen
    1) Name:   ___________
    2) Id:         ___________
    I have some buttons say on the Application toolbar say::
    Save            Delete            Modify           Exit
    I have created these buttons in the INITIALIZATION event.
    I am using AT Selection Screen OUTPUT for some logic purpose.
    Later I am writing AT USER COMMAND and pressing  SAVE The function code for SAVE is "SAV".
    But the drama is that AT USER COMMAND is not getting triggered at all.
    It goes first to Initialization--->At selection Screen OUTPUT>Then screen appears> I give the values and press the SAVE button--
    again it goes to the At Selection screen OUTPUT.
    Not even getting the hang of it. Please help if anybody know the story of it.
    ITS SO URGENT.

    At user command is for list processing, you need something like this:
    Pushbuttons in the Application Toolbar
    In the application toolbar of the standard GUI status of the selection screen, five pushbuttons are predefined with the function codes FC01 to FC05, but are inactive by default. You can activate them during the definition of the selection screen as follows:
    SELECTION-SCREEN FUNCTION KEY i.
    The numbering i must be between 1 and 5. The individual function texts must be assigned to the functxt_0i components of structure sscrfields before the selection screen is called. You must declare this structure as an interface work area using the TABLES statement.
    If the user chooses one of these buttons, the runtime environment triggers the AT SELECTION-SCREEN event and the function code FC0i is placed into the component ucomm of the structure sscrfields.
    After the AT SELECTION-SCREEN event has been processed, the system displays the selection screen again. The only way to exit the selection screen and carry on processing the program is to choose Execute (F8). Consequently, the pushbuttons on the application toolbar are more suitable for controlling dynamic modifications of the selection screen than for controlling the program flow.
    REPORT demo_sel_screen_function_key.
    TABLES sscrfields.
    PARAMETERS: p_carrid TYPE s_carr_id,
                p_cityfr TYPE s_from_cit.
    SELECTION-SCREEN: FUNCTION KEY 1,
                      FUNCTION KEY 2.
    INITIALIZATION.
      sscrfields-functxt_01 = 'LH'.
      sscrfields-functxt_02 = 'UA'.
    AT SELECTION-SCREEN.
      CASE sscrfields-ucomm.
          WHEN'FC01'.
          p_carrid = 'LH'.
          p_cityfr = 'Frankfurt'.
        WHEN 'FC02'.
          p_carrid = 'UA'.
          p_cityfr = 'Chicago'.
      ENDCASE.
    START-OF-SELECTION.
      WRITE / 'START-OF-SELECTION'.
    This defines a standard selection screen with two parameters. In the application toolbar, two pushbuttons are assigned the texts LH and UA and activated.
    When the user clicks one of the buttons, the AT SELECTION-SCREEN event is triggered and there the input fields are preassigned correspondingly.

  • At line-selection & at user-command event issue

    hi
    i am working on a interactive report,with at line & at user command event,on list 3 i have used a pf status,to trigger the at user command event,till that i was working with at line selection,which are working fine,but on list 3,i am able to see my pf status,but at user command event is not working properly,its still working like at line selection event,if i clk on record,it take to for nxt action,which i want to do through the action button of pf status.
    In debugging i checked that it coming to at user command,but the action in sy-user is 'PICK' & its doing the operation.
    WHEN '3'.
          IF itab4[] IS NOT INITIAL.
            SET PF-STATUS 'Z203'.
            LOOP AT itab4.
              AT FIRST.
                WRITE:/1 'Material' ,18 'Name'.
              ENDAT.
              WRITE:/1 itab4-matnr,8 itab4-maktx.
              HIDE:itab4-matnr.
            ENDLOOP.
          ELSE.
            WRITE:/ 'No Data Found'.
          ENDIF.
      ENDCASE.
      BREAK-POINT.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'CALL'.
          PERFORM bdc_mm02.
      ENDCASE.
    pls tel me how to use at line selection & at user command in same report to make both events working efficiently.
    regds
    vipin

    Check whether you have assigned Function Key F2 to your function code 'CALL'. If so change that function key. The function key F2 is always linked to function code 'PICK'.
    Regards
    Sathar

  • At line-selection & At user-command

    Hi friends,
    I have a small doubt. Can we user AT LINE-SELECTION & AT USER-COMMAND in one report..plz gimme an example.
    Thanks is advance,
    regards,
    Ram

    hi, try these with example i have given.
    Write the set pf-status under start-of-selection,
    In the set pf-status under the function keys give
    F2 Pick Choose.
    u can validate the at line-selection by taking..
    At line-selection.
    case sy-lsind.
    when 1.
    message....
    when 2.
    message....
    endcase.
    similarly, for At user-command.
    case sy-ucomm.
    when 'back'.
    message...
    when...
    endcase.
    Syntax
    AT USER-COMMAND.
    Effect
    This statement defines an event block whose event is triggered by the ABAP runtime environment if, during the display of a screen list, a function with a self-defined function code was chosen.
    Note
    Self-defined function codes are all those that include character combinations, except for the following:
    The function codes PICK and PF## ("##" stands for 01 to 24) do not cause the event AT USER-COMMAND, but the events AT LINE-SELECTION and AT PF##.
    All function codes that start with the character "%" are interpreted as system functions and do not cause the event AT USER-COMMAND. The system functions for lists are listed in the following table 1.
    The function codes in the following table 2, likewise, do not cause the event AT USER-COMMAND, but are handled by the list processor.
    Table 1
    Function code Function
    %CTX Call a context menu
    %EX Exit
    %PC Save to file
    %PRI Print
    %SC Search for ...
    %SC+ Find next
    %SL Search in office
    %ST Save to report tree
    Table 2
    Function code Function
    BACK Back
    P- Scroll to previous page
    P-- Scroll to first page
    P+ Scroll to next page
    P++ Scroll to last page
    PFILE name Store list lines in a text file named abap.lst in standard character representation in the standard directory of the application server. If a name is entered using name, this is converted to lowercase letters and used as the file name.
    PL- Scroll to first line of the page
    PL-n Scroll n lines back
    PL+ Scroll to last line of the page
    PL+n Scroll n lines up
    PNOP No effect
    PP- Scroll back one page
    PP-n Scroll n pages back
    PP+ Scroll one page forward
    PP+n Scroll n pages forwad
    PPn Scroll to beginning of page n
    PRI, PRINT Print
    PS-- Scroll to first column
    PS++ Scroll to last column
    PS- Scroll one column to the left
    PS-n Scroll n columns to the left
    PS+ Scroll one column to the right
    PS+n Scroll n columns to the right
    PSn Scroll to column n
    PZn Scroll to line n
    RW Cancel
    here is an example handling both the commands in a program.
    EXAMPLE:
    START-OF-SELECTION.
    WRITE: 'Basic List',
    / 'SY-LSIND:', sy-lsind.
    TOP-OF-PAGE.
    WRITE 'Top-of-Page'.
    ULINE.
    TOP-OF-PAGE DURING LINE-SELECTION.
    CASE sy-pfkey.
    WHEN 'TEST'.
    WRITE 'Self-defined GUI for Function Codes'.
    ULINE.
    ENDCASE.
    AT LINE-SELECTION.
    SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
    PERFORM out.
    sy-lsind = sy-lsind - 1.
    AT USER-COMMAND.
    CASE sy-ucomm.
    WHEN 'FC1'.
    PERFORM out.
    WRITE / 'Button FUN 1 was pressed'.
    WHEN 'FC2'.
    PERFORM out.
    WRITE / 'Button FUN 2 was pressed'.
    WHEN 'FC3'.
    PERFORM out.
    WRITE / 'Button FUN 3 was pressed'.
    WHEN 'FC4'.
    PERFORM out.
    WRITE / 'Button FUN 4 was pressed'.
    WHEN 'FC5'.
    PERFORM out.
    WRITE / 'Button FUN 5 was pressed'.
    ENDCASE.
    sy-lsind = sy-lsind - 1.
    FORM out.
    WRITE: 'Secondary List',
    / 'SY-LSIND:', sy-lsind,
    / 'SY-PFKEY:', sy-pfkey.
    ENDFORM.
    Hope this may be helpful.
    Sri.
    pls:award points.

  • At line-selection and At-user command

    Hi friends,
    Can we use both those events at a time in report?
    If so can any body provide me sample code?
    Regards

    <b>Example for AT LINE-SELECTION</b>
    REPORT demo_list_at_line_selection.
    START-OF-SELECTION.
      WRITE  'Basic List'.
    AT LINE-SELECTION.
      WRITE: 'Secondary List by Line-Selection',
           / 'SY-UCOMM =', sy-ucomm.
    When you run the program, the basic list appears with the standard list status. The detail list shows that SY-UCOMM has the value PICK.
    <b>Example for AT USER-COMMAND</b>
    REPORT demo_list_at_user_command NO STANDARD PAGE HEADING.
    START-OF-SELECTION.
      WRITE: 'Basic List',
           / 'SY-LSIND:', sy-lsind.
    TOP-OF-PAGE.
      WRITE 'Top-of-Page'.
      ULINE.
    TOP-OF-PAGE DURING LINE-SELECTION.
      CASE sy-pfkey.
        WHEN 'TEST'.
          WRITE 'Self-defined GUI for Function Codes'.
          ULINE.
      ENDCASE.
    AT LINE-SELECTION.
      SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
      PERFORM out.
      sy-lsind = sy-lsind - 1.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'FC1'.
          PERFORM out.
          WRITE / 'Button FUN 1 was pressed'.
        WHEN 'FC2'.
          PERFORM out.
          WRITE / 'Button FUN 2 was pressed'.
        WHEN 'FC3'.
          PERFORM out.
          WRITE / 'Button FUN 3 was pressed'.
        WHEN 'FC4'.
          PERFORM out.
          WRITE / 'Button FUN 4 was pressed'.
        WHEN 'FC5'.
          PERFORM out.
          WRITE / 'Button FUN 5 was pressed'.
      ENDCASE.
      sy-lsind = sy-lsind - 1.
    FORM out.
      WRITE: 'Secondary List',
           / 'SY-LSIND:', sy-lsind,
           / 'SY-PFKEY:', sy-pfkey.
    ENDFORM.
    When you run the program, the system displays the following basic list with a the page header defined in the program:
    You can trigger the AT LINE-SELECTION event by double-clicking a line. The system sets the status TEST and deactivates the function code PICK. The status TEST contains function codes FC1 to FC5. These are assigned to pushbuttons in the application toolbar. The page header of the detail list depends on the status.
    Here, double-clicking a line no longer triggers an event. However, there is now an application toolbar containing five user-defined pushbuttons. You can use these to trigger the AT USER-COMMAND event. The CASE statement contains a different reaction for each pushbutton.
    For each interactive event, the system decreases the SY-LSIND system field by one, thus canceling out the automatic increase. All detail lists now have the same level as the basic list and thus overwrite it. While the detail list is being created, SY-LSIND still has the value 1.
    I hope it helps.
    For more details have a look at below link.
    http://help.sap.com/saphelp_di471/helpdata/EN/9f/dba3ae35c111d1829f0000e829fbfe/content.htm
    Best Regards,
    Vibha
    *Please mark all the helpful answers

  • How to use AT LINE-SELECTION and AT USER-COMMAND in one report????

    Dear all,
    I have a problem in reports I want to use AT USER-COMMAND.and AT LINE-SELECTION.both in the one report.
    But as soon as I use SET PF-STATUS my AT LINE-SELECTION event stop workingand only AT USER-COMMAND is working.
    How can I use both of them in one report for your reference I am giving my test program below.
    REPORT ZTEST111 .
    SET PF-STATUS '100'.
    DO 10 TIMES.
    WRITE:/ SY-INDEX.
    HIDE SY-INDEX.
    ENDDO.
    START-OF-SELECTION.
    AT LINE-SELECTION.
    MESSAGE I002(SY) WITH SY-INDEX.
    AT USER-COMMAND.
    MESSAGE I002(SY) WITH 'USER COMMAND'.
    END-OF-SELECTION.
    Thanks in advance
    Sachin Gautam

    hi
    Syntax
    AT USER-COMMAND.
    Effect
    This statement defines an event block whose event is triggered by the ABAP runtime environment if, during the display of a screen list, a function with a self-defined function code was chosen.
    Note
    Self-defined function codes are all those that include character combinations, except for the following:
    The function codes PICK and PF## ("##" stands for 01 to 24) do not cause the event AT USER-COMMAND, but the events AT LINE-SELECTION and AT PF##.
    All function codes that start with the character "%" are interpreted as system functions and do not cause the event AT USER-COMMAND. The system functions for lists are listed in the following table 1.
    The function codes in the following table 2, likewise, do not cause the event AT USER-COMMAND, but are handled by the list processor.
    Table 1
    Function code Function
    %CTX Call a context menu
    %EX Exit
    %PC Save to file
    %PRI Print
    %SC Search for ...
    %SC+ Find next
    %SL Search in office
    %ST Save to report tree
    Table 2
    Function code Function
    BACK Back
    P- Scroll to previous page
    P-- Scroll to first page
    P+ Scroll to next page
    P++ Scroll to last page
    PFILE name Store list lines in a text file named abap.lst in standard character representation in the standard directory of the application server. If a name is entered using name, this is converted to lowercase letters and used as the file name.
    PL- Scroll to first line of the page
    PL-n Scroll n lines back
    PL+ Scroll to last line of the page
    PL+n Scroll n lines up
    PNOP No effect
    PP- Scroll back one page
    PP-n Scroll n pages back
    PP+ Scroll one page forward
    PP+n Scroll n pages forwad
    PPn Scroll to beginning of page n
    PRI, PRINT Print
    PS-- Scroll to first column
    PS++ Scroll to last column
    PS- Scroll one column to the left
    PS-n Scroll n columns to the left
    PS+ Scroll one column to the right
    PS+n Scroll n columns to the right
    PSn Scroll to column n
    PZn Scroll to line n
    RW Cancel

  • Problem in GUI status

    hi folks ,
    i have created the GUI status for the program .. when i go on the out put screen i am not able to go back or cancel or exit , though i have created the GUI status and activated it as well .
    my program is designed to display the user action on screen and it displays the value in the text field which can only accept output no inputs .
    plz advice .
    Thanks,
    Abhishek .

    Hello,
    Make sure that the function codes in the GUI status are written in capital letters only.Similarly in the PAI of the screen,in the case statement,the function codes have to be written in capital letters.I hope you have written the user-commands as the functionality has to be coded by the developer when he makes the GUI.
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
    case ok_code.
    when 'BACK'.
    leave to screen 100.
    when 'EXIT'.
    leave to screen 0.
    when 'SAVE'.
    ....logic
    ENDCASE.
    endmodule.
    Regards,
    Beejal
    **Reward if this helps

Maybe you are looking for