At line-selection... SET pf 'status'.

hi abapers !
i  am working with interactive reports !
my problem ...i s
when am using
SET PF 'STATUS'.
At line-selection event is not getting triggered..!
i.e, when am double cllicking on the list ...
its showing choose a valid function.
am able to implement my tool bar .. status.
using
AT user-command.
case sy-ucomm.
endcase.
but  i want to genrerate secondary list... with out ,using tool bar..
how can i trigger at line-selection event....!
pls can any one help me.. with an simple example...!

If you do not want any button then use GET CURSOR instead of SET PF status.
Try ir in this way
TYPES: BEGIN OF x_mara,
  matnr TYPE matnr,
  END OF x_mara.
DATA : i_mara TYPE STANDARD TABLE OF x_mara INITIAL SIZE 0,
       i_marc TYPE STANDARD TABLE OF marc INITIAL SIZE 0,
       l_value TYPE string,
       l_field TYPE string,
       wa_marc TYPE marc,
       wa_mara TYPE x_mara.
SELECT matnr FROM mara  INTO TABLE i_mara.
LOOP at i_mara INTO wa_mara.
  WRITE: / wa_mara-matnr.
  ENDLOOP.
AT LINE-SELECTION.
  GET CURSOR FIELD l_field VALUE l_value.
  IF l_field = 'WA_MARA-MATNR'.
    SELECT * FROM marc INTO TABLE i_marc WHERE matnr = l_value.
      LOOP AT i_marc INTO wa_marc.
        WRITE: / wa_marc-matnr , wa_marc-werks.
      ENDLOOP.
  ENDIF.

Similar Messages

  • How to iplement together: AT-LINE-SELECTION with GUI STATUS

    If I load SET PF-STATUS '111' then don't see icon from at-line selection and reverse.
    It is possible to implement in one program this two elements?

    Hi,
    When you define pf-status the list processing feature disappers and screen processing works. So only the user action double click can happen on the lists. The default functuion key for double click is F2. So assgn it to a user command and it will work on double click on the list.
    Regards,
    Renjith Michael.

  • Setting pf-status on selection screen isue...

    Hello Gurus,
    I have a sample code as below. Now when I execute this one system automotically creates a default application tool bar, menu bar, etc.
    Now, I have a requirement where I have to add a custom button in application toolbar but the other default stuff should work as it is like back buttin, variant button.
    How can I do this ? I defined a pf-status creating anew program and tried to use as follows but it does not show the new pf-status.
    SELECTION-SCREEN COMMENT /1(50) COMM1.
    SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
        parameters:
                max_res(8) default '20'.
    SELECTION-SCREEN END OF SCREEN 100.
    SELECTION-SCREEN: BEGIN OF TABBED BLOCK tab_block FOR 5 LINES,
      TAB (20) tab1 USER-COMMAND tabpush1
      DEFAULT SCREEN 100,
      END OF BLOCK tab_block.
    start-of-selection.
    set pf-status 'INDEXSCREEN' OF PROGRAM 'ZINDEX'.
    Please help.
    Regards,
    Rajesh.

    hi,
    In your program, just use
    Set PF-STATUS 'TEST'.
    Double click on TEST, it forward navigates to a new screen where you need to give values for function keys i.e. if any required application tool bar buttons, you have icons over there which show BACK , CANCEL  and exit.
    Just fill the blanks with the above values.
    In your program use the statement AT USER-COMMAND.
    check for sy-ucomm value using.
    CASE sy-ucomm.
    WHEN 'FC05'. " This is ex. function code you assign to a key in the application toolbar for custome button
    PROCESS.
    when 'BACK' OR 'CANCEL' OR 'EXIT'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    Thanks and regards
    Sharath

  • Problem with at line-selection

    hi mates
    i have written a interactive report program, when i click the hotspot in the basic list the event at line-selection is not getting triggered insead my at user-command is geting executed. is there a sequence that i need to follow?. below is my code. thanks in advance.
    tables: vbak.
    selection-screen begin of block b1 with frame title t1.
      select-options: salesdoc for vbak-vbeln.
    selection-screen end of block b1.
    types: begin of vbak_ty,
           vbeln type vbak-vbeln,
           erdat type vbak-erdat,
           ernam type vbak-ernam,
           end of vbak_ty.
    types: begin of vbap_type,
           vbeln type vbap-vbeln,
           posnr type vbap-posnr,
           matnr type vbap-matnr,
           charg type vbap-charg,
           end of vbap_type.
    types: begin of vbap_ty,
           posnr type vbap-posnr,
           matwa type vbap-matwa,
           arktx type vbap-arktx,
           end of vbap_ty.
    data: vbap_wa type vbap_type,
          vbap_it type table of vbap_type,
          vbak_wa type vbak_ty,
          vbak_it type table of vbak_ty,
          vbap_wa1 type vbap_ty,
          vbap_it1 type table of vbap_type,
          fname(20),fvalue(10).
    initialization.
           t1 = 'enter sales doc header'.
    start-of-selection.
      set pf-status 'VA01'.
      SELECT vbeln
             erdat
             ernam
             from vbak into table vbak_it
             where vbeln in salesdoc.
       if sy-subrc = 0.
       loop at vbak_it into vbak_wa.
         write: /25 vbak_wa-vbeln hotspot,
                 50 vbak_wa-erdat,
                 75 vbak_wa-ernam.
         hide vbak_wa-vbeln.
         clear vbak_wa-vbeln.
         endloop.
         ELSE.
           message e000(01) with 'no records found '.
           endif.
        at line-selection.
          case sy-lsind.
            when '1'.
              perform headerdata.
            when '2'.
              perform itemdata.
           endcase.
      at user-command.
        case sy-ucomm.
          when 'ITEMDATA'.
          get cursor  field fname value fvalue.
          if fvalue = 'vbap_wa-vbeln'.
             perform itemdata.
           else.
             message e000(03) with 'click only on hotspots'.
           endif.
          when 'SALEOR'.
           get cursor field fname value fvalue.
           if fvalue = 'vbak_wa-vbeln'.
            set parameter id 'AUN' field fvalue.
            call transaction 'VA01' and skip first screen.
           else.
             message e000(04) with 'click only on hotspots'.
           endif.
        endcase.
        form headerdata.
        set pf-status 'HEADER'.
        select vbeln
               posnr
               matnr
               charg
               from vbap into table vbap_it
               where vbeln = vbak_wa-vbeln.
          if sy-subrc = 0.
       loop at vbap_it into vbap_wa.
         write: /25 vbap_wa-vbeln hotspot,
                 50 vbap_wa-posnr,
                 75 vbap_wa-matnr,
                 90 vbap_wa-charg.
         hide vbap_wa-vbeln.
         clear vbap_wa-vbeln.
         endloop.
         else.
           message e000(02) with ' no data found'.
           endif.
           endform.
        form itemdata.
             select vbeln
               posnr
               matwa
               arktx
               from vbap into table vbap_it1
               where vbeln = vbap_wa-vbeln.
      if sy-subrc = 0.
       loop at vbap_it1 into vbap_wa1.
         write: /25 vbap_wa1-posnr,
                 75 vbap_wa1-matwa,
                 90 vbap_wa1-arktx.
          endloop.
           else.
           message e000(02) with ' no data found'.
           endif.
           endform.
    REGARDS
    MANO

    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.
    The above sample program works with the standard list status Since your program has the PF-status set, i think AT LINE-SELECTION will not work. So do use AT USER-COMMAND to capture the "PICK" event.
    Hope this helps.
    Thanks
    Balaji

  • Always Use Primary Line / Auto Line Select CM 4.1(3)sr3c

    Is it correct that the "Always Use Primary Line" system parameter and the phone device page "Auto Line Select" setting work together to affect a phone's off-hook behavior for incoming calls? I changed the Always Use Primary Line from the default (False to True) to change the behavior and force primary line only when the phone goes off-hook. When I then enabled Auto Line Select on the 7960G, I expected to reverse this global setting for that device only. But, that did not happen. In fact, no matter how Always Use Primary Line is set (True or False), the device page setting Auto Line Select (enable or disable) does not appear to cause any change at all. Has anyone else encountered this? If changing the Service Parameter takes effect without restarting callmanagers, wouldn't resetting the phone device force the change on the device page to take effect? Or, do I not understand the relationship between these two settings?

    Auto Line Select comes into play when you are already on the phone and you have a new incoming call on another line, then should the focus change to that new ringing line so it can show you the caller-id or should the focus be on the active line. Depending on this, the softkeys and everything change on your screen and you don't have to press the line button to see all the keys.
    Always use Prime Line is primary used when the phone goes off-hook. This determines if you want to go off-hook on the primary line all the time or not. If you choose to always use primary line, then everytime you go
    off-hook, we use the first line on the phone and it does not matter if there is a call ringing on another line.
    If its set to false, then when you go off-hook, it will go off hook on a line which is ringing and not your primary line.

  • AT LINE-SELECTION won't be triggered when I use SET PF-STATUS?

    Dear All,
    I have a simple program that shows a list. My program has AT LINE-SELECTION event. I also use a GUI status for my list.
    When I ran my program and double clicked a line, the AT LINE-SELECTION event was never triggered. Later, I deleted the line that registers the GUI status (SET PF-STATUS.... ). When I ran it again and double clicked a line, the AT LINE-SELECTION was triggered.
    Therefore, I conclude that AT LINE-SELECTION won't be triggered when I use SET PF-STATUS. Is it true?
    If so, is there any way to make my list responds to double click event when I also use GUI status?
    Thanks in advance,
    Haris

    Hi Harris,
    Check this link. I think it will answer your question.
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba34635c111d1829f0000e829fbfe/content.htm
    Regards,
    Madhu.

  • Can not use 'AT LINE-SELECTION' with SET PF-STATUS

    Hi experts,
    my code is like below:
    PARAMATERS: .....
    SET PF-STATUS 'st_nam'.
    Perform Load_data . ' For list display
    START-OF-SELECTION.
    AT LINE-SELECTION.
      Perform list_detail.
    AT USER-COMMAND.
      CALL SCREEN '1001'.
    END-OF-SELECTION.
    When I execute the report , the basic was displayed , but when then i double click on the list to call the next screen '1001'. It did not work , but if i omit the SET PF-STATUS m AT LINE-SELECTION worked week , so in this case what has happened i how can i solve this problem,
    Thaks,
    PS: Reward immediately

    Hi,
    Thank you very much for your helpful answers, I have copied the report downto my system and test it , When i used SET PF-STATUS , i can not use AT LINE-SELECTION to capture events ...May be we can not use these 2 statements in parallel,...:D
    Thanks,

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

  • In interactive how to use AT LINE-SELECTION WITH SET PF-STATUS

    Hi all,
             I am developing an interactive report in which i am using gui status (pf-status ) for AT USER-COMMAND and AT LINE-SELECTION  event .But when i used at line-selection event is  not working with pf-status even though i use PICK function code .
    plz help me to work with both the event i.e.
    AT USER-COMMAND.
    AT LINE-SELECTION.
    Thanks a lot in Advance .
    Regards,
    Tarak

    hi,
      In PBO of Module Pool, Please Write in this way
    MODULE status_9001 OUTPUT.
    Set the PF-STATUS
      SET PF-STATUS '9001'.
    To Set the Title of Screen
      SET TITLEBAR 'TITLE'.
    ENDMODULE
    Setting PF status to the (SAP) system default
    set pf-status 'BASIC'.
    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..

  • PF Status and At line Selection

    Hi All,
    I need your help!
    I have used PF Status for my first screen display. Now I need to display a 2nd screen, new classical report which a line can  be selected  ( Double-Clicked ) and then a transaction can be displayed.
    How should I do this?
    Thanks,
    Dyan

    HI
    JUST GO THRO THE FOLLOWING LINES..I HAVE USED AT LINE SELECTION..
    DATA: IT_LFA1 TYPE TABLE OF LFA1,
          WA_LFA1 TYPE LFA1,
          IT_EKKO  TYPE TABLE OF EKKO,
          WA_EKKO TYPE EKKO,
          IT_EKPO  TYPE TABLE OF EKPO,
          WA_EKPO TYPE EKPO.
    SELECT-OPTIONS ACCNO FOR WA_LFA1-LIFNR.
    SELECT  * FROM LFA1 INTO TABLE IT_LFA1 WHERE LIFNR IN ACCNO.
    WRITE : /70 'VENDOR Report' COLOR COL_HEADING .
      ULINE.
      WRITE : /10 'ACCOUNT NO  ', 57 'NAME'.
      LOOP AT IT_LFA1 INTO WA_LFA1.
        WRITE: /10 WA_LFA1-LIFNR, WA_LFA1-NAME1, WA_LFA1-ORT01.
        hide WA_LFA1-LIFNR.
      ENDLOOP.
    clear WA_LFA1-LIFNR.
    AT LINE-SELECTION.
    **write / sy-LILLI.
    IF SY-LSIND = 1.
         SELECT * FROM EKKO INTO TABLE IT_EKKO WHERE LIFNR = WA_LFA1-LIFNR.
    WRITE : / 'PUR DOC NO',20 'COMP CODE',30 'PUR DOC TYPE'.
         LOOP AT IT_EKKO INTO WA_EKKO.
    WRITE: /10 WA_EKKO-EBELN, WA_EKKO-BUKRS,WA_EKKO-BSART.
            HIDE WA_EKKO-EBELN.
          ENDLOOP.
    ENDIF.
    IF SY-LSIND = 2.
    SELECT * FROM EKPO INTO TABLE IT_EKPO WHERE EBELN = WA_EKKO-EBELN.
    WRITE: / 'MATERIAL NO','PLANT','STORAGE LOCATION'.
      LOOP AT IT_EKPO INTO WA_EKPO.
      WRITE: /10 WA_EKPO-MATNR, WA_EKPO-WERKS, WA_EKPO-LGORT.
      HIDE WA_EKPO-MATNR.
      ENDLOOP.
    ENDIF.
    IF SY-LSIND = 3.
    SET PARAMETER ID 'DFD' FIELD WA_EKPO-MATNR.
    CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
    ENDIF.
    REWARD IF USEFUL.

  • Activate PF-Status as well as At LINE-SELECTION

    Hi,
    i have a problem, i have created a graph icon on the main list using SET PF-STATUS and the icon is cumin and the graphis also beiing displayed. at a later stage in reporting, i used AT LINE-SELECTION. but this is not gettin executed when i double click any wer, it says, choose a valid function. but when i remove the SET PF-STATUS code, it work fine.
    I want both of them work.....how??????
    Message was edited by:
            Sabahuddin Ahmed

    Right ...you do one thing....
    in se41 .. open  status in change mode.. then in front of function key F2 remove <..> and write PICK .. then save and activate ..it'll work...

  • 'SET PF-STATUS EXCLUDING fcode' not working in Selection Screen event

    Hi all,
    I am trying to set PF-Status dynamically in Selection Screen based on Radio button.
    For that i have inserted following code under event --> AT SELECTION-SCREEN OUTPUT
    * SELECTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS: s_inc  RADIOBUTTON GROUP rad DEFAULT 'X'
                       USER-COMMAND inc MODIF ID mod,
                p_inc(10) MODIF ID m1,
                s_lbr  RADIOBUTTON GROUP rad,
                p_lbr(10) MODIF ID m2.
    SELECTION-SCREEN END OF BLOCK b1.
    *  AT SELECTION-SCREEN OUTPUT
    AT SELECTION-SCREEN OUTPUT.
      REFRESH fcode.
      IF s_inc IS INITIAL.
        APPEND 'CRTE' TO fcode.
        APPEND 'CHNG' TO fcode.
        APPEND 'DISP' TO fcode.
        APPEND 'PRNI' TO fcode.
        APPEND 'CRTL' TO fcode.
        SET PF-STATUS 'STATUS_IN' EXCLUDING fcode.
      ELSE.
        SET PF-STATUS 'STATUS_IN'.
      ENDIF.
    Though s_inc is initial, i can see all the buttons from Status 'STATUS_IN' after execution of above code. EXCLUDING statement is not taking any effect which we normally get in Module pool program.
    Please tell me what went wrong in above code?

    Problem solved ......Thanks Keshav,
    Giving code correction -->
    * SELECTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS: s_inc  RADIOBUTTON GROUP rad DEFAULT 'X'
                       USER-COMMAND inc MODIF ID mod,
                p_inc(10) MODIF ID m1,
                s_lbr  RADIOBUTTON GROUP rad,
                p_lbr(10) MODIF ID m2.
    SELECTION-SCREEN END OF BLOCK b1.
    *  AT SELECTION-SCREEN OUTPUT
    AT SELECTION-SCREEN OUTPUT.
      REFRESH fcode.
      IF s_inc IS INITIAL.
        APPEND 'CRTI' TO fcode.
        APPEND 'CHGI' TO fcode.
        APPEND 'DISI' TO fcode.
        APPEND 'DELI' TO fcode.
        APPEND 'PRNI' TO fcode.
        APPEND 'CRTL' TO fcode.
        APPEND 'DATA' TO fcode.
      ELSE.
        APPEND 'CHGL' TO fcode.
        APPEND 'DISL' TO fcode.
        APPEND 'PRNL' TO fcode.
      ENDIF.
      CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
        EXPORTING
          p_status        = 'STATUS_IN'
          P_PROGRAM       = sy-repid
        TABLES
          p_exclude       = fcode

  • 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

  • TOP-OF-PAGE During line-selection in alv report

    Hi Expart
    In intractive Alv report u using top-of-page during line-selection . If u using so u give me one example with codeing .
    Regards
    Bhabani

    Hi,
    try this code...
    *& Report  ZCS_PRG8
    REPORT  Z_SJALV__PRG8.
    TYPE-POOLS: SLIS.
    *type declaration for values from ekko
    TYPES: BEGIN OF I_EKKO,
           EBELN LIKE EKKO-EBELN,
           AEDAT LIKE EKKO-AEDAT,
           BUKRS LIKE EKKO-BUKRS,
           BSART LIKE EKKO-BSART,
           LIFNR LIKE EKKO-LIFNR,
           END OF I_EKKO.
    DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
          WA_EKKO TYPE I_EKKO.
    *type declaration for values from ekpo
    TYPES: BEGIN OF I_EKPO,
           EBELN LIKE EKPO-EBELN,
           EBELP LIKE EKPO-EBELP,
           MATNR LIKE EKPO-MATNR,
           MENGE LIKE EKPO-MENGE,
           MEINS LIKE EKPO-MEINS,
           NETPR LIKE EKPO-NETPR,
           END OF I_EKPO.
    DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
          WA_EKPO TYPE I_EKPO .
    *variable for Report ID
    DATA: V_REPID LIKE SY-REPID .
    *declaration for fieldcatalog
    DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
    declaration for events table where user comand or set PF status will
    be defined
    DATA: V_EVENTS TYPE SLIS_T_EVENT,
          WA_EVENT TYPE SLIS_ALV_EVENT.
    declartion for layout
    DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
    declaration for variant(type of display we want)
    DATA: I_VARIANT TYPE DISVARIANT,
          I_VARIANT1 TYPE DISVARIANT,
          I_SAVE(1) TYPE C.
    *PARAMETERS : p_var TYPE disvariant-variant.
    *Title displayed when the alv list is displayed
    DATA:  I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
    DATA:  I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
    INITIALIZATION.
      V_REPID = SY-REPID.
      PERFORM BUILD_FIELDCATLOG.
      PERFORM EVENT_CALL.
      PERFORM POPULATE_EVENT.
    START-OF-SELECTION.
      PERFORM DATA_RETRIEVAL.
      PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
      PERFORM DISPLAY_ALV_REPORT.
    *&      Form  BUILD_FIELDCATLOG
          Fieldcatalog has all the field details from ekko
    FORM BUILD_FIELDCATLOG.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'AEDAT'.
      WA_FIELDCAT-SELTEXT_M = 'DATE.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'LIFNR'.
      WA_FIELDCAT-NO_OUT    = 'X'.
      WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG
    *&      Form  EVENT_CALL
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_EVENTS
    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_CALL
    *&      Form  POPULATE_EVENT
         Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'USER_COMMAND'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-NAME.
      ENDIF.
    ENDFORM.                    "POPULATE_EVENT
    *&      Form  data_retrieval
      retreiving values from the database table ekko
    FORM DATA_RETRIEVAL.
      SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
    ENDFORM.                    "data_retrieval
    *&      Form  bUild_listheader
          text
         -->I_LISTHEADEtext
    FORM BUILD_LISTHEADER USING IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
      DATA HLINE TYPE SLIS_LISTHEADER.
      HLINE-INFO = 'this is my first alv pgm'.
      HLINE-TYP = 'H'.
    ENDFORM.                    "build_listheader
    *&      Form  display_alv_report
          text
    FORM DISPLAY_ALV_REPORT.
      V_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
         I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
         I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
         I_GRID_TITLE                      = I_TITLE_EKKO
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         = ALV_LAYOUT
         IT_FIELDCAT                       = I_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
        i_default                         = 'ZLAY1'
         I_SAVE                            = 'A'
        is_variant                        = i_variant
         IT_EVENTS                         = V_EVENTS
        TABLES
          T_OUTTAB                          = IT_EKKO
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "display_alv_report
    *&      Form  TOP_OF_PAGE
          text
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN '&IC1'.
          READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
          PERFORM BUILD_FIELDCATLOG_EKPO.
          PERFORM EVENT_CALL_EKPO.
          PERFORM POPULATE_EVENT_EKPO.
          PERFORM DATA_RETRIEVAL_EKPO.
          PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
          PERFORM DISPLAY_ALV_EKPO.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  BUILD_FIELDCATLOG_EKPO
          text
    FORM BUILD_FIELDCATLOG_EKPO.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELP'.
      WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MENGE'.
      WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MEINS'.
      WA_FIELDCAT-SELTEXT_M = 'UOM'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'NETPR'.
      WA_FIELDCAT-SELTEXT_M = 'PRICE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG_EKPO
    *&      Form  event_call_ekpo
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL_EKPO.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_EVENTS
    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_call_ekpo
    *&      Form  POPULATE_EVENT
           Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT_EKPO.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
      ENDFORM.                    "POPULATE_EVENT
    *&      Form  TOP_OF_PAGE
          text
    FORM F_TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    *retreiving values from the database table ekko
    FORM DATA_RETRIEVAL_EKPO.
    SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.
    ENDFORM.
    FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA: HLINE1 TYPE SLIS_LISTHEADER.
    HLINE1-TYP = 'H'.
    HLINE1-INFO = 'CHECKING PGM'.
    ENDFORM.
    FORM DISPLAY_ALV_EKPO.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = 'F_USER_COMMAND'
       I_CALLBACK_TOP_OF_PAGE            = '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_TITLE_EKPO
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
       IT_FIELDCAT                       = I_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         =
       I_SAVE                            = 'A'
      IS_VARIANT                        =
       IT_EVENTS                         = V_EVENTS
      TABLES
        T_OUTTAB                          = IT_EKPO
    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.
    reward if helpful
    regards
    Shashi

  • At user-command & At Line-selection

    Hi,
    I am using ECC5 ver. of ABAP.
    Can I use AT USER-COMMAND and AT LINE-SELECTION
    in the same report?
    I have used it but only At user command works, not At line selection.
    When I remove Set pf-Status, At line selection works.
    Here is my code.
    REPORT PF&ATLINE.
    AT LINE-SELECTION.
      MESSAGE 'Line Selected' TYPE 'I'.
    AT USER-COMMAND.
      IF sy-ucomm = 'PUSH'.
        MESSAGE 'Button Pushed' type 'I'.
      elseif sy-ucomm = 'EXIT'.
        LEAVE PROGRAM.
      ENDIF.
    START-OF-SELECTION.
      SET PF-STATUS 'ZRND3'.
      DO 10 TIMES.
        WRITE:/01 SY-INDEX HOTSPOT.
      ENDDO.
    END-OF-SELECTION.

    Hi Rajiv,
    Setting the PICK function code to F2 will definitely solve it..
    and it triggers the at user-command and at line-selection event as per user interaction...
    If it is not working properly... then there might me something wrong in your code...
    can you place the code... so that we can know the exact problem
    regards
    padma

Maybe you are looking for