Screen navigation in alv

Hi all,
Ihave a requirement where i am deleting entries from the database table from report(alv grid output) output by selecting required rows
Here after selecting and deletion  there are two things i have to check ,they are:
1) After deletion of entries from database when i press refresh button i need to get updated alv display
2)When i press back button control should go to the selection screen comtrol
For first question I have used a logic where after deletion and when refresh button is pressed i am calling the alv grid display function module again actually the the subroutine (perform grids display) is being calledso after this i have added the logic for back button but when i press back button the control moves to selection screen and when i again press back button control goes to report output display instead of program editor screen
pls give some inputs ASAP
Thakyou,
Karthik

Hi Karthik,
Try this code as my requirement was same.....
  WHEN 'DELETE'.
   PERFORM delete_item .
FORM delete_item .
  DATA: lt_rows TYPE lvc_t_row,
        lt_index TYPE  lvc_s_row-index,
        l_id TYPE sy-repid.
(this is a code if u want to delete multiple entries at one go)
CALL METHOD g_grid->get_selected_rows
      IMPORTING
        et_index_rows = lt_rows.
LOOP AT lt_rows INTO lt_index.
     DELETE it_final_bom index lt_index.(delete record from  the  internal table)
ENDLOOP.
Update database table from internal table.
ENDFORM.
After this u just need to call one method for refreshing table display.......
CALL METHOD g_grid->refresh_table_display.
Now for the second requirement u just have to track Sy-ucomm
DATA: ok_save LIKE sy-ucomm.
  ok_save = ok_code.
Clear sy-ucomm.
  CASE ok_code.
    WHEN 'BACK'.
  put ur code here......
Thanks & Regards
Ruchi Tiwari
Edited by: Ruchi Tiwari on Nov 2, 2008 4:13 PM

Similar Messages

  • Going back to earlier screen (navigation) in ALV interactive screen

    Hi all,
    I have requirement of going to 4th alv screen on clicking back on screen 5.(all 5 screens are ALV).But it comes out to selection screen instea going to screen 4(ALV).Please guide me for the same.
    Thank you.
    Edited by: sanu debu on Mar 29, 2009 10:51 AM
    Edited by: sanu debu on Mar 29, 2009 10:53 AM

    Hi ,
    use it this way....
    firstly set flag for each screen when you dislpay them say for the first screen you set the flag = 1 and for second u set it to 2 and so on.... then in the call function use as used below... important user_command to be passed
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = sy-cprog
    i_callback_user_command = 'USER_COMMAND'        " this is the subroutine of your program where you control the navigations....
    i_callback_pf_status_set = 'PF_STATUS'
    it_fieldcat = it_field
    TABLES
    t_outtab = i_final
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    FORM USER_command using rs_ucomm type sy-ucomm rs_selfield type slis-selfield.
       case rs_ucomm.
         when 'BACK' or 'RW' or '%EX'.
               if flag = 5.
                   flag = 4.
    "               call the subroutine which displays the fourth ALV screen or  call the FM reuse with the table used in fourth screen.
              elseif flag = 4.
                 flag = 3.
    "               call the subroutine which displays the third ALV screen or  call the FM reuse with the table used in third screen.
              elseif flag = 3.
                 flag = 2.
    "               call the subroutine which displays the second ALV screen or  call the FM reuse with the table used in second screen.
              elseif flag = 2.
                 flag = 1.
    "               call the subroutine which displays the first ALV screen or  call the FM reuse with the table used in first screen.
              elseif flag = 1.
    leave to screen 0.
       endcase.
    endform.
    Hope this resolves the issue
    Regards,
    Siddarth

  • Print Selection Screen Parameters in ALV report only once

    Does anyone know how to print the selection screen within a ALV report.
    I've tried everything. I have the code to capture the selection parameters into a internal table. I can use top_of_page but I only want it printed once.

    Hi,
      If you have captured the selection screen entries in an internal table, then you could display it once by using the BLOCK LIST ALV.
    Check the function module.
    REUSE_ALV_BLOCK_LIST_DISPLAY
    Using this function module more than 1 alv could be display in the report.
    In our case ..there will be two alvs ...one for the selection screen n other for the main report output.
    Check the following example on the block List ALV....
    <b>BALVBT01</b>.
    Regards,
    Vara

  • Screen Text in ALV selection screen

    A user has asked me to add some text at the bottom of a selection screen in an ALV report program. In se80 I double clicked the screen (1000) and then went into the layout and added a text field with some text in it. The system then requested a transport and added a LIMU DYNP screen object to it. The only other object in the transport is the Report Source Code.
    When I run the transport to another system the new text fields disappear from the screen object although double clicking the screen object in the transport shows they are there.
    Any ideas why they disappear??

    I have tried selection-screen comment but there appears to be a limit to the size of the text string (83) and this is not long enough for our purpose as the next needs to go right accross the page. Thanks for replying.

  • Change Layout in Selection Screen for OO ALV-Grid

    Hello everyone,
    I got a problem regarding layouts for objectoriented ALV Grid. I want to make it possible that user can take the layout for ALV he wants to on the selection screen. So far thats no problem and it works. But there are some little problems which I do not know how to fix them. But first the facts:
    (1) I got my parameter for layout
    PARAMETER: p_vari  TYPE disvariant-variant.
    (2) I fill my global layout structure in initialization
    INITIALIZATION.
    * Variante vorbelegen
       gs_variant-username = sy-uname.
       gs_variant-report   = sy-repid.
    * Layout holen
       CALL FUNCTION 'LVC_VARIANT_DEFAULT_GET'
         EXPORTING
           i_save        = 'A'
         CHANGING
           cs_variant    = gs_variant
         EXCEPTIONS
           wrong_input   = 1
           not_found     = 2
           program_error = 3
           OTHERS        = 4.
       IF sy-subrc = 0.
         p_vari = gs_variant-variant.
       ENDIF.
    (3) I got my handling for F4-value help on variant parameter
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
       CALL FUNCTION 'LVC_VARIANT_F4'
         EXPORTING
           is_variant    = gs_variant
           i_save        = 'A'
         IMPORTING
           es_variant    = gs_variant
         EXCEPTIONS
           not_found     = 1
           program_error = 2
           OTHERS        = 3.
       IF sy-subrc <> 0.
         MESSAGE text-m01 TYPE 'S'.
       ELSE.
         p_vari = gs_variant-variant.
       ENDIF.
    (4) I give back my parameters content into the variant structure at start of selection
    START-OF-SELECTION.
       gs_variant-username = sy-uname.
       gs_variant-report   = sy-repid.
       gs_variant-variant  = p_vari.
    This works all fine but I got some problems when using default variants/layouts. For example I got a default variant only for me. When starting the selection screen it works fine that the default layout was written. It is displayed automatically in the variant parameter. But I want that if i I empty the content (blank it out) from my variant parameter, that report should start with "normal" layout how it was written in the report and NOT with default layout.
    When I clear the gs_variant it works like I want it, but then the alv layout button looks like (without functions for layout), because I do not have the reference to my report.
    So what to do? :-)
    Regards
    Michael

    Wow that was fast, works great, thanks :-)
    I did not use this parameter in set table method but now I fill it dynamically.
    Ok next problem, one step harder ;-)
    Now I have one selection screen for one ALV-Grid, but four radio buttons which control with which data the ALV gets filled (four different fieldcats, data tables and so on). Each Grid got an own HANDLE so that the layouts can be separated in four categories.
    Now I want that by changing the radio button the individual standard layout for the chosen alv grid is getting filled.
    This works fine when using it in selection screen output.
    AT SELECTION-SCREEN OUTPUT.
       CLEAR gs_variant.
    * Layout-Handles individuell für Klausel-Radiobuttons setzen
       IF     p_py IS NOT INITIAL.
         gs_variant-username = sy-uname.
         gs_variant-report   = sy-repid.
         gs_variant-handle   = 'KLPY'.
       ELSEIF p_rh IS NOT INITIAL.
         gs_variant-username = sy-uname.
         gs_variant-report   = sy-repid.
         gs_variant-handle   = 'KLRH'.
       ELSEIF p_aj IS NOT INITIAL.
         gs_variant-username = sy-uname.
         gs_variant-report   = sy-repid.
         gs_variant-handle   = 'KLAJ'.
       ELSEIF p_sr IS NOT INITIAL.
         gs_variant-username = sy-uname.
         gs_variant-report   = sy-repid.
         gs_variant-handle   = 'KLSR'.
       ENDIF.
    * Layout holen
       CALL FUNCTION 'LVC_VARIANT_DEFAULT_GET'
         EXPORTING
           i_save        = 'A'
         CHANGING
           cs_variant    = gs_variant
         EXCEPTIONS
           wrong_input   = 1
           not_found     = 2
           program_error = 3
           OTHERS        = 4.
       IF sy-subrc = 0.
         p_vari = gs_variant-variant.
       ELSE.
         CLEAR p_vari.
       ENDIF.
    But unfortunately selection screen output is getting passed by EACH changing in the selection screen. This means when I try to clear the default layout in my parameter field, it gets refilled automatically with default layout. If I do a condition around the filling (only if not initial) the default value filling does not work fine in every case, e.g. when clearing the parameters field and then change the radiobutton -> then it does not get filled automatically.

  • Pass selection screen value to ALV

    Hi
    I need to pass selection screen values to ALV top of page. How to do this?

    Hi,
    Have a look on the following example.
    TYPE-POOLS: SLIS.
    TABLES: LFA1.
    SELECT-OPTIONS: LIFNR FOR LFA1-LIFNR.
    DATA:  BEGIN OF ITAB OCCURS 0,
           LIFNR LIKE LFA1-LIFNR,
           NAME1 LIKE LFA1-NAME1,
           ORT01 LIKE LFA1-ORT01,
           LAND1 LIKE LFA1-LAND1,
           REGIO LIKE LFA1-REGIO,
           END OF ITAB.
    SELECT * FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE ITAB UP TO 5 ROWS.
    DATA:  LAYOUT TYPE SLIS_LAYOUT_ALV,
           HEADER TYPE SLIS_T_LISTHEADER WITH HEADER LINE,
           FLDCAT TYPE SLIS_T_FIELDCAT_ALV.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = SY-REPID
       I_INTERNAL_TABNAME           = 'ITAB'
      I_STRUCTURE_NAME             = ITAB
      I_CLIENT_NEVER_DISPLAY       = 'X'
       I_INCLNAME                   = SY-REPID
      I_BYPASSING_BUFFER           =
      I_BUFFER_ACTIVE              =
      CHANGING
        CT_FIELDCAT                  = FLDCAT
    EXCEPTIONS
      INCONSISTENT_INTERFACE       = 1
      PROGRAM_ERROR                = 2
      OTHERS                       = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    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            = '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                         =
       IT_FIELDCAT                       = FLDCAT
      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                          = ITAB
    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.
    DATA: S(10).
    S = 'TO'.
    FORM TOP-OF-PAGE.
    HEADER-TYP = 'S'.
    HEADER-KEY = 'LIFNR'.
    CONCATENATE LIFNR-LOW LIFNR-HIGH INTO HEADER-INFO SEPARATED BY SPACE.
    APPEND HEADER.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = HEADER[]
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    ENDFORM.
    Reward,if useful.
    Thanks,
    Chandu

  • Screen Navigation

    Hi All,
    I am maintaining an SAP application.  In addition, I am new to SAP/ABAP.  Is there a built in mechanism that tracks the previous screen that you were on so that you can get back to the previous screen.  I see that most of the code is using memory parms and CASE to handle screen navigation; however, since I recently was required to skip a screen (out of the normal screen flow) this issue has risen.  If I skip one of these screens, we will call it screen 2 and I end up at screen 3 from screen 1.  Then from screen 3 I go to screen 4.  How can I get back to screen 3 then screen 1.  My code currently works as long as I do not go to screen 4 from screen 3.  In other words, if I never go to screen for and I click the 'BACK' button I successfully get back to screen 1, skipping screen 2 just as I did going forward; that is what I want.  It seems to be very convoluted to create all these memory variable to track screen navigation.  Is there a built in function that manages screen navigation so that it can be as simple as setting the screen name before you leave a screen and calling some kind of previous command to get you back to the previous screen.
    Thanks
    Tom

    I finally figured it out.  Thanks anyway.

  • HomeDock issues-on screen navigation

    I installed a DLO HomeDock Deluxe. This allows me to use on-screen navigation of the iPod. It worked for a couple days and now everytime I go to the On-Screen mode it will not play thru the TV--instead it bouces from the iPod menu to a "checkmark" saying it is OK to disconnect----it yeilds no on screen navigation features. I took the DLO back to the store, thinking it was defective and obtained a new one. The same thing happens to the new one--so it is something in the iPod settings. Anyone have any ideas?

    I've had the same problem. It seemed to start when the iPod was updated to the 1.2 software level. I had to reset everything (pull the power on the Homedock) and got it to almost work. It stopped the checkmark screen looping on the iPod and does show the TV screen, but it will only show the 1st song I play, doesn't update the time bar, nor change when the song changes.
    I emailed DLO about it, they had nothing useful. They apparently do not provide a way to update the HomeDock software (the USB connection is straight to the iPod) and only suggested I reset the iPod. Tried that, no joy.
    This kind of defeats one of the main features of the HomeDock.

  • Navigation from ALV  Record to Tcode

    Hello All,
    I have  a requirement like this,
    My zPROGARM is displaying one ALV output. When an user select one record/cell
    it has to navigate to particular Tcode  .
    Is it Possible?
    Kindly advice me on this.
    Thankyou,
    Ram.

    HI...,,
    Check this program...
    REPORT  YH627_PO_CHANGES_SOX_REPORTING MESSAGE-ID M8.
    *"Table declarations...................................................
    TABLES:
      EKKO,                                " Purchasing Document Header
      CDHDR,                               " Change document header
      SSCRFIELDS.                          " Fields on selection screens
    *"Selection screen elements............................................
    SELECT-OPTIONS:
      S_EBELN FOR EKKO-EBELN,              " Purchasing Document Number
      S_LIFNR FOR EKKO-LIFNR,              " Vendor's account number
      S_EKGRP FOR EKKO-EKGRP,              " Purchasing group
      S_BEDAT FOR EKKO-BEDAT,              " Purchasing Document Date
      S_UDATE FOR CDHDR-UDATE.             " Creation date of the change
                                           " document
    *" Data declarations...................................................
    Field String to hold Purchase Document Number                       *
    DATA:
      BEGIN OF FS_EBELN,
        EBELN(90) TYPE C,                  " Purchase Document Number
        ERNAM     TYPE EKKO-ERNAM,         " Name of Person who Created
                                           " the Object
        LIFNR     TYPE EKKO-LIFNR,         " Vendor's account number
        EKGRP     TYPE EKKO-EKGRP,         " Purchasing group
        BEDAT     TYPE EKKO-BEDAT,         " Purchasing Document Date
      END OF FS_EBELN,
    Internal table to hold Purchase Document Number                     *
      T_EBELN LIKE STANDARD TABLE
                OF FS_EBELN.
    Field String to hold Purchase Document Header                       *
    DATA:
      BEGIN OF FS_EKKO,
        EBELN TYPE EKKO-EBELN,             " Purchasing Document Number
        ERNAM TYPE EKKO-ERNAM,             " Name of Person who Created the
                                           " Object
        LIFNR TYPE EKKO-LIFNR,             " Vendor's account number
        EKGRP TYPE EKKO-EKGRP,             " Purchasing group
        BEDAT TYPE EKKO-BEDAT,             " Purchasing Document Date
      END OF FS_EKKO,
    Internal table to hold Purchase Document Header                     *
    T_EKKO LIKE STANDARD TABLE
              OF FS_EKKO.
    Field String to hold Account Number and name of the Vendor          *
    DATA:
      BEGIN OF FS_LFA1,
        LIFNR TYPE LFA1-LIFNR,             " Account Number of Vendor
        NAME1 TYPE LFA1-NAME1,             " Name1
      END OF FS_LFA1,
    Internal table to hold Account number and Name of the Vendor        *
      T_LFA1 LIKE STANDARD TABLE
               OF FS_LFA1.
    Field String to hold Change date and the name of the user           *
    DATA:
      BEGIN OF FS_CDHDR,
        OBJECTCLAS TYPE CDHDR-OBJECTCLAS,  " Object Class
        OBJECTID   TYPE CDHDR-OBJECTID,    " Object value
        CHANGENR   TYPE CDHDR-CHANGENR,    " Document change number
        USERNAME   TYPE CDHDR-USERNAME,    " User name
        UDATE      TYPE CDHDR-UDATE,       " Creation date of the change
                                           " document
      END OF FS_CDHDR,
    Internal Table to hold Change date and the name of the user         *
      T_CDHDR LIKE STANDARD TABLE
                OF FS_CDHDR.
    Field String to hold Change document items                          *
    DATA:
      BEGIN OF FS_CDPOS,
        OBJECTCLAS   TYPE CDPOS-OBJECTCLAS," Object class
        OBJECTID(10) TYPE C,               " Object Value
        CHANGENR     TYPE CDPOS-CHANGENR,  " Document change number
        TABNAME      TYPE CDPOS-TABNAME,   " Table Name
        FNAME        TYPE CDPOS-FNAME,     " Field Name
        VALUE_NEW    TYPE CDPOS-VALUE_NEW, " New contents of changed field
        VALUE_OLD    TYPE CDPOS-VALUE_OLD, " Old contents of changed field
      END OF FS_CDPOS,
    Internal Table to hold Change document items                        *
      T_CDPOS LIKE STANDARD TABLE
                OF FS_CDPOS.
    Field String to hold Date Element Name                              *
    DATA:
      BEGIN OF FS_DATAELE,
        TABNAME   TYPE DD03L-TABNAME,      " Table Name
        FIELDNAME TYPE DD03L-FIELDNAME,    " Field Name
        ROLLNAME  TYPE DD03L-ROLLNAME,     " Data element
      END OF FS_DATAELE,
    Internal Table to hold Data Element Name                            *
      T_DATAELE LIKE STANDARD TABLE
                  OF FS_DATAELE.
    Field String to hold Short Text of the Date Element                 *
    DATA:
      BEGIN OF FS_TEXT,
        ROLLNAME TYPE DD04T-ROLLNAME,      " Data element
        DDTEXT   TYPE DD04T-DDTEXT,        " Short Text
      END OF FS_TEXT,
    Internal Table to hold Short Text of the Date Element               *
      T_TEXT LIKE STANDARD TABLE
               OF FS_TEXT.
    Field String to hold data to be displayed on the ALV grid           *
    DATA:
      BEGIN OF FS_OUTTAB,
        EBELN      TYPE EKKO-EBELN,        " Purchasing Document Number
        ERNAM      TYPE EKKO-ERNAM,        " Name of Person who Created the
                                           " Object
        LIFNR      TYPE EKKO-LIFNR,        " Vendor's account number
        EKGRP      TYPE EKKO-EKGRP,        " Purchasing group
        BEDAT      TYPE EKKO-BEDAT,        " Purchasing Document Date
        WERKS      TYPE LFA1-WERKS,        " Plant
        NAME1      TYPE LFA1-NAME1,        " Name1
        USERNAME   TYPE CDHDR-USERNAME,    " User name
        UDATE      TYPE CDHDR-UDATE,       " Creation date of the change
                                           " document
        DDTEXT     TYPE DD04T-DDTEXT,      " Short Text Describing R/3
                                           " Repository Objects
        VALUE_NEW  TYPE CDPOS-VALUE_NEW,   " New contents of changed field
        VALUE_OLD  TYPE CDPOS-VALUE_OLD,   " Old contents of changed field
      END OF FS_OUTTAB,
    Internal Table to hold data to be displayed on the ALV grid         *
      T_OUTTAB LIKE STANDARD TABLE
                 OF FS_OUTTAB.
                   C L A S S   D E F I N I T I O N                      *
      CLASS LCL_EVENT_HANDLER  DEFINITION DEFERRED.
    *" Data declarations...................................................
    Work variables                                                      *
      DATA:
        W_EBELN     TYPE EKKO-EBELN,       " Purchasing Document Number
        W_LIFNR     TYPE EKKO-LIFNR,       " Vendor's account number
        W_EKGRP     TYPE EKKO-EKGRP,       " Purchasing group
        W_VALUE     TYPE EKKO-EBELN,       " Reflected Value
        W_SPACE     VALUE ' ',             " Space
    *--- ALV Grid
        W_GRID      TYPE REF TO CL_GUI_ALV_GRID,
    *--- Event Handler
        EVENT_CLICK TYPE REF TO LCL_EVENT_HANDLER,
    *--- Field catalog table
        T_FIELDCAT  TYPE LVC_T_FCAT.
                          AT SELECTION-SCREEN EVENT                     *
    AT SELECTION-SCREEN ON S_EBELN.
      PERFORM VALIDATE_PD_NUM.
    AT SELECTION-SCREEN ON S_LIFNR.
      PERFORM VALIDATE_VEN_NUM.
    AT SELECTION-SCREEN ON S_EKGRP.
      PERFORM VALIDATE_PUR_GRP.
                          START-OF-SELECTION EVENT                      *
    START-OF-SELECTION.
      PERFORM SELECT_PO.
      PERFORM SELECT_OBJ_ID.
      PERFORM SELECT_CHANGED_VALUE.
      PERFORM SELECT_PUR_DOC.
      PERFORM SELECT_VENDOR.
      PERFORM DESCRIPTION.
                          END-OF-SELECTION EVENT                        *
    END-OF-SELECTION.
      IF NOT T_EKKO IS INITIAL.
        PERFORM FILL_OUTTAB.
      ENDIF.                               " IF NOT T_EKKO...
      PERFORM PREPARE_FIELD_CATALOG CHANGING T_FIELDCAT .
      CALL SCREEN 100.
          CLASS LCL_EVENT_HANDLER DEFINITION
    <b>CLASS LCL_EVENT_HANDLER DEFINITION .
      PUBLIC SECTION .
        METHODS:
            HANDLE_HOTSPOT_CLICK
                 FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
                           IMPORTING E_ROW_ID E_COLUMN_ID.
    ENDCLASS.                              " LCL_EVENT_HANDLER</b> DEFINITION
          CLASS LCL_EVENT_HANDLER IMPLEMENTATION
    CLASS LCL_EVENT_HANDLER IMPLEMENTATION .
    *---Handle Double Click
    <b>  METHOD HANDLE_HOTSPOT_CLICK .
        PERFORM GET_CELL_INFO.
        SET PARAMETER ID 'BES' FIELD W_VALUE.
        CALL TRANSACTION 'ME23N'.
      ENDMETHOD.                           " HANDLE_HOTSPOT_CLICK</b>
    ENDCLASS.                              " LCL_EVENT_HANDLER
    *&      Module  STATUS_0100  OUTPUT
          PBO Event
    MODULE STATUS_0100 OUTPUT.
      IF T_OUTTAB IS INITIAL.
        LEAVE PROGRAM.
      ENDIF.                               " IF T_OUTTAB...
      SET PF-STATUS 'OOPS'.
      SET TITLEBAR 'TIT'.
      IF W_GRID IS INITIAL.
        CREATE OBJECT W_GRID
          EXPORTING
       I_SHELLSTYLE      = 0
       I_LIFETIME        =
            I_PARENT       = CL_GUI_CONTAINER=>SCREEN0
       I_APPL_EVENTS     =
       I_PARENTDBG       =
       I_APPLOGPARENT    =
       I_GRAPHICSPARENT  =
       I_NAME            =
       I_FCAT_COMPLETE   = SPACE
          EXCEPTIONS
            ERROR_CNTL_CREATE = 1
            ERROR_CNTL_INIT   = 2
            ERROR_CNTL_LINK   = 3
            ERROR_DP_CREATE   = 4
            OTHERS            = 5.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.                             " IF SY-SUBRC <> 0
        CALL METHOD W_GRID->SET_TABLE_FOR_FIRST_DISPLAY
         EXPORTING
           I_BUFFER_ACTIVE               =
           I_BYPASSING_BUFFER            =
           I_CONSISTENCY_CHECK           =
           I_STRUCTURE_NAME              =
           IS_VARIANT                    =
           I_SAVE                        =
           I_DEFAULT                     = 'X'
           IS_LAYOUT                     =
           IS_PRINT                      =
           IT_SPECIAL_GROUPS             =
           IT_TOOLBAR_EXCLUDING          =
           IT_HYPERLINK                  =
           IT_ALV_GRAPHICS               =
           IT_EXCEPT_QINFO               =
           IR_SALV_ADAPTER               =
          CHANGING
            IT_OUTTAB                     = T_OUTTAB
            IT_FIELDCATALOG               = T_FIELDCAT
           IT_SORT                       =
           IT_FILTER                     =
          EXCEPTIONS
            INVALID_PARAMETER_COMBINATION = 1
            PROGRAM_ERROR                 = 2
            TOO_MANY_LINES                = 3
            OTHERS                        = 4
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.                             " IF SY-SUBRC <> 0.
      ENDIF.                               " IF W_GRID IS INITIAL
      CREATE OBJECT EVENT_CLICK.
      SET HANDLER EVENT_CLICK->HANDLE_HOTSPOT_CLICK FOR W_GRID.
    ENDMODULE.                             " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          PAI Event
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
        WHEN 'CANCEL'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                             " USER_COMMAND_0100  INPUT
    *&      Form  PREPARE_FIELD_CATALOG
          Subroutine to build the Field catalog
          <--P_T_FIELDCAT  Field Catalog Table
    FORM PREPARE_FIELD_CATALOG  CHANGING PT_FIELDCAT TYPE LVC_T_FCAT .
      DATA LS_FCAT TYPE LVC_S_FCAT.
      LS_FCAT-FIELDNAME = 'EKGRP'(011).
      LS_FCAT-REF_TABLE = 'EKKO'(002).
      LS_FCAT-INTTYPE   = 'C'(003).
      LS_FCAT-OUTPUTLEN = '10'.
      APPEND LS_FCAT TO PT_FIELDCAT.
      CLEAR LS_FCAT.
    <b>  LS_FCAT-FIELDNAME = 'EBELN'(001).
      LS_FCAT-REF_TABLE = 'EKKO'(002) .
      LS_FCAT-EMPHASIZE = 'C411'(007).
      LS_FCAT-INTTYPE   = 'C'(003).
      LS_FCAT-OUTPUTLEN = '10'.
      LS_FCAT-HOTSPOT   = 'X'(004).
      APPEND LS_FCAT TO PT_FIELDCAT .
      CLEAR LS_FCAT .</b>
      LS_FCAT-FIELDNAME = 'ERNAM'(006) .
      LS_FCAT-REF_TABLE = 'EKKO'(002) .
      LS_FCAT-OUTPUTLEN = '15' .
      APPEND LS_FCAT TO PT_FIELDCAT.
      CLEAR LS_FCAT.
      LS_FCAT-FIELDNAME = 'BEDAT'(013).
      LS_FCAT-REF_TABLE = 'EKKO'(002).
      LS_FCAT-INTTYPE   = 'C'(003).
      LS_FCAT-OUTPUTLEN = '10'.
      APPEND LS_FCAT TO PT_FIELDCAT.
      CLEAR LS_FCAT.
      LS_FCAT-FIELDNAME = 'LIFNR'(009).
      LS_FCAT-REF_TABLE = 'EKKO'(002).
      LS_FCAT-INTTYPE   = 'C'(003).
      LS_FCAT-OUTPUTLEN = '10'.
      APPEND LS_FCAT TO PT_FIELDCAT.
      CLEAR LS_FCAT.
      LS_FCAT-FIELDNAME = 'NAME1'(015).
      LS_FCAT-REF_TABLE = 'LFA1'(016).
      LS_FCAT-INTTYPE   = 'C'(003).
      LS_FCAT-OUTPUTLEN = '10'.
      APPEND LS_FCAT TO PT_FIELDCAT.
      CLEAR LS_FCAT.
      LS_FCAT-FIELDNAME = 'UDATE'(021).
      LS_FCAT-REF_TABLE = 'CDHDR'(019).
      LS_FCAT-INTTYPE   = 'C'(003).
      LS_FCAT-OUTPUTLEN = '10'.
      APPEND LS_FCAT TO PT_FIELDCAT.
      CLEAR LS_FCAT.
      LS_FCAT-FIELDNAME = 'USERNAME'(018).
      LS_FCAT-REF_TABLE = 'CDHDR'(019).
      LS_FCAT-INTTYPE   = 'C'(003).
      LS_FCAT-OUTPUTLEN = '10'.
      APPEND LS_FCAT TO PT_FIELDCAT.
      CLEAR LS_FCAT.
      LS_FCAT-FIELDNAME = 'DDTEXT'(023).
      LS_FCAT-REF_TABLE = 'DD04T'(024).
      LS_FCAT-INTTYPE   = 'C'(003).
      LS_FCAT-OUTPUTLEN = '15'.
      APPEND LS_FCAT TO PT_FIELDCAT.
      CLEAR LS_FCAT.
      LS_FCAT-FIELDNAME = 'VALUE_OLD'(029).
      LS_FCAT-REF_TABLE = 'CDPOS'(027).
      LS_FCAT-INTTYPE   = 'C'(003).
      LS_FCAT-OUTPUTLEN = '12'.
      APPEND LS_FCAT TO PT_FIELDCAT.
      CLEAR LS_FCAT.
      LS_FCAT-FIELDNAME = 'VALUE_NEW'(026).
      LS_FCAT-REF_TABLE = 'CDPOS'(027).
      LS_FCAT-INTTYPE   = 'C'(003).
      LS_FCAT-OUTPUTLEN = '12'.
      APPEND LS_FCAT TO PT_FIELDCAT.
      CLEAR LS_FCAT.
    ENDFORM.                               " PREPARE_FIELD_CATALOG
    *& Form  SELECT_PO
    Subroutine to select all the Purchase Orders
    There are no interface parameters to be passed to this subroutine.
    FORM SELECT_PO .
      SELECT EBELN                         " Purchasing Document Number
             ERNAM                         " Name of Person who Created
                                           " the Object
             LIFNR                         " Vendor's account number
             EKGRP                         " Purchasing group
             BEDAT                         " Purchasing Document Date
        FROM EKKO
        INTO TABLE T_EBELN
       WHERE EBELN IN S_EBELN
         AND BEDAT IN S_BEDAT.
    IF SY-SUBRC NE 0.
       MESSAGE S401(M8).
    ENDIF.                                " IF SY-SUBRC NE 0
    ENDFORM.                               " SELECT_PO
    *&  Form  SELECT_OBJ_ID
      Subroutine to select Object ID
      There are no interface parameters to be passed to this subroutine.
    FORM SELECT_OBJ_ID .
      IF NOT T_EBELN IS INITIAL.
        SELECT OBJECTCLAS                  " Object Class
               OBJECTID                    " Object value
               CHANGENR                    " Document change number
               USERNAME                    " User name
               UDATE                       " Creation date
          FROM CDHDR
          INTO TABLE T_CDHDR
       FOR ALL ENTRIES IN T_EBELN
         WHERE OBJECTID EQ T_EBELN-EBELN
           AND UDATE IN S_UDATE
           AND TCODE IN ('ME21N','ME22N','ME23N').
       IF SY-SUBRC NE 0.
         MESSAGE S833(M8) WITH 'Header Not Found'(031).
       ENDIF.                              " IF SY-SUBRC NE 0.
    ENDIF.                                " IF NOT T_EBELN IS INITIAL
    ENDFORM.                               " SELECT_OBJ_ID
    *&  Form  SELECT_CHANGED_VALUE
      Subroutine to select Changed Values
      There are no interface parameters to be passed to this subroutine.
    FORM SELECT_CHANGED_VALUE .
      IF NOT T_CDHDR IS INITIAL.
        SELECT OBJECTCLAS                  " Object class
               OBJECTID                    " Object value
               CHANGENR                    " Document change number
               TABNAME                     " Table Name
               FNAME                       " Field Name
               VALUE_NEW                   " New contents of changed field
               VALUE_OLD                   " Old contents of changed field
          FROM CDPOS
          INTO TABLE T_CDPOS
       FOR ALL ENTRIES IN T_CDHDR
         WHERE OBJECTCLAS EQ T_CDHDR-OBJECTCLAS
           AND OBJECTID   EQ T_CDHDR-OBJECTID
           AND CHANGENR   EQ T_CDHDR-CHANGENR.
        IF SY-SUBRC NE 0.
          MESSAGE S833(M8) WITH 'Item Not Found'(032).
        ENDIF.                             " IF SY-SUBRC NE 0.
      ENDIF.                               " IF NOT T_CDHDR IS INITIAL
    ENDFORM.                               " SELECT_CHANGED_VALUE
    *&   Form  SELECT_PUR_DOC
       Subroutine to select Purchase Order Details
       There are no interface parameters to be passed to this subroutine.
    FORM SELECT_PUR_DOC .
      IF NOT T_CDPOS IS INITIAL.
        SORT T_EBELN BY EBELN.
        LOOP AT T_CDPOS INTO FS_CDPOS.
          READ TABLE T_EBELN INTO FS_EBELN WITH KEY EBELN =
                                          FS_CDPOS-OBJECTID BINARY SEARCH.
          IF SY-SUBRC NE 0.
            DELETE TABLE T_EBELN FROM FS_EBELN.
          ENDIF.                           " IF SY-SUBRC NE 0.
        ENDLOOP.                           " LOOP AT T_CDPOS...
        LOOP AT T_EBELN INTO FS_EBELN.
          MOVE FS_EBELN-EBELN TO FS_EKKO-EBELN.
          MOVE FS_EBELN-ERNAM TO FS_EKKO-ERNAM.
          MOVE FS_EBELN-LIFNR TO FS_EKKO-LIFNR.
          MOVE FS_EBELN-EKGRP TO FS_EKKO-EKGRP.
          MOVE FS_EBELN-BEDAT TO FS_EKKO-BEDAT.
          APPEND FS_EKKO TO T_EKKO.
        ENDLOOP.                           " LOOP AT T_EBELN...
      ENDIF.                               " IF NOT T_CDPOS IS INITIAL
    ENDFORM.                               " SELECT_PUR_DOC
    *&  Form  SELECT_VENDOR
      Subroutine to select Vendor details
      There are no interface parameters to be passed to this subroutine.
    FORM SELECT_VENDOR .
      IF NOT T_EKKO IS INITIAL.
        SELECT LIFNR                       " Account Number of Vendor or
                                           " Creditor
               NAME1                       " Name 1
          FROM LFA1
          INTO TABLE T_LFA1
       FOR ALL ENTRIES IN T_EKKO
         WHERE LIFNR EQ T_EKKO-LIFNR.
       IF SY-SUBRC NE 0.
         MESSAGE S002(M8) WITH 'Master Details'(033).
       ENDIF.                              " IF SY-SUBRC NE 0.
      ENDIF.                               " IF NOT T_EKKO IS INITIAL
    ENDFORM.                               " SELECT_VENDOR
    *&  Form  DESCRIPTION
      Subroutine to get the description
      There are no interface parameters to be passed to this subroutine.
    FORM DESCRIPTION .
      IF NOT T_CDPOS IS INITIAL.
        SELECT TABNAME                     " Table Name
               FIELDNAME                   " Field Name
               ROLLNAME                    " Data element
          FROM DD03L
          INTO TABLE T_DATAELE
       FOR ALL ENTRIES IN T_CDPOS
         WHERE TABNAME EQ T_CDPOS-TABNAME
           AND FIELDNAME EQ T_CDPOS-FNAME.
        IF NOT T_DATAELE IS INITIAL.
          SELECT ROLLNAME                  " Data element
                 DDTEXT                    " Short Text Describing R/3
                                           " Repository Objects
            FROM DD04T
            INTO TABLE T_TEXT
         FOR ALL ENTRIES IN T_DATAELE
           WHERE ROLLNAME EQ T_DATAELE-ROLLNAME
             AND DDLANGUAGE EQ 'EN'.
          IF SY-SUBRC NE 0.
            EXIT.
          ENDIF.                           " IF SY-SUBRC NE 0.
        ENDIF.                             " IF NOT T_DATAELE IS INITIAL.
      ENDIF.                               " IF NOT T_CDPOS IS INITIAL.
    ENDFORM.                               " DESCRIPTION
    *&  Form  FILL_OUTTAB
      Subroutine to populate the Outtab
      There are no interface parameters to be passed to this subroutine.
    FORM FILL_OUTTAB .
      SORT T_CDHDR BY OBJECTID.
      SORT T_CDPOS BY OBJECTCLAS OBJECTID CHANGENR.
      SORT T_LFA1  BY LIFNR.
      SORT T_DATAELE BY TABNAME FIELDNAME.
      SORT T_TEXT BY ROLLNAME.
      LOOP AT T_EKKO INTO FS_EKKO.
        MOVE FS_EKKO-EBELN TO FS_OUTTAB-EBELN.
        MOVE FS_EKKO-ERNAM TO FS_OUTTAB-ERNAM.
        MOVE FS_EKKO-LIFNR TO FS_OUTTAB-LIFNR.
        MOVE FS_EKKO-EKGRP TO FS_OUTTAB-EKGRP.
        MOVE FS_EKKO-BEDAT TO FS_OUTTAB-BEDAT.
        READ TABLE T_CDHDR INTO FS_CDHDR WITH KEY OBJECTID = FS_EKKO-EBELN
                                                              BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            MOVE FS_CDHDR-USERNAME TO FS_OUTTAB-USERNAME.
            MOVE FS_CDHDR-UDATE    TO FS_OUTTAB-UDATE.
            READ TABLE T_CDPOS INTO FS_CDPOS WITH KEY
                                          OBJECTCLAS = FS_CDHDR-OBJECTCLAS
                                          OBJECTID   = FS_CDHDR-OBJECTID
                                          CHANGENR   = FS_CDHDR-CHANGENR
                                                              BINARY SEARCH.
             IF SY-SUBRC EQ 0.
               MOVE FS_CDPOS-VALUE_OLD TO FS_OUTTAB-VALUE_OLD.
               MOVE FS_CDPOS-VALUE_NEW TO FS_OUTTAB-VALUE_NEW.
               READ TABLE T_DATAELE INTO FS_DATAELE WITH KEY
                                         TABNAME = FS_CDPOS-TABNAME
                                         FIELDNAME = FS_CDPOS-FNAME
                                                           BINARY SEARCH.
                 IF SY-SUBRC EQ 0.
                   READ TABLE T_TEXT INTO FS_TEXT WITH KEY
                                         ROLLNAME = FS_DATAELE-ROLLNAME
                                                          BINARY SEARCH.
                     IF SY-SUBRC EQ 0.
                       MOVE FS_TEXT-DDTEXT TO FS_OUTTAB-DDTEXT.
                     ENDIF.                " IF SY-SUBRC EQ 0.
                 ENDIF.                    " IF SY-SUBRC EQ 0.
             ENDIF.                        " IF SY-SUBRC EQ 0.
          ENDIF.                           " IF SY-SUBRC EQ 0.
        READ TABLE T_LFA1 INTO FS_LFA1 WITH KEY LIFNR = FS_EKKO-LIFNR
                                                         BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            MOVE FS_LFA1-NAME1 TO FS_OUTTAB-NAME1.
          ENDIF.                           " IF SY-SUBRC EQ 0.
      APPEND FS_OUTTAB TO T_OUTTAB.
      ENDLOOP.                             " LOOP AT T_EKKO...
    ENDFORM.                               " FILL_OUTTAB
    *&   Form  GET_CELL_INFO
       Subroutine to get the Cell Information
    -->  W_VALUE   Holds the value of Hotspot clicked
    FORM GET_CELL_INFO .
      CALL METHOD W_GRID->GET_CURRENT_CELL
        IMPORTING
         E_ROW     =
          E_VALUE   = W_VALUE
         E_COL     =
         ES_ROW_ID =
         ES_COL_ID =
         ES_ROW_NO =
    ENDFORM.                               " GET_CELL_INFO
    *&   Form  VALIDATE_PD_NUM
       Subroutine to validate Purchase Document Number
       There are no interface parameters to be passed to this subroutine.
    FORM VALIDATE_PD_NUM .
      IF NOT S_EBELN[] IS INITIAL.
        SELECT EBELN                       " Purchase Document Number
          FROM EKKO
          INTO W_EBELN
         UP TO 1 ROWS
         WHERE EBELN IN S_EBELN.
        ENDSELECT.
        IF SY-SUBRC NE 0.
          MESSAGE E717(M8).
        ENDIF.                             " IF SY-SUBRC NE 0
      ENDIF.                               " IF NOT S_EBELN[]...
    CLEAR SSCRFIELDS-UCOMM.
    ENDFORM.                               " VALIDATE_PD_NUM
    *&   Form  VALIDATE_VEN_NUM
       Subroutine to validate Vendor Number
       There are no interface parameters to be passed to this subroutine.
    FORM VALIDATE_VEN_NUM .
      IF NOT S_LIFNR[] IS INITIAL.
        SELECT LIFNR                       " Vendor Number
          FROM LFA1
          INTO W_LIFNR
         UP TO 1 ROWS
         WHERE LIFNR IN S_LIFNR.
        ENDSELECT.
        IF SY-SUBRC NE 0.
          MESSAGE E002(M8) WITH W_SPACE.
        ENDIF.                             " IF SY-SUBRC NE 0
      ENDIF.                               " IF NOT S_LIFNR[]...
    CLEAR SSCRFIELDS-UCOMM.
    ENDFORM.                               " VALIDATE_VEN_NUM
    *&   Form  VALIDATE_PUR_GRP
       Subroutine to validate the Purchase Group
       There are no interface parameters to be passed to this subroutine.
    FORM VALIDATE_PUR_GRP .
      IF NOT S_EKGRP[] IS INITIAL.
        SELECT EKGRP                       " Purchase Group
          FROM T024
          INTO W_EKGRP
         UP TO 1 ROWS
         WHERE EKGRP IN S_EKGRP.
        ENDSELECT.
        IF SY-SUBRC NE 0.
          MESSAGE E622(M8) WITH W_SPACE.
        ENDIF.                             " IF SY-SUBRC NE 0
      ENDIF.                               " IF NOT S_EKFRP[]...
    CLEAR SSCRFIELDS-UCOMM.
    ENDFORM.                               " VALIDATE_PUR_GRP

  • Displaying selection screen details in Alv Report  output display as Header

    Hi all,
    May be somebody knows how I can show selected values with select-options in top_of_page using REUSE_ALV_GRID_DISPLAY.
    This shoud work for all the reports and diff selection screens .
    I need one dynamic process which will for display any report selection screen selected details.(Basically varient information of report).
    Small example if possible, please.
    Thanks in advance,
    Rimas

    Hi Thiru,
    Thanks for the input.
    This is my exact requirement.
    Hi Experts,
    I would like to Display / Print  Select-options selected details in ALV Header.
    Ex: Say suppose here i enter kunnr as 1000
                                            lifnr as    2000 to 4000
                                            p_langu as  'EN'.
                                           p_dir  as 'C:\TEMP,
                                           p_upda as 'X'
    for selection screen below.                    
    SELECTION-SCREEN :BEGIN OF BLOCK blk1 WITH FRAME TITLE text-000.
    SELECT-OPTIONS : s_kunnr FOR kna1-kunnr.
    SELECT-OPTIONS : s_lifnr FOR lfa1-lifnr.
    PARAMETER      : p_lanuge LIKE t002-spras DEFAULT sy-langu.
    PARAMETER: p_dir  LIKE rlgrap-filename
               DEFAULT text-003 LOWER CASE.
    PARAMETERS: p_upd AS CHECKBOX DEFAULT 'X'.
    I dont want to Hard code selection screen values like
    DATA: header TYPE slis_t_listheader,
    wa TYPE slis_listheader,
    wa-typ = 'S'(093).
      wa-key = s_lifnr .
      wa-info = 'Vendor no".
      APPEND wa TO header.
    I want dynamic process for all of my selection screen values selected
    hard code may be it will be fine small selection screen it will work.
    Fur that i got one process to get dynamically through fm
    Ex: DATA: irsparams TYPE rsparams OCCURS 0 WITH HEADER LINE.
    CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
    EXPORTING
    curr_report = program
    TABLES
    selection_table = irsparams
    EXCEPTIONS
    not_found = 1
    no_report = 2
    OTHERS = 3.
    loop at irsparams.
    write : / irsparams-SELNAME.
    write : / irsparams-SIGN.
    write : / irsparams-OPTION.
    write : / irsparams-LOW.
    write : / irsparams-HIGH.
    endloop.
    I have done my requirement partially but i am failed to achive my full  requirement.
    Because
    rsparams  strcture is diff from  slis_t_listheader.
    Can any one help me for further assistence to display irsparams strcture data in alv header.
    Thanks
    Nag

  • How to Print Selection-Screen along with ALV Report output

    Hi,
    I have a requirement wherein i need to also print the Selection Screen of a report when I print the ALV report output.
    Basically i need to print the ALV output along with selection screen.
    Could you plz suggest me the way.
    Regards,
    Nitin

    Hi,
    My selection Screen is a very big one. It contains around 30 select-options.
    So is their any standard method in which you can choose whether you want to take the output printout with or without Selection screen.
    Regards,
    Nitin

  • Display seletion screen values in alv grid output

    Hi,
    I am changing from alv list to alv grid. In ALV list after displaying output, in application tool bar one button is there that is "Display selections", when i click it, is giving all selection screen values in a popup. i want same funtionality in ALV grid.
    By
    jagan

    Hi,
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program     = l_repid
          i_callback_top_of_page = 'TOP_OF_PAGE'
    FORM top_of_page .
      PERFORM populate_top_of_page .
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = ig_header.
    ENDFORM.                    " top_of_page
    *&      Form  populate_top_of_page
    FORM populate_top_of_page .
      REFRESH ig_header.
      CLEAR wg_header .
      wg_header-typ  = c_h.
      wg_header-info = 'Selection Criteria:'(004).
      APPEND wg_header TO ig_header.
      CLEAR: wg_header.
      IF NOT s_lgort IS INITIAL.
        CONCATENATE s_lgort-low '-'(111) s_lgort-high
               INTO g_text1 SEPARATED BY space .
      ENDIF.
      wg_header-typ  = c_s.
      wg_header-key = 'Storage Location :'(005).
      wg_header-info = g_text1 .
      APPEND wg_header TO ig_header.
      CLEAR: wg_header.
      CLEAR g_text1.
      IF NOT s_ekgrp IS INITIAL.
        CONCATENATE s_ekgrp-low '-'(111) s_ekgrp-high
               INTO g_text1 SEPARATED BY space .
      ENDIF.
      wg_header-typ  = c_s.
      wg_header-key = 'Purchasing Group :'(006).
      wg_header-info = g_text1 .
      APPEND wg_header TO ig_header.
      CLEAR: wg_header.
      CLEAR g_text1.
      IF NOT s_werks IS INITIAL.
        CONCATENATE s_werks-low '-'(111) s_werks-high
               INTO g_text1 SEPARATED BY space .
      ENDIF.
      wg_header-typ  = c_s.
      wg_header-key = 'Plant :'(007).
      wg_header-info = g_text1 .
      APPEND wg_header TO ig_header.
      CLEAR: wg_header.
      CLEAR g_text1.
    ENDFORM.                    " populate_top_of_page
    Hope this is helpful...
    Regards
    Milan

  • REGARDING READING THE SCREEN CONTENTS IN ALV GRID

    HI ALL,
    i have to transfer contents from one grid display to another grid.
    internal table has :
    internal- table name: itab
    chkbx
    v_lights
    matnr
    maktx
    dline(longtext of the material)
    alv grid is having following contents:
    1. chkbx which will get the user command.
    2. v_lights to display the different colors of light according to the contents of the longtext which i am fetching using the read_text function.
    3. matnr
    4. maktx
    5. longtext of the material.
    after the display of the first grid display.
    if user changes contents of the check box .. i have to read the screen and  and modify my internal table(itab) so that i can fetch data from the internal table to another internal table which i can use for the next screen.
    can anyone of you tell me how can i do this.
    and some help contents so that i can understand the whole concept.
    regards
    vamsi

    Hi vamsi,
      Do this way:
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
        I_CALLBACK_PROGRAM                = W_REPID
        I_CALLBACK_PF_STATUS_SET          = 'PF_STATUS'
        I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
    FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM
                            P_SELFLD TYPE SLIS_SELFIELD.
    case p_ucomm.
    when 'SAVE'.
      Data ref1 type ref to cl_gui_alv_grid.
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
    E_GRID = ref1.
    call method ref1->check_changed_data.
    Now your internal table will have the latest values.
    loop at itab where check = 'X'. "Assuming the first fieldname for the check box is 'CHECK'.
    move-corresponding itab to itab2.
    append itab2.
    clear itab2.
    endcase.
    Build anothe r field catalog
    Display another grid.
    ENDFORM.
    Regards,
    Ravi

  • Printing Selection-Screen while printing ALV Grid output display

    Hi,
    I have a requirement wherein I want to print the Selection Screen also while printing the output in simple ALV grid Display.
    Currently when I print the ALV output report, only the header and the Body of the ALV is getting printed. But the requirement is that I also want to print Selection screen along with this.
    If anyone has faced a similar situation, plz let me know what needs to be done in order to print the selection screen also while printing the ALV report output.
    Rgds,
    Nitin

    Hi,
    You can use given function module to print your
    selection screen
    RS_REFRESH_FROM_SELECTOPTIONS
    >This will get Current contents of selection screen
    RS_LIST_SELECTION_TABLE
    >This will Generates list according to values in selection table(RSPARAMS)
    Sample
    CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
           EXPORTING
                curr_report     = p_repid
           TABLES
                selection_table = it_int_tab
           EXCEPTIONS
                not_found       = 1
                no_report       = 2
                OTHERS          = 3.
      IF sy-subrc EQ 0.
        WRITE:1  'Selection Criteria'(i19),
             /1  sy-uline(18),
             /1  'Variant Name'(i21),
             23  sy-slset.
    *--  This function module lists the Selection Screen contents
        CALL FUNCTION 'RS_LIST_SELECTION_TABLE'
             EXPORTING
                  report        = p_repid
                  seltext       = 'X'
                  newpage       = space
             TABLES
                  sel_tab       = it_int_tab
             EXCEPTIONS
                  sel_tab_empty = 1
                  OTHERS        = 2.
    Mark all helpful answers

  • Displaying selection screen data on alv header in multiple rows and columns

    Hi
    Presently in my requirement , whatever  the data entered in  selection screen  should display  on alv header  and item details on alv grid display.
    for eg...
    on alv header
      customer no :  1000 to 2000         sales order no: 111
      name :    gff to ff                                 sales org:
      city:                                         country:
      item details below this   
      plz guide me how to solve this issue.
    Thanks & Regards,
    Pradeep

    Hi,
    Check this code this may help you.
    <code>
    TYPE-POOLS : SLIS.
    TABLES VBRK.
    TYPES : BEGIN OF TY_VBRK,
            VBELN TYPE VBRK-VBELN,
            VKORG TYPE VBRK-VKORG,
            VTWEG TYPE VBRK-VTWEG,
            SPART TYPE VBRK-SPART,
            FKDAT TYPE VBRK-FKDAT,
            END OF TY_VBRK,
            BEGIN OF TY_VBRP,
            VBELN TYPE VBRP-VBELN,
            POSNR TYPE VBRP-POSNR,
            MATNR TYPE VBRP-MATNR,
            ARKTX TYPE VBRP-ARKTX,
            FKIMG TYPE VBRP-FKIMG,
            NETWR TYPE VBRP-NETWR,
            END OF TY_VBRP,
            BEGIN OF TY_TARGET,
            VBELN TYPE VBRK-VBELN,
            VKORG TYPE VBRK-VKORG,
            VTWEG TYPE VBRK-VTWEG,
            SPART TYPE VBRK-SPART,
            FKDAT TYPE VBRK-FKDAT,
            POSNR TYPE VBRP-POSNR,
            MATNR TYPE VBRP-MATNR,
            ARKTX TYPE VBRP-ARKTX,
            FKIMG TYPE VBRP-FKIMG,
            NETWR TYPE VBRP-NETWR,
            END OF TY_TARGET.
    DATA : T_VBRK TYPE TABLE OF TY_VBRK,
           W_VBRK TYPE TY_VBRK,
            T_VBRP TYPE TABLE OF TY_VBRP,
            W_VBRP TYPE TY_VBRP,
            T_TARGET TYPE TABLE OF TY_TARGET,
            W_TARGET TYPE TY_TARGET,
    FIELD CATALOG ******************
            T_FCAT TYPE SLIS_T_FIELDCAT_ALV,
            W_FCAT TYPE SLIS_FIELDCAT_ALV,
    *************************************SUB TOTALS AND SORTING***********
            T_SORT TYPE SLIS_T_SORTINFO_ALV,
            W_SORT TYPE SLIS_SORTINFO_ALV,
    *************************************FOR LIST HEADER******************
            T_LIST_HEAD TYPE SLIS_T_LISTHEADER,
            W_LIST_HEAD TYPE SLIS_LISTHEADER,
            T_LIST_HEAD1 TYPE SLIS_T_LISTHEADER,
            W_LIST_HEAD1 TYPE SLIS_LISTHEADER,
    *************************************FOR LIST HEADER******************
            W_LAYOUT TYPE SLIS_LAYOUT_ALV,
    ************************************FOR EVENTS************************
            T_EVENT TYPE SLIS_T_EVENT,
            W_EVENT TYPE SLIS_ALV_EVENT.
    *********************************SELECT OPTIONS***********************
    SELECT-OPTIONS : S_VBELN FOR VBRK-VBELN DEFAULT 90005316 TO 90005330.
    **RETRIVING DATA************************
    PERFORM DATA_RETRIVE.
    **BUILDING THE FIELD CATALOG************
    PERFORM BUILD_FCAT.
    **BUILDING THE TABLE FOR LIST HEADER****
    PERFORM BUILD_LIST_HEAD.
    *******************************CALLING THE FUNCTION MODULE************
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        I_CALLBACK_PROGRAM     = SY-REPID
        I_CALLBACK_TOP_OF_PAGE = 'LIST_TOP_OF_PAGE'
        IT_FIELDCAT            = T_FCAT
        IT_SORT                = T_SORT
      TABLES
        T_OUTTAB               = T_TARGET.
    *&      Form  DATA_RETRIVE
    FORM DATA_RETRIVE .
    SELECT VBELN VKORG VTWEG SPART FKDAT FROM VBRK INTO CORRESPONDING FIELDS
    OF TABLE T_VBRK WHERE VBELN IN S_VBELN.
      IF SY-SUBRC EQ 0.
        SORT T_VBRK BY VBELN.
        SELECT VBELN POSNR MATNR ARKTX FKIMG NETWR FROM VBRP INTO TABLE
         T_VBRP FOR ALL ENTRIES IN T_VBRK WHERE VBELN = T_VBRK-VBELN.
      ENDIF.
      LOOP AT T_VBRP INTO W_VBRP.
        LOOP AT T_VBRK INTO W_VBRK WHERE VBELN = W_VBRP-VBELN.
          W_TARGET-VBELN = W_VBRK-VBELN.
          W_TARGET-VKORG = W_VBRK-VKORG.
          W_TARGET-VTWEG = W_VBRK-VTWEG.
          W_TARGET-SPART = W_VBRK-SPART.
          W_TARGET-FKDAT = W_VBRK-FKDAT.
          W_TARGET-POSNR = W_VBRP-POSNR.
          W_TARGET-MATNR = W_VBRP-MATNR.
          W_TARGET-ARKTX = W_VBRP-ARKTX.
          W_TARGET-FKIMG = W_VBRP-FKIMG.
          W_TARGET-NETWR = W_VBRP-NETWR.
          APPEND W_TARGET TO T_TARGET.
        ENDLOOP.
      ENDLOOP.
      SORT T_TARGET BY VBELN.
    ENDFORM.                    " DATA_RETRIVE
    *&      Form  BUILD_FCAT
    FORM BUILD_FCAT .
      W_FCAT-COL_POS = 1.
      W_FCAT-FIELDNAME = 'VBELN'.
      W_FCAT-SELTEXT_M = 'BILLING NO'.
      APPEND W_FCAT TO T_FCAT.
      W_FCAT-COL_POS = 2.
      W_FCAT-FIELDNAME = 'VKORG'.
      W_FCAT-SELTEXT_M = 'SALES ORGANIZATION'.
      APPEND W_FCAT TO T_FCAT.
      W_FCAT-COL_POS = 3.
      W_FCAT-FIELDNAME = 'VTWEG'.
      W_FCAT-SELTEXT_M = 'DISTRIBUTION CHANNEL'.
      APPEND W_FCAT TO T_FCAT.
      W_FCAT-COL_POS = 4.
      W_FCAT-FIELDNAME = 'SPART'.
      W_FCAT-SELTEXT_M = 'DIVISION'.
      APPEND W_FCAT TO T_FCAT.
      W_FCAT-COL_POS = 5.
      W_FCAT-FIELDNAME = 'FKDAT'.
      W_FCAT-SELTEXT_M = 'CREATION DATE'.
      APPEND W_FCAT TO T_FCAT.
      W_FCAT-COL_POS = 6.
      W_FCAT-FIELDNAME = 'POSNR'.
      W_FCAT-SELTEXT_M = 'BILLING ITEM'.
      APPEND W_FCAT TO T_FCAT.
      W_FCAT-COL_POS = 7.
      W_FCAT-FIELDNAME = 'MATNR'.
      W_FCAT-SELTEXT_M = 'MATERIAL NUM'.
      APPEND W_FCAT TO T_FCAT.
      W_FCAT-COL_POS = 8.
      W_FCAT-FIELDNAME = 'ARKTX'.
      W_FCAT-SELTEXT_M = 'DESCRIPTION'.
      APPEND W_FCAT TO T_FCAT.
      W_FCAT-COL_POS = 9.
      W_FCAT-FIELDNAME = 'FKIMG'.
      W_FCAT-SELTEXT_M = 'QUANTITY'.
      APPEND W_FCAT TO T_FCAT.
      W_FCAT-COL_POS = 10.
      W_FCAT-FIELDNAME = 'NETWR'.
      W_FCAT-SELTEXT_M = 'NET VALUE'.
      W_FCAT-DO_SUM = 'X'.
      APPEND W_FCAT TO T_FCAT.
    ENDFORM.                    " BUILD_FCAT
    *&      Form  BUILD_LIST_HEAD
    FORM BUILD_LIST_HEAD .
      DATA : L_DATE(10),
             L_TIME(8).
      W_LIST_HEAD-TYP = 'S'.
      W_LIST_HEAD-KEY = 'Sales org :'.
      W_LIST_HEAD-INFO = S_VBELN-LOW .
      APPEND W_LIST_HEAD TO T_LIST_HEAD.
      CLEAR W_LIST_HEAD.
      W_LIST_HEAD-TYP = 'S'.
      W_LIST_HEAD-KEY = 'TO '.
      W_LIST_HEAD-INFO =  S_VBELN-HIGH.
      APPEND W_LIST_HEAD TO T_LIST_HEAD.
      CLEAR W_LIST_HEAD.
    ENDFORM.                    " BUILD_LIST_HEAD
    *&      Form  LIST_TOP_OF_PAGE
    FORM LIST_TOP_OF_PAGE .
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = T_LIST_HEAD.
    ENDFORM.                    " LIST_TOP_OF_PAGE
    <code>
    Regards

Maybe you are looking for

  • Multiple iphones sharing one account

    I am setting up two iphone 4 & 1 iphone 5 and would like to share some music and have one account.  But I don't want to share contacts.  How do I do this and should I use icloud?

  • HT5312 forgot questions and answers

    send security questions answer forgot

  • TDS on Outgoing Payment

    Hi All, I have gone through many threads but not able to find proper solution for a general scenario which will be requirement of many customer. Scenario: Is very simple. I have make Payment to Vendor on Acount ( Advance Payment) on which i need to d

  • V-drums via midi

    I would like to record some drums.. I have a simple set of v-drums with two 1/4 outputs. I have a simple audio interface with one XLR input and one 1/4 input. Wondering how this might work... would it sound like crap? would it be in mono? Questions..

  • Re: how do I solve this alert-The photo "evaluation.jpeg" could not be opened, because the original item cannot be found.

    Re: how do I solve this alert-The photo "evaluation.jpeg" could not be opened, because the original item cannot be found. How do I get rid of the alert so that every time I open iphoto or sync my iphone it will not come up anymore. Thanks