At line-selection and user command

hi,
is it possible to use both at line selecion and at user command at a time.

Hi Kiran,
  Yes, it is possible to use both at line selecion and at
  user command at a time.
AT LINE-SELECTION.
Event in interactive reporting
This event is processed whenever the user chooses a valid line in the list (i.e. a line generated by statements such as WRITE,ULINE, or SKIP) with the cursor and presses the function key which has the function PICK in the interface definition. This should normally be the function key F2, because it has the same effect as double-clicking the mouse, or clicking once in the case of a hotspot.
The processing for the event AT LINE-SELECTION usually generates further list output (the details list) which completely covers the current list display. If you want the current list display to remain visible (to aid user orientation), you can do this with the key word WINDOW.
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.
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.
Reward points if helpful,
Rgds,
Sumana

Similar Messages

  • 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 & 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

  • Need clarification on AT LINE SELECTION & AT USER COMMAND

    Hi all,
    can we use AT LINE SELECTION and AT USER COMMAND events in the same report? If yes what r the precautions that we have to take?
    Thanks in advance
    venkat

    Hi Venkat,
    I had written this code while I was learning Menu Painter. It will help help you.
    *& Report  YTEST_MENUPAINTER                                           *
    REPORT  ztest.
    *Consider  a scenario when the user asks for Material Details(Table : MARA )
    *displayed in one List and based on the Material selected he wants the corresponding
    *Storage Location Data for that Material (Table : MARD ).
    TABLES : mara.
    TYPES :  BEGIN OF tp_mara,
             matnr TYPE mara-matnr,
             mtart TYPE mara-mtart,
             mbrsh TYPE mara-mbrsh,
             matkl TYPE mara-matkl,
             END OF tp_mara.
    TYPES : BEGIN OF tp_marc,
            matnr TYPE marc-matnr,
            werks TYPE marc-werks,
            pstat TYPE marc-pstat,
            ekgrp TYPE marc-ekgrp,
            dispr TYPE marc-dispr,
            END OF tp_marc.
    TYPES : BEGIN OF tp_mard,
            matnr TYPE mard-matnr,
            werks TYPE mard-werks,
            lgort TYPE mard-lgort,
            lfgja TYPE mard-lfgja,
            labst TYPE mard-labst,
            umlme TYPE mard-umlme,
            END OF tp_mard.
    DATA : t_mara TYPE STANDARD TABLE OF tp_mara,
           t_marc TYPE STANDARD TABLE OF tp_marc,
           t_mard TYPE STANDARD TABLE OF tp_mard,
           wa_mara TYPE tp_mara,
           wa_marc TYPE tp_marc,
           wa_mard TYPE tp_mard.
    DATA : w_werks TYPE werks .
    DATA : itab TYPE TABLE OF sy-ucomm.
    START-OF-SELECTION.
    *Collecting the material details form Table MARA
      SELECT matnr
             mtart
             mbrsh
             matkl
             FROM mara
             INTO TABLE t_mara
             UP TO 200 ROWS.
    END-OF-SELECTION.
      SET PF-STATUS 'DETAIL'.
    *Now I am Dispalying the Material Details in the Primary List
      CLEAR wa_mara.
      LOOP AT t_mara INTO wa_mara.
        IF sy-tabix EQ 1.
          FORMAT INTENSIFIED ON.
          FORMAT COLOR COL_KEY.
          WRITE : /5(16)  'Material Number'.
          FORMAT COLOR COL_NORMAL.
          WRITE :          24(15) 'Material Type',
                   40(18) 'Industry Sector',
                   58(18) 'Material Group' .
        ENDIF.
        FORMAT INTENSIFIED OFF.
        FORMAT COLOR COL_KEY.
        WRITE : /5(16)   wa_mara-matnr.
        FORMAT COLOR COL_NORMAL.
        WRITE :  24(15)  wa_mara-mtart,
                 40(18)  wa_mara-mbrsh,
                 58(18)  wa_mara-matkl.
    *You can assume some sort of buffer is created in the memory  and the values of
    * wa_mara-matnr are put into it when you use the HIDE command
        HIDE wa_mara-matnr.
      ENDLOOP.
    *Now when user Double clicks a line (AT LINE-SELECTION event is trigerred) and
    *the line contents of the line selected and the contents buffered using
    *command  interact and the value for the hidden variable is got into the variable
    *refrenced using the HIDE command i.e..  wa_mara-matnr in our case
    AT LINE-SELECTION.
      IF sy-lsind = 1.
        FORMAT INTENSIFIED ON.
        WRITE:     'Plant Data for Material  '  COLOR COL_NORMAL,
                    35   wa_mara-matnr COLOR COL_TOTAL.
        REFRESH t_marc.
    * Now I have the value of the Material in my hidden variable wa_mara-matnr
    * Based on this I am selecting the Storage Location Data
        SELECT matnr
               werks
               pstat
               ekgrp
               dispr
               FROM marc
               INTO TABLE t_marc
               WHERE matnr = wa_mara-matnr.
        CLEAR wa_marc.
        FORMAT INTENSIFIED OFF.
        FORMAT COLOR COL_NORMAL.
        LOOP AT t_marc INTO wa_marc.
          IF sy-tabix EQ 1.
            FORMAT INTENSIFIED ON.
            FORMAT COLOR COL_NORMAL.
            WRITE :  /24(6)  'Plant',
                     30(22) 'Maintenance status',
                     52(20) 'Purchasing Group',
                     72(27)  'Material: MRP profile'.
          ENDIF.
          WRITE : /24(6)   wa_marc-werks,
                   30(22)  wa_marc-pstat,
                   52(20)  wa_marc-ekgrp,
                   72(27) wa_marc-dispr.
          CLEAR wa_marc.
        ENDLOOP.
        SKIP 5.
        FORMAT INTENSIFIED ON.
        WRITE:     'Storage Data for Material  '  COLOR COL_NORMAL,
                  35     wa_mara-matnr COLOR COL_TOTAL.
        REFRESH t_mard.
        SELECT matnr
               werks
               lgort
               lfgja
               labst
               umlme
               FROM mard
               INTO TABLE t_mard
               WHERE matnr = wa_mara-matnr.
        CLEAR wa_mard.
        FORMAT COLOR COL_NORMAL.
    * Display the Storage Location Data in the Secondary List
        LOOP AT t_mard INTO wa_mard.
          IF sy-tabix EQ 1.
            FORMAT INTENSIFIED ON.
            FORMAT COLOR COL_NORMAL.
            WRITE :  /24(6)  'Plant',
                     30(20) 'Storage Location',
                     50(12) 'Fiscal Year',
                     62(15) 'Valuated stock',
                     77(20)    'Stock in transfer'.
          ENDIF.
          WRITE : /24(6)  wa_mard-werks,
                   30(20) wa_mard-lgort,
                   50(12)  wa_mard-lfgja,
                   62(15) wa_mard-labst,
                   77(20) wa_mard-labst.
        ENDLOOP.
      ENDIF.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'PLANT'.
          REFRESH itab. CLEAR itab.
          APPEND 'PLANT' TO itab.
          APPEND 'STORAGE' TO itab.
          SET PF-STATUS 'DETAIL' EXCLUDING itab .
          FORMAT INTENSIFIED ON.
          WRITE:     'Plant Data for Material  '  COLOR COL_NORMAL,
                      35   wa_mara-matnr COLOR COL_TOTAL.
          REFRESH t_marc.
          SELECT matnr
                 werks
                 pstat
                 ekgrp
                 dispr
                 FROM marc
                 INTO TABLE t_marc
                 WHERE matnr = wa_mara-matnr.
          CLEAR wa_marc.
          FORMAT INTENSIFIED OFF.
          FORMAT COLOR COL_NORMAL.
          LOOP AT t_marc INTO wa_marc.
            IF sy-tabix EQ 1.
              FORMAT INTENSIFIED ON.
              FORMAT COLOR COL_NORMAL.
              WRITE : /24(6)  'Plant',
                       30(22) 'Maintenance status',
                       52(20) 'Purchasing Group',
                       72(27)  'Material: MRP profile'.
            ENDIF.
            WRITE : /24(6)   wa_marc-werks,
                     30(22)  wa_marc-pstat,
                     52(20)  wa_marc-ekgrp,
                     72(27) wa_marc-dispr.
            CLEAR wa_marc.
          ENDLOOP.
        WHEN 'STORAGE'.
          REFRESH itab. CLEAR itab.
          APPEND 'PLANT' TO itab.
          APPEND 'STORAGE' TO itab.
          SET PF-STATUS 'DETAIL' EXCLUDING itab .
          FORMAT INTENSIFIED ON.
          WRITE:     'Storage Data for Material  '  COLOR COL_NORMAL,
                    35     wa_mara-matnr COLOR COL_TOTAL.
          REFRESH t_mard.
          SELECT matnr
                 werks
                 lgort
                 lfgja
                 labst
                 umlme
                 FROM mard
                 INTO TABLE t_mard
                 WHERE matnr = wa_mara-matnr.
          CLEAR wa_mard.
          FORMAT COLOR COL_NORMAL.
          LOOP AT t_mard INTO wa_mard.
            IF sy-tabix EQ 1.
              FORMAT INTENSIFIED ON.
              FORMAT COLOR COL_NORMAL.
              WRITE : /24(6)  'Plant',
                       30(20) 'Storage Location',
                       50(12) 'Fiscal Year',
                       62(15) 'Valuated stock',
                       77(20)    'Stock in transfer'.
            ENDIF.
            WRITE : /24(6)  wa_mard-werks,
                     30(20) wa_mard-lgort,
                     50(12)  wa_mard-lfgja,
                     62(15) wa_mard-labst,
                     77(20) wa_mard-labst.
          ENDLOOP.
      ENDCASE.
    My SE41 settings are.
                                                                                    Application toolbar                 Test for Material Detail Display                                                                               
    Items  1 -  7            STORAGE    PLANT                                                                               
    STORAG     PLANT                                                                               
    Items  8 - 14                                                                               
    Items 15 - 21                                                                               
    Items 22 - 28                                                                               
    Items 29 - 35                                                                               
    Function keys                       Test for Material Detail Display                                                                               
    Standard Toolbar                                                                               
    SAVE       BACK       EXIT       CANCEL     PRINT      FIND       FIND NEXT                                                                               
    Recommended function key settings                                                                
    F2                             PICK       Choose                                                
    F9                             <..>       Select                                                
    Shift-F2                       <..>       Delete                                                
    Shift-F4                       <..>       Save without check                                    
    Shift-F5                       <..>       Other <object>                                                                               
    Freely assigned function keys                                        
    F5                             STORAGE    STORAGE                   
    F6                             PLANT      PLANT                     
    F7                                                                  
    F8                                                                  
    Shift-F1                                                            
    Hope this will help you.
    Regards,
    Arun Sambargi.
    Message was edited by: Arun Sambargi

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

  • At line-selection /at user-command in alv

    hai ,
             i used layout-listappend to output 3 alv's in one page .but
    after using layout-listappend i_usercommand in reuse_alv_.. is not working .so i tried to use at line selection . please guide me to solve this problem how to use at line-selection in this prob or is there any other suitable way.

    hi,
    try this code it will help you
    *& Report  ZP_ALV8
    REPORT  zp_alv8.
    TABLES: kna1, mara, vbak, mard.
    TYPE-POOLS: slis.
    **TYPE DECLERATION
    TYPES: BEGIN OF ty_kna1,
             kunnr LIKE kna1-kunnr,
             land1 LIKE kna1-land1,
             name1 LIKE kna1-name1,
             ort01 LIKE kna1-ort01,
           END OF ty_kna1.
    TYPES: BEGIN OF ty_mara,
             matnr LIKE mara-matnr,
             ersda LIKE mara-ersda,
             ernam LIKE mara-ernam,
           END OF ty_mara.
    TYPES: BEGIN OF ty_vbak,
             vbeln LIKE vbak-vbeln,
             erdat LIKE vbak-erdat,
             ernam LIKE vbak-ernam,
           END OF ty_vbak.
    TYPES: BEGIN OF ty_mard,
             matnr LIKE mard-matnr,
             werks LIKE mard-werks,
             lgort LIKE mard-lgort,
          END OF ty_mard.
    **DATA DECLERATION
    DATA: it_kna1 TYPE STANDARD TABLE OF ty_kna1,
          wa_kna1 TYPE ty_kna1.
    DATA: it_mara TYPE STANDARD TABLE OF ty_mara,
          wa_mara TYPE ty_mara.
    DATA: it_vbak TYPE STANDARD TABLE OF ty_vbak,
          wa_vbak TYPE ty_vbak.
    DATA: it_mard TYPE STANDARD TABLE OF ty_mard,
          wa_mard TYPE ty_mard.
    DATA: it_fieldcat_kna1 TYPE slis_t_fieldcat_alv,
          wa_fieldcat_kna1 TYPE slis_fieldcat_alv,
          it_fieldcat_mara TYPE slis_t_fieldcat_alv,
          wa_fieldcat_mara TYPE slis_fieldcat_alv,
          it_fieldcat_vbak TYPE slis_t_fieldcat_alv,
          wa_fieldcat_vbak TYPE slis_fieldcat_alv,
          it_fieldcat_mard TYPE slis_t_fieldcat_alv,
          wa_fieldcat_mard TYPE slis_fieldcat_alv.
    DATA: it_event_kna1 TYPE slis_t_event,
          wa_event_kna1 TYPE slis_alv_event,
          it_event_mara TYPE slis_t_event,
          wa_event_mara TYPE slis_alv_event,
          it_event_vbak TYPE slis_t_event,
          wa_event_vbak TYPE slis_alv_event,
          it_event_mard TYPE slis_t_event,
          wa_event_mard TYPE slis_alv_event.
    DATA: wa_layout TYPE slis_layout_alv,
          it_listheader TYPE slis_t_listheader,
          wa_listheader TYPE slis_listheader.
    selection-screen begin of block b1 with frame title text-001.
    select-options: s_kunnr for kna1-kunnr default '1000' to '1050'.
    selection-screen end of block b1.
    selection-screen begin of block b2 with frame title text-002.
    select-options: s_matnr for mara-matnr default '1' to '100'.
    selection-screen end of block b2.
    **INITIALIZATION
    INITIALIZATION.
      PERFORM layout.
      PERFORM fieldcat_kna1.
      PERFORM fieldcat_mara.
      PERFORM event_kna1.
      PERFORM event_mara.
      PERFORM eventpopulate_kna1.
      PERFORM eventpopulate_mara.
    **START OF SELECTION AND FIRST LIST DISPLAY
    START-OF-SELECTION.
      SELECT kunnr land1 name1 ort01
             FROM kna1
             INTO TABLE it_kna1
             where kunnr in s_kunnr.
           UP TO 10 ROWS.
      SELECT matnr ersda ernam
             FROM mara
             INTO TABLE it_mara
             where matnr in s_matnr.
            UP TO 20 ROWS.
      PERFORM display.
    **FORM LAYOUT
    *&      Form  layout
          text
    -->  p1        text
    <--  p2        text
    FORM layout .
      wa_layout-zebra ='X'.
      wa_layout-get_selinfos      = 'X'.
      wa_layout-key_hotspot = 'X'.
    ENDFORM.                    " layout
    *FIELD CATALOUGE*******************************
    *&      Form  fieldcat_kna1
          text
    -->  p1        text
    <--  p2        text
    FORM fieldcat_kna1 .
      REFRESH it_fieldcat_kna1.
      CLEAR wa_fieldcat_kna1.
      wa_fieldcat_kna1-fieldname = 'KUNNR'.
      wa_fieldcat_kna1-seltext_l = 'CUSTOMER NUMBER'.
      wa_fieldcat_kna1-datatype = 'CHAR'.
      wa_fieldcat_kna1-outputlen = 30.
      wa_fieldcat_kna1-tabname = 'IT_KNA1'.
      wa_fieldcat_kna1-key = 'X'.
      wa_fieldcat_kna1-hotspot = 'X'.
      wa_fieldcat_kna1-col_pos = 1.
      wa_fieldcat_kna1-emphasize = 'C21'.
      APPEND wa_fieldcat_kna1 TO it_fieldcat_kna1.
      CLEAR wa_fieldcat_kna1.
      wa_fieldcat_kna1-fieldname = 'LAND1'.
      wa_fieldcat_kna1-seltext_l = 'COUNTRY CODE'.
      wa_fieldcat_kna1-datatype = 'CHAR'.
      wa_fieldcat_kna1-outputlen = 30.
      wa_fieldcat_kna1-tabname = 'IT_KNA1'.
      wa_fieldcat_kna1-hotspot = 'X'.
      wa_fieldcat_kna1-col_pos = 2.
      wa_fieldcat_kna1-emphasize = 'C31'.
      APPEND wa_fieldcat_kna1 TO it_fieldcat_kna1.
      CLEAR wa_fieldcat_kna1.
      wa_fieldcat_kna1-fieldname = 'NAME1'.
      wa_fieldcat_kna1-seltext_l = 'CUSTOMER NAME'.
      wa_fieldcat_kna1-datatype = 'CHAR'.
      wa_fieldcat_kna1-outputlen = 30.
      wa_fieldcat_kna1-tabname = 'IT_KNA1'.
      wa_fieldcat_kna1-hotspot = 'X'.
      wa_fieldcat_kna1-col_pos = 3.
      wa_fieldcat_kna1-emphasize = 'C71'.
      APPEND wa_fieldcat_kna1 TO it_fieldcat_kna1.
      CLEAR wa_fieldcat_kna1.
      wa_fieldcat_kna1-fieldname = 'ORT01'.
      wa_fieldcat_kna1-seltext_l = 'COUNTRY '.
      wa_fieldcat_kna1-datatype = 'CHAR'.
      wa_fieldcat_kna1-outputlen = 30.
      wa_fieldcat_kna1-tabname = 'IT_KNA1'.
      wa_fieldcat_kna1-hotspot = 'X'.
      wa_fieldcat_kna1-col_pos = 4.
      wa_fieldcat_kna1-emphasize = 'C51'.
      APPEND wa_fieldcat_kna1 TO it_fieldcat_kna1.
      CLEAR wa_fieldcat_kna1.
    ENDFORM.                    " fieldcat_kna1
    *&      Form  fieldcat_kna2
          text
    FORM fieldcat_mara  .
      wa_fieldcat_mara-fieldname = 'MATNR'.
      wa_fieldcat_mara-seltext_l = 'MATERIAL NUMBER'.
      wa_fieldcat_mara-datatype = 'CHAR'.
      wa_fieldcat_mara-outputlen = 30.
      wa_fieldcat_mara-tabname = 'IT_MARA'.
      wa_fieldcat_mara-key = 'X'.
      wa_fieldcat_mara-hotspot = 'X'.
      wa_fieldcat_mara-col_pos = 1.
      wa_fieldcat_mara-emphasize = 'C21'.
      APPEND wa_fieldcat_mara TO it_fieldcat_mara.
      CLEAR wa_fieldcat_mara.
      wa_fieldcat_mara-fieldname = 'ERSDA'.
      wa_fieldcat_mara-seltext_l = 'CREATED ON'.
      wa_fieldcat_mara-datatype = 'CHAR'.
      wa_fieldcat_mara-outputlen = 30.
      wa_fieldcat_mara-tabname = 'IT_MARA'.
      wa_fieldcat_mara-hotspot = 'X'.
      wa_fieldcat_mara-col_pos = 2.
      wa_fieldcat_mara-emphasize = 'C41'.
      APPEND wa_fieldcat_mara TO it_fieldcat_mara.
      CLEAR wa_fieldcat_mara.
      wa_fieldcat_mara-fieldname = 'ERNAM'.
      wa_fieldcat_mara-seltext_l = 'CREATED BY'.
      wa_fieldcat_mara-datatype = 'CHAR'.
      wa_fieldcat_mara-outputlen = 30.
      wa_fieldcat_mara-tabname = 'IT_MARA'.
      wa_fieldcat_mara-hotspot = 'X'.
      wa_fieldcat_mara-col_pos = 3.
      wa_fieldcat_mara-emphasize = 'C61'.
      APPEND wa_fieldcat_mara TO it_fieldcat_mara.
      CLEAR wa_fieldcat_mara.
    ENDFORM.                    "fieldcat_kna2
    *&      Form  FIELDCAT_VBAK
          text
    FORM fieldcat_vbak.
      wa_fieldcat_vbak-fieldname = 'VBELN'.
      wa_fieldcat_vbak-seltext_l = 'SALES ORDER'.
      wa_fieldcat_vbak-datatype = 'CHAR'.
      wa_fieldcat_vbak-outputlen = 30.
      wa_fieldcat_vbak-tabname = 'IT_VBAK'.
      wa_fieldcat_vbak-hotspot = 'X'.
      wa_fieldcat_vbak-col_pos = 3.
      wa_fieldcat_vbak-emphasize = 'C31'.
      APPEND wa_fieldcat_vbak TO it_fieldcat_vbak.
      CLEAR wa_fieldcat_vbak.
      wa_fieldcat_vbak-fieldname = 'ERDAT'.
      wa_fieldcat_vbak-seltext_l = 'CREATED ON'.
      wa_fieldcat_vbak-datatype = 'DATS'.
      wa_fieldcat_vbak-outputlen = 30.
      wa_fieldcat_vbak-tabname = 'IT_VBAK'.
      wa_fieldcat_vbak-hotspot = 'X'.
      wa_fieldcat_vbak-col_pos = 3.
      wa_fieldcat_vbak-emphasize = 'C41'.
      APPEND wa_fieldcat_vbak TO it_fieldcat_vbak.
      CLEAR wa_fieldcat_vbak.
      wa_fieldcat_vbak-fieldname = 'ERNAM'.
      wa_fieldcat_vbak-seltext_l = 'CREATED BY'.
      wa_fieldcat_vbak-datatype = 'CHAR'.
      wa_fieldcat_vbak-outputlen = 30.
      wa_fieldcat_vbak-tabname = 'IT_VBAK'.
      wa_fieldcat_vbak-hotspot = 'X'.
      wa_fieldcat_vbak-col_pos = 3.
      wa_fieldcat_vbak-emphasize = 'C51'.
      APPEND wa_fieldcat_vbak TO it_fieldcat_vbak.
      CLEAR wa_fieldcat_vbak.
    ENDFORM.                    "FIELDCAT_VBAK
    *&      Form  fieldcat_mard
          text
    FORM fieldcat_mard.
      wa_fieldcat_mard-fieldname = 'MATNR'.
      wa_fieldcat_mard-seltext_l = 'MATERIAL NUMBER'.
      wa_fieldcat_mard-datatype = 'CHAR'.
      wa_fieldcat_mard-outputlen = 30.
      wa_fieldcat_mard-tabname = 'IT_MARD'.
      wa_fieldcat_mard-hotspot = 'X'.
      wa_fieldcat_mard-col_pos = 1.
      wa_fieldcat_mard-emphasize = 'C31'.
      APPEND wa_fieldcat_mard TO it_fieldcat_mard.
      CLEAR wa_fieldcat_mard.
      wa_fieldcat_mard-fieldname = 'WERKS'.
      wa_fieldcat_mard-seltext_l = 'PLANT'.
      wa_fieldcat_mard-datatype = 'CHAR'.
      wa_fieldcat_mard-outputlen = 30.
      wa_fieldcat_mard-tabname = 'IT_MARD'.
      wa_fieldcat_mard-hotspot = 'X'.
      wa_fieldcat_mard-col_pos = 2.
      wa_fieldcat_mard-emphasize = 'C61'.
      APPEND wa_fieldcat_mard TO it_fieldcat_mard.
      CLEAR wa_fieldcat_mard.
      wa_fieldcat_mard-fieldname = 'LGORT'.
      wa_fieldcat_mard-seltext_l = 'STORAGE LOCATION'.
      wa_fieldcat_mard-datatype = 'CHAR'.
      wa_fieldcat_mard-outputlen = 30.
      wa_fieldcat_mard-tabname = 'IT_MARD'.
      wa_fieldcat_mard-hotspot = 'X'.
      wa_fieldcat_mard-col_pos = 3.
      wa_fieldcat_mard-emphasize = 'C81'.
      APPEND wa_fieldcat_mard TO it_fieldcat_mard.
      CLEAR wa_fieldcat_mard.
    ENDFORM  .                    "fieldcat_mard
    **FORM DISPLAY
    *&      Form  Display
          text
    -->  p1        text
    <--  p2        text
    FORM display .
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
        EXPORTING
          i_callback_program = sy-repid
      I_CALLBACK_PF_STATUS_SET       = ' '
       I_CALLBACK_USER_COMMAND        = 'USER_COMMAND'.
      IT_EXCLUDING                   =
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout                        = wa_layout
          it_fieldcat                      = it_fieldcat_kna1
          i_tabname                        = 'IT_KNA1'
         it_events                         = it_event_kna1
      IT_SORT                          =
      I_TEXT                           = ' '
        TABLES
          t_outtab                         = it_kna1
       EXCEPTIONS
         program_error                    = 1
         maximum_of_appends_reached       = 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.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout                        = wa_layout
          it_fieldcat                      = it_fieldcat_mara
          i_tabname                        = 'IT_MARA'
          it_events                        = it_event_mara
      IT_SORT                          =
      I_TEXT                           = ' '
        TABLES
          t_outtab                         = it_mara
       EXCEPTIONS
         program_error                    = 1
         maximum_of_appends_reached       = 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.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
        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
    **EVENTS FOR KNA1 AND MARA
    *&      Form  EVENT_KNA1
          text
    -->  p1        text
    <--  p2        text
    FORM event_kna1 .
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type     = 0
        IMPORTING
          et_events       = it_event_kna1
        EXCEPTIONS
          list_type_wrong = 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.                    " EVENT_KNA1
    *&      Form  EVENT_MARA
          text
    -->  p1        text
    <--  p2        text
    FORM event_mara .
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type     = 0
        IMPORTING
          et_events       = it_event_mara
        EXCEPTIONS
          list_type_wrong = 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.                    " EVENT_MARA
    **POPULATING EVENTS
    *&      Form  eventpopulate_kna1
          text
    -->  p1        text
    <--  p2        text
    FORM eventpopulate_kna1 .
      READ TABLE it_event_kna1 INTO wa_event_kna1 WITH KEY name = 'TOP_OF_PAGE'.
      IF sy-subrc = 0.
        wa_event_kna1-form = 'TOP_OF_PAGE_KNA1'.
        MODIFY it_event_kna1 FROM wa_event_kna1 TRANSPORTING form WHERE name = wa_event_kna1-name.
      ENDIF.
    READ TABLE it_event_kna1 INTO wa_event_kna1 WITH KEY name = 'USER_COMMAND'.
    IF sy-subrc = 0.
       wa_event_kna1-form = 'USER_COMMAND_KNA1'.
       MODIFY it_event_kna1 FROM wa_event_kna1 TRANSPORTING form WHERE name = wa_event_kna1-name.
    ENDIF.
    ENDFORM.                    " eventpopulate_kna1
    *&      Form  eventpopulate_mara
          text
    -->  p1        text
    <--  p2        text
    FORM eventpopulate_mara .
      READ TABLE it_event_mara INTO wa_event_mara WITH KEY name = 'TOP_OF_PAGE'.
      IF sy-subrc = 0.
        wa_event_mara-form = 'TOP_OF_PAGE_MARA'.
        MODIFY it_event_mara FROM wa_event_mara TRANSPORTING form WHERE name = wa_event_mara-name.
      ENDIF.
    READ TABLE it_event_mara INTO wa_event_mara WITH KEY name = 'USER_COMMAND'.
    IF sy-subrc = 0.
       wa_event_mara-form = 'USER_COMMAND_MARA'.
       MODIFY it_event_mara FROM wa_event_mara TRANSPORTING form WHERE name = wa_event_mara-name.
    ENDIF.
    ENDFORM.                    " eventpopulate_mara
    **TOP OF PAGE
    *&      Form  TOP_OF_PAGE_KNA1
          text
    FORM top_of_page_kna1.
    wa_listheader-typ = 'H'.
    wa_listheader-info = 'CUSTOMER DETAILS' .
    APPEND wa_listheader TO it_listheader.
    CLEAR wa_listheader.
      WRITE:/ 'CUSTOMER DETAILS'.
    ENDFORM.                    "TOP_OF_PAGE_KNA1
    *&      Form  TOP_OF_PAGE_MARA
          text
    FORM top_of_page_mara.
    wa_listheader-typ = 'H'.
    wa_listheader-info = 'MATERIAL DETAILS' .
    APPEND wa_listheader TO it_listheader.
    CLEAR wa_listheader.
      WRITE:/ 'MATERIAL DETAILS' .
    ENDFORM.                    "TOP_OF_PAGE_KNA1
    **CODE FOR SECOND LIST DISPLAY FOR VBAK
    *&      Form  USER_COMMAND
          text
         -->UCOMM      text
         -->R_SELFIELD text
    FORM user_command
         USING ucomm LIKE sy-ucomm
               r_selfield TYPE slis_selfield.
    CASE UCOMM.
      when '&IC1'.
        CASE R_SELFIELD-TABNAME.
          WHEN 'IT_KNA1'.
            DATA: CUST(10) TYPE n.
            CUST = r_selfield-value.
             SELECT vbeln erdat ernam
                    FROM vbak
                    INTO TABLE it_vbak
                    WHERE kunnr = cust.
             PERFORM fieldcat_vbak.
             PERFORM display_vbak.
          WHEN 'IT_MARA'.
            DATA: MAT(18) TYPE N.
            MAT = R_selfield-value.
              SELECT matnr werks lgort
                   FROM mard
                   INTO TABLE it_mard
                   WHERE matnr = mat.
            PERFORM fieldcat_mard.
            PERFORM display_mard.
         ENDCASE.
      ENDCASE.
    ENDFORM.                    "USER_COMMAND
    **&      Form  USER_COMMAND_MARA
          text
         -->UCOMM      text
         -->S_SELFIELD text
    *FORM user_command_mara
        USING ucomm LIKE sy-ucomm
              s_selfield TYPE slis_selfield.
    SELECT matnr werks lgort
            FROM mard
            INTO TABLE it_mard
            WHERE matnr = s_selfield-value.
    PERFORM fieldcat_mard.
    PERFORM display_mard.
    *ENDFORM.                    "USER_COMMAND_MARA
    *&      Form  DISPLAY_VBAK
          text
    -->  p1        text
    <--  p2        text
    FORM display_vbak .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = sy-repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
       IS_LAYOUT                         = wa_layout
       IT_FIELDCAT                       = it_fieldcat_vbak
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      TABLES
        t_outtab                          = it_vbak
    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_VBAK
    *&      Form  display_mard
          text
    FORM display_mard .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
         i_callback_program             = sy-repid
      I_CALLBACK_PF_STATUS_SET       = ' '
        i_callback_user_command        = 'USER_COMMAND_MARD'
      I_STRUCTURE_NAME               =
         is_layout                      = wa_layout
         it_fieldcat                    = it_fieldcat_mard
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
        it_events                      = it_event_mard
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
      IR_SALV_LIST_ADAPTER           =
      IT_EXCEPT_QINFO                =
      I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
        TABLES
          t_outtab                       = it_mard
    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_mard
    regards
    prasanth

  • 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

  • Refresh Report and At Line-Selection and At User-Command

    Hi All
    I have 2 querries
    1) I want to use At Line-selection and At user-command in the same report. But At line-selection is not getting triggered why? When I remove Set pf-status 'xxx' and at user command , then at line selection works . I want to user both at a time.
    2) I am giving user ability to edit the report shown and when he comes back by exiting the editing I want to refresh the report which is shown already to him to give effect of his editing.
    Thanks in anticipation
    pM.

    i just tried, and no problem at all.
    In the <b>Recommended Function Key Settings</b>  for  F2 key add command "PICK"
    Regards
    Raja
    since you are new to the forum, have a look at this weblog.
    /people/mark.finnern/blog/2004/08/10/spread-the-love

  • Using both at line-selection and at user-command

    hellow friends ,
    to use both  at line-selection and at user-command in the same report.

    Hello,
    U can do it like this.
    AT LINE-SELECTION.
      PERFORM at_line_selection.
    AT USER-COMMAND.
      PERFORM at_user_command.
    FORM AT_LINE_SELECTION.
      DATA: LV_CURSOR_FIELD(30).
      DATA: LV_MATNR TYPE MATNR.
      CLEAR H_UCOMM.
      GET CURSOR FIELD LV_CURSOR_FIELD.
      CASE LV_CURSOR_FIELD.
        WHEN 'PSPNR'.
          PERFORM LAGER_AN_PSP USING WA_MATNR-M1-RSNUM
                                     WA_MATNR-M1-RSPOS.
        WHEN 'PSPNR2'.
          H_UCOMM = 'PSPNR2'.
          IF NOT PSPNR2 IS INITIAL AND IT_VKBEL-VBELN CN '0123456789'.
            PERFORM LAGER_AN_PSP_VKBEL USING IT_VKBEL
                                             0
                                             PSPNR2
                                             H_MAKTX
                                             ' '.     "keine Blindbuchung
          ENDIF.
    ENDCASE.
    CASE SY-UCOMM.
        WHEN 'BACK_NEW'.
          PERFORM NEU_START USING 'X'.
        WHEN 'EXIT'.
          PERFORM NEU_START USING 'X'.
        WHEN 'CANC'.
          PERFORM NEU_START USING 'X'.
        WHEN 'CHECK'.
          PERFORM NEU_START USING SPACE.
    ENDCASE.
    Vasanth

  • 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

  • 'PICK' and User commands in reports

    I'm a bit confused about 'PICK' in PF_STATUS.
    I fI define it, does that mean It can only be recognised in LINE-SELECTION , and not in AT USER-COMMAND.
    I've defined a small program and thats what seems to be happening?

    You can see here that the function code PICK is automatically fired when a hotspot is involved and hence the AT LINE-SELECTION event is fired to handle it.
    report zrich_0001.
    data: itstc type table of tstc with header line.
    select-options : s_tcode for itstc-tcode.
    at line-selection.
      check sy-ucomm = 'PICK'.
      call transaction itstc-tcode.
    start-of-selection.
      select * into corresponding fields of table itstc
                 from tstc
                      where tcode in s_tcode.
      loop at itstc.
        format hotspot on.
        write:/ itstc-tcode.
        hide itstc-tcode.
        format hotspot off.
      endloop.
    Regards
    Rich Heilman

  • Diff between at line selection and HIDE technique

    hi all,
           wht is the diff between at-line-selection and HIDE technique.
            wht r code instructor
            wht is extended testing
            how can we find selected error records in session                          method ex:-if there r errors in 4th 9th 13th record.
    tthnx in advance

    HIDE
    Syntax
    HIDE dobj.
    Effect
    This statement stores - in the current list level - the content of the variable dobj together with the current list line whose line number is contained in sy-linno. The data type of the variables dobj must be flat and no field symbols can be specified that point to rows of internal tables, and no class attributes can be specified. The stored values can be read as follows:
    For each user action in a displayed screen list that leads to a list result, all the row values stored using HIDE - that is, the row on which the screen cursor is positioned at the time of the event - are assigned to the respective variables.
    If a list row of an arbitrary list level is read or modified using the statements READ LINE or MODIFY LINE, all the values of this row stored using HIDE are assigned to the respective variables.
    Notes
    The HIDE statement works independently of whether the list cursor was set. In particular, variables for empty list rows can be stored - that is, rows in which the list cursor was positioned using statements like SKIP.
    The HIDE statement should be executed immediately at the statement that has set the list cursor in the row.
    Outside of classes, constants and literals that cannot be read in list results and in the statement READ LINE can be specified for dobj outside of classes.
    Example
    Storing square numbers and cubic numbers for a list of numbers. The example shows that arbitrary variables can be stored independently of row content. In the real situation, one would more likely store only the number and execute the calculation, when required, in the the event block for AT LINE-SELECTION.
    REPORT ...
    DATA: square TYPE i,
          cube   TYPE i.
    START-OF-SELECTION.
      FORMAT HOTSPOT.
      DO 10 TIMES.
        square = sy-index ** 2.
        cube   = sy-index ** 3.
        WRITE / sy-index.
        HIDE: square, cube.
      ENDDO.
    AT LINE-SELECTION.
      WRITE: square, cube.
    AT LINE-SELECTION
    Syntax
    AT LINE-SELECTION.
    Effect
    This statement defines an event block whose event is triggered by the ABAP runtime environment during the display of a screen list - provided the scren cursor is on a list line and you select a function using the function code PICK. Through the definition of this event block, the standard list status is automatically enhanced in such a way that the function code F2 and, with it, the double-click mouse function is linked up to the function code PICK.
    Note
    If the function key F2 is linked with a function code different than PICK, each double click will trigger its even, usually AT USER-COMMAND, and not AT LINE-SELECTION.
    Example
    This program works with the standard list status. A line selection with the left mouse key causes the event AT LINE-SELECTION and creates details lists.
    REPORT demo_at_line_selection.
    START-OF-SELECTION.
      WRITE 'Click me!' COLOR = 5 HOTSPOT.
    AT LINE-SELECTION.
      WRITE: / 'You clicked list', sy-listi,
             / 'You are on list',  sy-lsind.
      IF sy-lsind < 20.
        SKIP.
        WRITE: 'More ...' COLOR = 5 HOTSPOT.
      ENDIF.
    Thanks,

  • ITS URGENT QUES ON AT LINE-SELECTION AND AT USER-COMMAND

    ITS URGENT...WHEN I SELECT MULTIPUL VALUES IN BASIC LIST ,I HAVE TO GET THOSE SELECTED MULTIPUL VALUES IN SECONDARY LIST THAT CAN BE AFTER(AT LINE-SELECTION OR AT USER-COMMAND)............?

    hey
    this code modify's simlarly u can read n  display secondary window
        DO .
    Reading the internal table whose data is displayed into wrk area.....
          READ LINE SY-INDEX FIELD VALUE INT_DISPLAY-SHIPMENT_ID INTO WF_SHIPMENT_ID.
    Reading the check box value
          READ LINE SY-INDEX FIELD VALUE WG_CHK.
    If all the records are read and there is no code left to read
          IF SY-SUBRC <> 0 .
            EXIT.
          ENDIF.
    To highlight the line which is selected by the user
          IF WG_CHK = WL_X.
            MODIFY CURRENT LINE
            LINE FORMAT COLOR COL_NEGATIVE INVERSE
            FIELD VALUE WG_CHK FROM WL_SPACE.
            MODIFY CURRENT LINE
            LINE FORMAT INPUT OFF.
    Also append the record read into new internal table which u will display in secondary window.......
          ENDIF.
        ENDDO.
    AT USER-COMMAND. or AT LINE SELECTION . u can write this code.........
    DISPLAYING A POP-UP WINDOW .
          WINDOW STARTING AT 10 50
                 ENDING AT 120 70.
    and then write the table into which u have stored the read entry which user had selected
    reward points if useful

  • 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

  • CL_GUI_ALV_GRID: Line selection and backend table

    Dear community,
    is there a way to propagate line selection of ALV GRID GUI automagically to the backend data table?
    This is my scenario:
    1) A table containing several records with one column 'SELECTED' for selection status
    2) ALV_GRID to display the table with layout info for line selection
    alv_layo-sel_mode   = 'A'.
    alv_layo-box_fname  = 'SELECTED'.
    3) At PBO methods set_table_for_first_display and refresh_table_display are called with the table containing some records marked as 'SELECTED'.
    First problem here: 'SELECTED' entries are not propagated to the ALV grid (the lines in the GUI are not marked). I know I could use set_selected_rows to force the selection, but is this really necessary?
    4) Then, at PAI method check_changed_data is called (and yes, event mc_evt_modified is registered).
    Second problem: Changes in selection are not propagated automagically to the underlying table. I also know I could use get_selected_rows to force this update manually, but again: is this really necessary?
    Can anyone explain the behavior why sorting etc. is propagated automatically to the underlying table, but not the selection of rows? Am I missing something?
    Hint: Removing box_fname = 'SELECTED' and setting the fieldcatalog to display the column 'SELECTED' as editable checkbox works also. But our users are familiar with the rowmark, so this is no option.
    Any suggestions are welcome.
    Thanks,
    Torsten.
    Here an (almost) complete listing of the code:
    PROCESS BEFORE OUTPUT.
      MODULE SET_STATUS_TITLE_0100.
      MODULE INIT_ALV_GRID_0100.
      MODULE DISPLAY_DATA_0100.
      MODULE SET_GRID_SELECTION_0100.
    PROCESS AFTER INPUT.
      MODULE EXIT_COMMAND_0100 AT EXIT-COMMAND.
      MODULE UPDATE_TABLE_DATA_0100.
      MODULE USER_COMMAND_0100.
    MODULE init_alv_grid_0100 OUTPUT.
      IF NOT gr_container IS BOUND.
    *   Container erzeugen
        CREATE OBJECT gr_container ...
    *   ALV Grid erstellen
        CREATE OBJECT gr_alv_grid ...
    *   ALV für die erste Anzeige vorbereiten
        gs_alv_layo-zebra      = on.         " Gestreifte Anzeige
        gs_alv_layo-no_toolbar = on.         " Keine Toolbar
        gs_alv_layo-no_rowmark = off.        " Keine Zeilenmarkierung
        gs_alv_layo-edit       = off.        " Editieren ermöglichen
        gs_alv_layo-sel_mode   = 'A'.        " Selektionsmodus
        gs_alv_layo-cwidth_opt = off.        " Optimierte Spaltenbreite!
        gs_alv_layo-info_fname = 'LCOLOR'.   " ALV-Control: Feldname mit
                                             " einfacher Farbcodierung für
                                             " Zeile
        gs_alv_layo-ctab_fname = 'CCOLOR'.   " ALV-Control: Feldname mit
                                             " komplexer Farbcodierung
                                             " für Zellen
        gs_alv_layo-box_fname  = 'SELECTED'. " Markierte Zeilen
    *   Feldkatalog für die Anzeige vorbereiten
    *    CLEAR gs_fcat.                       " Mehrfachsel. ermöglichen
    *    gs_fcat-fieldname = 'SELECTED'.      " Dazu muss das Feld für die
    *    gs_fcat-edit      = on.              " Selektion editierbar sein.
    *    gs_fcat-checkbox  = on.              " Ausserdem muss die
    **   gs_fcat-outputlen = '3'.             " Zeilenmark. eingeschaltet
    *    APPEND gs_fcat TO gt_fcat.           " und box_fname gesetzt sein.
    *   Ereignisbehandlung
        SET HANDLER
          lcl_event_handler=>on_click
          lcl_event_handler=>on_hotspot
          lcl_event_handler=>on_double_click
          lcl_event_handler=>on_user_command
          lcl_event_handler=>on_data_changed
        FOR gr_alv_grid.
        CALL METHOD gr_alv_grid->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_modified
          EXCEPTIONS
            error      = 1
            OTHERS     = 2.
      ENDIF.
    ENDMODULE.                 " INIT_ALV_GRID_0100  OUTPUT
    MODULE display_data_0100 OUTPUT.
    * PBO Modul für alle weiteren Anzeigezyklen.
      IF gr_alv_grid IS BOUND.
        CALL METHOD gr_alv_grid->set_table_for_first_display ...
      ENDIF.
    ENDMODULE.                 " DISPLAY_DATA_0100  OUTPUT
    MODULE set_grid_selection_0100 OUTPUT.
      IF gr_alv_grid IS BOUND.
        CALL METHOD gr_alv_grid->refresh_table_display.
      ENDIF.
    * Alterative: Set selected rows manually
    *    CALL METHOD gr_alv_grid->set_selected_rows
    ENDMODULE.                 " SET_GRID_SELECTION_0100 OUTPUT
    MODULE update_table_data_0100 INPUT.
        CALL METHOD gr_alv_grid->check_changed_data.
    * Alternative: Get selected rows and update table manually
    *    CALL METHOD gr_alv_grid->get_selected_rows ...
    ENDMODULE.                 " UPDATE_TABLE_DATA_0100  INPUT

    Hello Torsten
    I may be wrong but I think the field LVC_S_LAYO-BOX_FNAME is a relict from the stone-age SLIS-based ALV programming.
    Using modern OO-based ALV we do not need any kind of "MARK" row but we have the appropriate methods available.
    Regards
      Uwe

Maybe you are looking for