At Line selection problem

hi,
iam stuck up with AT LINE-SELECTION problem ie i designed a screen where they need month list on clicking F4. i got the month list using month_names_get in the screen but while clicking the relevant month no.it's not entering into the required parameter. i have attached the codings,
MODULE MONTH_DIS OUTPUT.
  SUPPRESS DIALOG.
  LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
  SET PF-STATUS SPACE.
  NEW-PAGE NO-TITLE.
  WRITE:/ 'SELECT MONTH' COLOR COL_HEADING.
  ULINE.
  DATA: T_MNTH LIKE T247 OCCURS 12 WITH HEADER LINE.
  refresh t_mnth.
  CALL FUNCTION 'MONTH_NAMES_GET'
   EXPORTING
     LANGUAGE                    = SY-LANGU
IMPORTING
  RETURN_CODE                 =
    TABLES
      MONTH_NAMES                 = T_MNTH
   EXCEPTIONS
     MONTH_NAMES_NOT_FOUND       = 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.
  loop at t_mnth.
    write:/ t_mnth-mnr, t_mnth-ltx.
  endloop.
  CLEAR T_MNTH-MNR.
ENDMODULE.                 " MONTH_DIS  OUTPUT
AT LINE-SELECTION.
  p_period = t_mnth-mnr.
  CHECK NOT p_period IS INITIAL.
  LEAVE TO SCREEN 0.
here in the AT LINE-SELECTION, the selected month is not coming to the required parameter.
pls help me in this issue,
Thanks in advance,
Premnath.

You need to set a "Hide" after the write... I suggest you also set your own dialog PF-STATUS too so you can have just a PF2 "pick" button and a Cancel button ( this will look better to the user).
loop at t_mnth.
  write:/ t_mnth-mnr, t_mnth-ltx.
  hide: t_mnth.  "needs this
endloop.
clear: t_mnth.

Similar Messages

  • Assigning details in RSBBS using batch input (SHDB). Line selection problem

    Hello, Experts!
    While trying to use batch input by transation recording in SHDB I faced the problem of selecting line.
    The scenario was as follows:
    1. create new record in SHDB, transation "RSBBS", asynchronous, no catt, default size checked.
    2. Start recording:
    2.1 Select sender (query)
    2.2 Create receiver (java-application)
    2.3 Select line with receiver in table
    2.4 assign details
    2.5 Save
    When I got the record it contains no action for line selection and when I play the record I get the  error: "Line is not selected".
    How could I define line selection in the bdc-script manually or may be there are some other way to rich the goal - to create a pack of recivers for s sender and to assing details (in my case they are common for all recievers) for each of the reciver?
    Hope for your help.
    Best regards,
    Jozef

    There is no magic in here. The number lines that you see online may not necessarily be the same as what you get in batch. This is because, online, the SAPGUI can be formatted by the user, so the number of lines you can see can vary by the user.
    To overcome this problem, most BDC that have table controls/step-loops are done by using a feature provided within the transaction. This feature enables you to add the new line always at a constant position. In MB11, you can achieve this by pressing 'New Item' after every item. That will enable you to enter the new item always in the first line/position. So you can keep your position as 1 always.
    Instead of BDC, why don't you use BAPI_GOODSMVT_CREATE.
    If this helps, please reward and close the post.
    Thanks,
    Srinivas

  • Problem in AT LINE SELECTION event

    Hi All,
    I have a problem in AT LINE SELECTION event.
    I have an interactive report.
    In the report after selection on Selection Screen
    i have to show some totals.
    Now when I click on the no wgich is shown against the total
    the report should further drill down on the details
    like showing Order No,Material Description etc.
    Breakdown totaling qty of ASOu2019s against u2018Kit delivery areau2019 column
       = 100
    Breakdown totaling qty of ASOu2019s against u2018Kit req timeu2019 column  = 100
    Breakdown totaling qty of ASOu2019s against u2018delivered byu2019 column  
      KSINGH    1.
      BJALLOS  5.
    Breakdown totaling qty of ASOu2019s against u2018Kit req dateu2019 column
    Now my problem is that first    two breakdowns of total are constant.
    But as you can see afainst Delivered By and against Date it can be dynamic.
    In first two cases since i Knew there positioning in the screen i show them using sy-lilli.
    But how to show for other two totals.
    Please help me on this with some code example if you have.
    Thanks in Advance,
    Saket.

    hello saket,
    i m not really clear with ur problem,
    still i can tell u hide the all the fields in
    start-of-selection,that u gonna required in at line selection,
    and then u can use them to total or for displaying corresponding data.

  • 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

  • Problem in triggering at line selection event in ooabap

    hi ppl,
              Below is the code i did so far using interactive reports,but its showing error "statement END METHOD is missing".
    REPORT  y_program_on_ooabap1.
          CLASS CL DEFINITION
    DATA: lf_matnr TYPE matnr.
      INITIALIZATION.
      PARAMETERS: pa_matnr TYPE matnr.
      SELECT-OPTIONS: so_matnr FOR lf_matnr.
          CLASS cl DEFINITION
    CLASS cl DEFINITION.
      PUBLIC SECTION.
        TYPES: BEGIN OF tw,
               matnr TYPE matnr,
               ernam TYPE ernam,
               END OF tw,
               tt TYPE STANDARD TABLE OF tw.
        TYPES: BEGIN OF tw1,
               matnr TYPE matnr,
               maktx TYPE maktx,
               END OF tw1.
        DATA: itab TYPE tt,
              wa TYPE tw,
              wa1 TYPE tw1.
        METHODS: retrive_data,
                 display_data.
    ENDCLASS.                    "CL DEFINITION
          CLASS CL IMPLEMENTATION
        CLASS cl IMPLEMENTATION.
        METHOD: retrive_data.
        SELECT matnr ernam INTO TABLE itab FROM mara
        WHERE matnr IN so_matnr.
        "RETRIVE_DATA
        ENDMETHOD.                    "retrive_data
        METHOD: display_data.
        LOOP AT itab INTO wa.
        WRITE:/ wa-matnr,
                  wa-ernam.
        ENDLOOP.
        AT line-selecion.
        CASE: sy-lsind.
        WHEN 1.
        SELECT SINGLE matnr maktx INTO CORRESPONDING FIELDS OF wa FROM makt WHERE matnr = wa-matnr.
        WRITE:/ wa-matnr,
                wa-maktx.
            ENDMETHOD.                    "display_data
            "DISPLAY_DATA
          ENDCLASS.                    "CL IMPLEMENTATION
       DATA: obj TYPE REF TO cl.
       START-OF-SELECTION.
      CREATE OBJECT: obj.
      END-OF-SELECTION.
      CALL METHOD obj->retrive_data.
      CALL METHOD obj->display_data.

    hi,
    you cannot put Events in methods. instead do as call the method in the event you want like below, or create a new method and call it in the At line selection Event.
    CLASS cl IMPLEMENTATION.
    METHOD: retrive_data.
    SELECT matnr ernam INTO TABLE itab FROM mara
    WHERE matnr IN so_matnr.
    "RETRIVE_DATA
    ENDMETHOD. "retrive_data
    METHOD: display_data.
    LOOP AT itab INTO wa.
    WRITE:/ wa-matnr,
    wa-ernam.
    ENDLOOP.
    ENDMETHOD. "display_data
    METHOD: Drilldown
    SELECT SINGLE matnr maktx INTO CORRESPONDING FIELDS OF wa FROM makt WHERE matnr = wa-matnr.
    WRITE:/ wa-matnr,
    wa-maktx.
    ENDMETHOD. "Drilldown
    ENDCLASS. "CL IMPLEMENTATION
    DATA: obj TYPE REF TO cl.
    START-OF-SELECTION.
    CREATE OBJECT: obj.
    END-OF-SELECTION.
    CALL METHOD obj->retrive_data.
    CALL METHOD obj->display_data.
    AT line-selecion.
    CASE: sy-lsind.
    WHEN 1.
    CALL METHOD obj->drilldown.
    ENDCASE.
    Hope this helps you
    Raj
    Edited by: Raj on Dec 5, 2008 9:57 AM

  • 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

  • At line selection in alv report

    hi,
    i had developed a code in which at 1st execution the normal output is displayed and if i click on a purticular Itemid it displays the whole of items  and i want to display only that item's data which i had clicked on.
    following is the code which i am using for the at line-selection.
    **BEGIN - TEST CODE FOR LINE SELECTION**
    data: fld LIKE ITAB-ITEMID,
          val LIKE ITAB-ITEMID.
    at line-selection.
      get cursor field fld value val.
      IF fld = 'ITAB-ITEMID'.
            SET PARAMETER ID 'ANR' FIELD val.
            CLEAR ITAB-ITEMID.
      ENDIF.
        PERFORM PRN_SMSTOCK_ALV USING VAL.
        IF SY-SUBRC <> 0.
          MESSAGE 'NO RECORD FOUND' TYPE 'W'.
        ENDIF.
      FORM PRN_SMSTOCK_ALV USING VAL.
    *****END OF TEST CODE FOR LINE SELECTION******
    plzz help me out by providing the solution for this problem.

    Hi,
    You need to add extra piece of code as below:
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'
                I_callback_user_command = 'USER_COMMAND'   "see FORM
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
                i_save                  = 'X'
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
    *       FORM USER_COMMAND                                          *
    *       --> R_UCOMM                                                *
    *       --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    * Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
    *   Check field clicked on within ALVgrid report
        IF rs_selfield-fieldname = 'EBELN'.
    *     Read data table, using index of row user clicked on
          READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
    *     Set parameter ID for transaction screen field
          SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
    *     Sxecute transaction ME23N, and skip initial data entry screen
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDCASE.
    ENDFORM.
    "For further information please refer the link below :
    http://www.sapdev.co.uk/reporting/alv/alvgrid_ucomm.htm
    Thanks,
    Sriram Ponna.

  • DYNP_VALUES_READ Limitations for multiple lines select options

    Hi all !
       First post here, but a tough one I think. Here is my inquiry :
       I have worked on an specific abap function used in many long abap list reports. Theses reports are launched in background processing. The aim of this routine is to stop the report execution if a background job with the same selection parameters is already launched for the current user (to Prevent useless several launch of a time-expensive program).
        Because this routine is dynamic, I read the selection screen of the current report with the function 'DYNP_VALUES_READ'. And I compare the result with the variant of the backgroung job (read with function 'RS_VARIANT_CONTENTS').
        The real problem is that function "DYNP_VALUES_READ" only extract the first line of select-options. I found an alternative solution to extract the select options values (a dynamic assign with field symbols), but external conversions (for WBS elements for example ) are lost, so the comparison detects differences between the background job's variant values and the current selection screen values.
        Does anybody know a way to get entire select options values from a selection screen just as they are displayed on screen ?
    Thanks for reading my message
    Message was edited by: Thomas BRICOUT

    Thomas,
    Perhaps the following code will help you.  A function module in the code captures everything on the selection screen into an internal table.  It doesn't actually capture the information the way you want it, but I believe you will be able to work with it to achieve your desired result.  If it doesn't meet your needs, it is still useful for printing selection screen fields and their values.
    Bruce
    report zybttes2.
    tables: zf137,   " 137 General Ledger Document Details Table
            zf137a.  " 137 General Ledger Document Details Table, Archive
    selection-screen begin of block b1 with frame title text-004." BCT003
    parameters: p_zf137   radiobutton group xxx,                " BCT003
                p_zf137a  radiobutton group xxx.                " BCT003
    selection-screen end of block b1.                           " BCT003
    selection-screen begin of block parameter with frame title text-001.
    selection-screen skip 1.
    select-options: s_date for zf137-zzpostdat.
    selection-screen skip 1.
    selection-screen begin of line.
    selection-screen comment 3(6) text-002.
    selection-screen end of line.
    selection-screen skip 1.
    select-options: s_loan for zf137-zzloan.
    selection-screen skip 1.
    selection-screen begin of line.
    selection-screen comment 3(6) text-003.
    selection-screen end of line.
    selection-screen skip 1.
    select-options: s_ccentr for zf137-zzcostctr.
    selection-screen skip 1.
    selection-screen end of block parameter.
    data: ww(3) type n.
    data: zz(3) type c.
    data: c1(1) type c value '0'.
    do 2 times.
      ww = ww + 1.
      zz = ww.  shift zz left  deleting leading  c1.
      write: / zz.
    enddo.
      Capture and then print the selection screen fields and their values
    data: begin of i_info occurs 20,
            flag,
            olength type x,
            line  like raldb-infoline,
          end of i_info.
    call function 'PRINT_SELECTIONS'
      exporting
        mode      = 'TABLE'
        rname     = sy-cprog
        rvariante = sy-slset
      tables
        infotab   = i_info.
    loop at   i_info.
      write: / i_info-line.
    endloop.
    write:  / 'end'.

  • Error in at line-selection event...

    Hello experts,
    In my report, I am hiding the values of BUKRS, ANLN1 and ANLN2 during my loop.
    I am using field symbols as my work area for my itab which is it_output. The problem
    is, when I try to do this in my at line-selection event:
    at line-selection.
    data: cursorfield(20) type c.
        get cursor field cursorfield.
        case cursorfield.
         when '<FS_OUTPUT>-ASSET_SUBNUM'.
         SET PARAMETER ID 'BUK' FIELD <FS_OUTPUT>-bukrs.
         SET PARAMETER ID 'AN1' FIELD <FS_OUTPUT>-asset.
         SET PARAMETER ID 'AN2' FIELD <FS_OUTPUT>-anln2.
        endcase.
    It says that it can't recognize the fields. What am I doing wrong? By the way, I am using
    ABAP Objects in my report. Help would be greatly appreciated. Thanks again guys and take care!

    Hi Viraylab,
    Have you assigned the fieldsymbols ?
    ASSIGN IT_OUTPUT to <FS_OUTPUT>.
    Cheers
    VJ
    Message was edited by: Vijayendra  Rao

  • 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

  • At line-selection in SAP Query ( Infoset ) code

    Hi all ,
    Here is one for you :  can I put somehow the following code in a Sap Query ( at infoset level of course ) :
       at line-selection.
      set parameter id 'BUK' field XXX-bukrs.
      set parameter id 'BLN' field XXX-belnr.
      set parameter id 'GJR' field XXX-gjahr.
      call transaction 'FB03' and skip first screen.
    (In other words I would like to see the documents behind a line in the list)
    Some explains : my query's output would be ABAP list , the bukrs, belnr, gjahr fields are on the lines of my resulting list, and my problem is with those XXX 's - I don't know where are stored the lines of my ABAP list.
    I'm pretty new at ABAP so any idea and explains about the generated SAP Query code
    is appreciated . I looked at the final code but seemed very complex for my level.
    Please guide me in this area ( I know the basic things like writing pretty simple reports )
    Thanks !
    Best of all
    Zoli

    Hi,
    You need to add extra piece of code as below:
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'
                I_callback_user_command = 'USER_COMMAND'   "see FORM
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
                i_save                  = 'X'
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
    *       FORM USER_COMMAND                                          *
    *       --> R_UCOMM                                                *
    *       --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    * Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
    *   Check field clicked on within ALVgrid report
        IF rs_selfield-fieldname = 'EBELN'.
    *     Read data table, using index of row user clicked on
          READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
    *     Set parameter ID for transaction screen field
          SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
    *     Sxecute transaction ME23N, and skip initial data entry screen
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDCASE.
    ENDFORM.
    "For further information please refer the link below :
    http://www.sapdev.co.uk/reporting/alv/alvgrid_ucomm.htm
    Thanks,
    Sriram Ponna.

  • Need help AT LINE SELECTION

    Hi Guys,
    I need ur help regarding my coding: AT LINE SELECTION.
    Here is my codes, but it is not working.
    AT LINE-SELECTION.
    IF ( wa_list-auart = 'ZCS' AND wa_list-auart = 'ZSA' ).
        IF NOT wa_list-sonum IS INITIAL.
          SET PARAMETER ID 'AUN' FIELD wa_list-sonum.
          CALL TRANSACTION 'VF01' AND SKIP FIRST SCREEN.
          CLEAR wa_list-sonum.
        ENDIF.
      ELSE.
        IF NOT wa_list-drnum IS INITIAL.
          SET PARAMETER ID 'AUN' FIELD wa_list-drnum.
          CALL TRANSACTION 'VF01' AND SKIP FIRST SCREEN.
          CLEAR wa_list-drnum.
        ENDIF.
      ENDIF.
    The requirements are:
    1. Data selection on column ‘Item’ + Magnifying Glass Icon click will direct user to transaction code VF01 ====>><b>its working,  but the problem is when i click the line item no 1, it wasnt work. Line item no 1 only but the rest items its workin.</b>
    2. Sales Order No (VBAK-VBELN) – will be the default value on document column of VF01 if Sales Order Type (VBAK-AUART) = ZCS or ZSA else Delivery No (LIKP-VBELN) will be the default value on document column of VF01. ===><b>the problem is when i click the line item, there is no default Sales Order No or Delivery NO on parameter 'AUN' <Document column> based on if statement.</b>
    3. Warning Message ‘Select a line item to proceed.’  will be displayed if no line item selected on  magnifying glass icon click. ===> <b>help me on how to codes this one if i click to a non line item, there should be a Warning Message ‘Select a line item to proceed.’</b>
    Thanks in advance.
    zhien.

    hi joycee
    i think one of the command written by u
    :-"IF NOT wa_list-sonum IS INITIAL."
    shoud be written like
    :- IF wa_list-sonum IS NOT INITIAL.

  • "AT LINE-SELECTION" event in a Query (SQ01 or SQ02)

    Hi there
    I want to know if it's possible to put "AT LINE-SELECTION" event in an ABAP Query? I'm trying that in SQ02 - the infoset - but nothing happens when I double-click on the output lines. I cannot find any place to type codes in SQ01.
    The purpose is to call a transaction VA03 when people double-click on the output field "sales order number" and here is the code I put in "Free coding" section of SQ02.
    AT LINE-SELECTION.
      DATA: w_cucol TYPE sy-cucol.
      w_cucol = sy-cucol + sy-staco.
      w_cucol = w_cucol - 2.
      IF w_cucol BETWEEN 103 AND 119.
        SET PARAMETER ID 'AUN' FIELD vbkd-vbeln.
        CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
      ENDIF.
    yu

    Hi ,
    You must create infoset based on join VBKD with VBAK and LIPS.
    Also you must put VBAK-VBELN and LIPS-VBELN as a column output.
    There is no problem to use 2 report assignment ( there is no loss ).
    There is no necessity to use " some ABAP code at line-selection ".
    This works.
    By the way is more correct from the beginning to formulate the issue including all the data about your problem and not include them by adding a little at a time.
    Regards.

  • Unable to double click after using at line-selection

    hi all...
    unable to double click after using at line-selection. But if i comment set pf-status, i can double click on the line but on first double click everytime i just get last record i.e. 200th and after second double click i'm not getting output. what is the problem? plz reply...
    REPORT  YP2 line-count 10(2).
    tables: lfa1, LFB1.
    data: itab like lfa1 occurs 0 with header line,
          JTAB LIKE LFB1 OCCURS 0 WITH HEADER LINE.
    SELECT-OPTIONS: vendor_n for lfa1-lifnr.
    *SET PF-STATUS 'MENU'.
    INITIALIZATION.
    vendor_n-low = '1'.
    vendor_n-high = '200'.
    vendor_n-option = 'BT'.
    APPEND vendor_n.
    clear vendor_n.
    At selection-screen.
    IF VENDOR_N-LOW < 1.
    MESSAGE w000(sabapdocu).
    clear vendor_n.
    ELSEIF vendor_n-HIGH > 200.
    MESSAGE S001(sabapdocu).
    ENDIF.
    START-OF-SELECTION.
    SELECT * FROM lfa1 INTO TABLE ITAB WHERE lifnr IN vendor_n.
    WRITE:5 SY-ULINE(72).
    LOOP AT ITAB.
    WRITE: /5 SY-VLINE,9 ITAB-lifnr,20 SY-VLINE, 22 ITAB-name1,58 SY-VLINE, 60 ITAB-telf1, 76 SY-VLINE.
    ENDLOOP.
    top-of-page.
    WRITE:/5 SY-ULINE(72).
    WRITE: /5 SY-VLINE, 'Vendor_code', 20 SY-VLINE, 28 'Name' ,58 SY-VLINE, 60 'Phone', 76 SY-VLINE.
    WRITE:/5 SY-ULINE(72).
    end-of-page.
    WRITE:5 SY-ULINE(72).
    WRITE:/ 'THE PAGE NO IS',SY-PAGNO.
    WRITE:/5 SY-ULINE(72).
    END-OF-SELECTION.
    WRITE: /5 sy-uline(72),/ 'THE RECORD IS CLOSED'.
    AT LINE-SELECTION.
    IF SY-LSIND = 1.
    SELECT * FROM  LFA1 INTO TABLE ITAB WHERE LIFNR = ITAB-LIFNR.
    LOOP AT ITAB.
    WRITE: /5 SY-VLINE,9 ITAB-lifnr,20 SY-VLINE, 22 ITAB-name1,58 SY-VLINE, 60 ITAB-telf1, 76 SY-VLINE.
    ENDLOOP.
    WRITE:/5 SY-ULINE(72).
    ELSEIF SY-LSIND = 2.
    WRITE:/5 SY-VLINE,6 'Vendor No.',17 SY-VLINE,18 'Company code',28 SY-VLINE, 29 'Created by',39 SY-VLINE.
    SELECT * FROM LFB1 INTO TABLE JTAB WHERE LIFNR = JTAB-LIFNR.
    LOOP AT JTAB.
    WRITE:/5 SY-VLINE,6 JTAB-LIFNR,17 SY-VLINE,18 JTAB-BUKRS,28 SY-VLINE, 29 JTAB-ERNAM,39 SY-VLINE.
    ENDLOOP.
    WRITE:/5 SY-ULINE(72).
    ENDIF.
    AT PF7.
    IF SY-LSIND = 1.
    SELECT * FROM  LFA1 INTO TABLE ITAB WHERE LIFNR = ITAB-LIFNR.
    LOOP AT ITAB.
    WRITE: /5 SY-VLINE,9 ITAB-lifnr,20 SY-VLINE, 22 ITAB-name1,58 SY-VLINE, 60 ITAB-telf1, 76 SY-VLINE.
    ENDLOOP.
    WRITE:/5 SY-ULINE(72).
    ELSEIF SY-LSIND = 2.
    SELECT * FROM LFB1 INTO TABLE JTAB WHERE LIFNR = JTAB-LIFNR.
    LOOP AT JTAB.
    WRITE:/5 SY-VLINE,6 JTAB-LIFNR,17 SY-VLINE,18 JTAB-BUKRS,28 SY-VLINE, 29 JTAB-ERNAM,39 SY-VLINE.
    ENDLOOP.
    WRITE:/5 SY-ULINE(72).
    ENDIF.
    AT USER-COMMAND.
    IF SY-UCOMM = '0001'.
    IF SY-LSIND = 1.
    SELECT * FROM  LFA1 INTO TABLE ITAB WHERE LIFNR = ITAB-LIFNR.
    LOOP AT ITAB.
    WRITE: /5 SY-VLINE,9 ITAB-lifnr,20 SY-VLINE, 22 ITAB-name1,58 SY-VLINE, 60 ITAB-telf1, 76 SY-VLINE.
    ENDLOOP.
    WRITE:/5 SY-ULINE(72).
    ELSEIF SY-LSIND = 2.
    SELECT * FROM LFB1 INTO TABLE JTAB WHERE LIFNR = JTAB-LIFNR.
    LOOP AT JTAB.
    WRITE:/5 SY-VLINE,6 JTAB-LIFNR,17 SY-VLINE,18 JTAB-BUKRS,28 SY-VLINE, 29 JTAB-ERNAM,39 SY-VLINE.
    ENDLOOP.
    WRITE:/5 SY-ULINE(72).
    ENDIF.
    ENDIF.

    Hi,
    copy and paste the code given below it works....
    START-OF-SELECTION.
    SELECT * FROM lfa1 INTO TABLE ITAB WHERE lifnr IN vendor_n.
    WRITE:5 SY-ULINE(72).
    LOOP AT ITAB.
    WRITE: /5 SY-VLINE,9 ITAB-lifnr,20 SY-VLINE, 22 ITAB-name1,58 SY-VLINE, 60 ITAB-telf1, 76 SY-VLINE.
    hide : itab-lifnr.
    ENDLOOP.
    clear itab.
    top-of-page.
    WRITE:/5 SY-ULINE(72).
    WRITE: /5 SY-VLINE, 'Vendor_code', 20 SY-VLINE, 28 'Name' ,58 SY-VLINE, 60 'Phone', 76 SY-VLINE.
    WRITE:/5 SY-ULINE(72).
    end-of-page.
    WRITE:5 SY-ULINE(72).
    WRITE:/ 'THE PAGE NO IS',SY-PAGNO.
    WRITE:/5 SY-ULINE(72).
    END-OF-SELECTION.
    WRITE: /5 sy-uline(72),/ 'THE RECORD IS CLOSED'.
    AT LINE-SELECTION.
    IF itab-lifnr is not initial.
    IF SY-LSIND = 1.
    SELECT * FROM  LFA1 INTO TABLE ITAB WHERE LIFNR = ITAB-LIFNR.
    LOOP AT ITAB.
    WRITE: /5 SY-VLINE,9 ITAB-lifnr,20 SY-VLINE, 22 ITAB-name1,58 SY-VLINE, 60 ITAB-telf1, 76 SY-VLINE.
    HIDE ITAB-LIFNR.
    ENDLOOP.
    CLEAR ITAB.
    WRITE:/5 SY-ULINE(72).
    ELSEIF SY-LSIND = 2.
    WRITE:/5 SY-VLINE,6 'Vendor No.',17 SY-VLINE,18 'Company code',28 SY-VLINE, 29 'Created by',39 SY-VLINE.
    SELECT * FROM LFB1 INTO TABLE JTAB WHERE LIFNR = ITAB-LIFNR.
    LOOP AT JTAB.
    WRITE:/5 SY-VLINE,6 JTAB-LIFNR,17 SY-VLINE,18 JTAB-BUKRS,28 SY-VLINE, 29 JTAB-ERNAM,39 SY-VLINE.
    ENDLOOP.
    CLEAR ITAB.
    WRITE:/5 SY-ULINE(72).
    ENDIF.
    ENDIF.
    AT PF7.
    IF itab-lifnr is not initial.
    IF SY-LSIND = 1.
    SELECT * FROM  LFA1 INTO TABLE ITAB WHERE LIFNR = ITAB-LIFNR.
    LOOP AT ITAB.
    WRITE: /5 SY-VLINE,9 ITAB-lifnr,20 SY-VLINE, 22 ITAB-name1,58 SY-VLINE, 60 ITAB-telf1, 76 SY-VLINE.
    HIDE ITAB-LIFNR.
    ENDLOOP.
    CLEAR ITAB.
    WRITE:/5 SY-ULINE(72).
    ELSEIF SY-LSIND = 2.
    SELECT * FROM LFB1 INTO TABLE JTAB WHERE LIFNR = JTAB-LIFNR.
    LOOP AT JTAB.
    WRITE:/5 SY-VLINE,6 JTAB-LIFNR,17 SY-VLINE,18 JTAB-BUKRS,28 SY-VLINE, 29 JTAB-ERNAM,39 SY-VLINE.
    ENDLOOP.
    CLEAR ITAB.
    WRITE:/5 SY-ULINE(72).
    ENDIF.
    ENDIF.
    AT USER-COMMAND.
    IF SY-UCOMM = '0001' and itab-lifnr is not initial.
    IF SY-LSIND = 1.
    SELECT * FROM  LFA1 INTO TABLE ITAB WHERE LIFNR = ITAB-LIFNR.
    LOOP AT ITAB.
    WRITE: /5 SY-VLINE,9 ITAB-lifnr,20 SY-VLINE, 22 ITAB-name1,58 SY-VLINE, 60 ITAB-telf1, 76 SY-VLINE.
    HIDE ITAB-LIFNR.
    ENDLOOP.
    clear ITAB.
    WRITE:/5 SY-ULINE(72).
    ELSEIF SY-LSIND = 2.
    SELECT * FROM LFB1 INTO TABLE JTAB WHERE LIFNR = JTAB-LIFNR.
    LOOP AT JTAB.
    WRITE:/5 SY-VLINE,6 JTAB-LIFNR,17 SY-VLINE,18 JTAB-BUKRS,28 SY-VLINE, 29 JTAB-ERNAM,39 SY-VLINE.
    ENDLOOP.
    CLEAR ITAB.
    WRITE:/5 SY-ULINE(72).
    ENDIF.
    ENDIF.
    Regards,
    Siddarth

  • Table control: Line selection single issue

    Hi experts,
    I have created a table control and in the screen painter I have defined the line selection as "Single" for table control.
    The table control can display upto 20 lines in a screen and i can select a single record only which pertains to my requirement. if I try to select two records it will not allow.
    Issue: consider  i select a single record from the first 20 lines displayed in screen, then i scroll the records in the table control so that it displays the records from 21 to 40. if I select a single record now from line 21 to 40, the first record that i selected is not getting deselected. That is, totally two lines are getting selected.
    How to overcome this issue
    Thanks in advance
    Regards
    Anand

    Ok
    The "problem" is here:
    Types: Begin of ty_ic,
      ic(20),
      desc(20),
      sel(1)                                 <--------------------------------
    End of ty_ic.
    You've ha a field for selected line and that field is used in table control definition as you've written:
    "Note: wa_ic is the structure used in table control and wa_ic-sel is the mark field defined the table control attributes"
    So you're using the structure WA_IC as header line of internal table IT_IC and also as input/put field of your table control (I mean the screen fields of table control are based on WA_IC).
    You don't need any code in PBO to move the data from internal table to table control, because the headerline of IT_IC and field of table control are the same, infact you've implemented only the code in PAI to save the data from table control to IT_IC:
    Loop at it_ic.
    Modify it_ic from wa_ic index tc_ic-current_line
    Endloop
    t's a good solution if it needs to transfer all data to table control automatically: it doesn't need any code in PBO
    but, of course, there'll be a problem when you don't need to display something, in this case you have to think a solution, I mean you have to write a code in order to avoid to display those data.
    It's the case of the selected line: in your situation all selected lines keep the selection, because the code to clear IT_IC-SEL is missing: only the user can deselect a line, but if he doesn't do it, the line will remain selected after navigation.
    So you make to be sure to clear all selected lines are not displayed.
    You need to create a code in PAI out of the loop of table control where you clear the flag SEL, in order to do it you need to consider:
    - The index of the first record displayed in table control is stored in field TC_IC-TOP_LINE
    - The index of the last record displayed in table control can be calculated: the variable SY-LOOPC indicates how many rows can be displayed in table control, so the last record will be: TC_IC-TOP_LINE + SY-LOOPC.
    So you need to clear the field SEL for all records not displayed, a code like this:
    PROCESS PAI.
      LOOP AT IT_IC.
         MODULE GET_LOOPC.
      ENDLOOP.
      MODULE CLEAR_SEL.
      MODULE GET_LOOPC..
          TOT_LINE_DISPLAYED = SY-LOOPC.
      ENDMODULE
      MODULE CLEAR_SEL.
    * Here you need to clear the selection of the records before of TOP_LINE
           IF TC_IC-TOP_LINE > 1.
              LOOP AT IT_IC INTO WA_IC  TO TC_IC-TOP_LINE.
                 CLEAR WA_IC-SEL.
                 MODIFY IT_IC FROM WA_IC.
              ENDLOOP.
         ENDIF.
    * Here you need to clear the selection of the records after the last one:
          LAST_INDEX = TOT_LINE_DISPLAYED + TC_IC-TOP_LINE.
         DESCRIBE TABLE IT_IC LINES SY-TABIX,
         IF SY-TABIX > LAST_INDEX.
              LOOP AT IT_IC INTO WA_IC  FROM LAST_INDEX.
                 CLEAR WA_IC-SEL.
                 MODIFY IT_IC FROM WA_IC.
              ENDLOOP.
         ENDIF.
      ENDMODULE.

Maybe you are looking for