Text after end of each type in ALV GRID DISPLAY

Hi Experts,
My Requirement is that after end of every order type I need to give the text to display how many records are there under that order type in ALV GRID DISPLAY.
Sample internal table is shown below
Ordertyp       date
PM1            25/05/2010
PM1            25/05/2010
PM2            25/05/2010
PM2            25/05/2010
PM2            25/05/2010
PM2           25/05/2010
Out put should be as shown below
PM1       25/05/2010
PM1       25/05/2010
Total PM1 order types are 2
PM2     25/05/2010
PM2     25/05/2010
PM2    25/05/2010
PM2    25/05/2010
Total PM2 Order types are 4
Total all order types are 6.
Please note here I am not doing any subtotal, just I want to display how many records are there under that particular order
Thanks
Babumiya Mohammad

Hi,
whatever it may be you can very well use the given logic to build.
Let say you are making the final table for display. While final table display make the process and append the data in final table itself and pass it to ALV.
LOOP AT ITAB.
ITAB1-FLD1 = ITAB-FLD1
ITAB1-FLD2 = ITAB-FLD2
APPEND ITAB1.
*For making the count
L_Cnt = L_cnt + 1.
At end of OrdTYP
L_ord_text = L_cnt.
MOVE L_ORD_TEXT  to L_SUB_TEXT.
L_TEXT1 = '' TOTAL"
L_TEXT2 =  "Order types are"
concatenate L_TEXT    ITAB-ORDTYP   L_TEXT2       L_ord_text      into            l_TOT1.
ITAB1- FLD2 = L_TOT1.
APPEDN ITAB1.
clear : L_cnt, L_ord_text .
ENDLOOP.
L_TOT_TEXT = L_TOT_TEXT + L_SUB_TEXT  ( Here you will get total order type count)
Do the conactenate
L_TEXT3 = " Total all order types are"
concatenate L_TEXT3    L_TOT_TEXT  INTo L_TOT2.
ITAB1-FLD2 =  L_TOT2.
APPEND IATB1.
Here you will total text. Like above you can build the logic. It will work fine.
You should not clear the L_SUB_TEXT.

Similar Messages

  • How to give a page break in alv grid display after 65 lines are displayed?

    hi all,
    I need to give a page break in alv grid display after 65 lines are displayed on each page...Please help me with this...

    hai
    give this command beging of the report name... u have to diclar the beging of the report ......
    <b>report</b> ( name of the report)  <b>standard page heading line-size 200 line-count 65.</b>
    ex1.:- report name is  rtpm_trl_show_flows 
    report <b>rtpm_trl_show_flows </b> no standard page heading line-size 200
                                                         line-count 65.
    ex:2
    report  <b>zlpur01</b> no standard page heading line-size 200
                                                         line-count 65.
    type-pools: slis.
    tables: bkpf.
    selection-screen begin of block sel with frame title text-001.
    select-options: s_comp for bkpf-bukrs, " Company
                    s_valut for bkpf-budat. " Invoice Date
                   S_MTART FOR MARA-MTART. " Material Type
    selection-screen end of block sel.
    parameters: p_vari like disvariant-variant. " ALV Variant
    constants: formname_top_of_page type slis_formname value 'TOP_OF_PAGE'.
    data:   i_bseg type bseg  occurs 0 with header line.
    data: vatval type p decimals 2 value '0.15'.
    data: xhkont type string value '154000'.
    data COM type c.
    data: begin of invt occurs 100,
            budat like bkpf-budat, " Inv Dat
            bukrs like bkpf-bukrs, " Material
            STCEG like bsak-STCEG, "name of the companycode
            belnr like bkpf-belnr,
            xblnr like bkpf-xblnr, " Inv Reference
            ebeln like rseg-ebeln, " PO number
            lifnr like bseg-lifnr, " Vendor No
            name1 like lfa1-name1, " Supplier Name
            matnr like bseg-matnr,
            maktx like makt-maktx,
            stcd1 like lfa1-stcd1, " Supplier VAT REG NO
            xamt like bseg-dmbtr, " TAX amt
            yamt like bseg-wrbtr,
            wrbtr like bseg-wrbtr, " Base amount
            mwskz like bseg-mwskz,
            dmbtr like bseg-dmbtr, " TAX amt
            gjahr like bkpf-gjahr,
            hkont like bseg-hkont,
            zamt like bseg-dmbtr, " TAX amt
            wamt like bseg-dmbtr,
            shkzg like bseg-shkzg,
            shkzg1 like bseg-shkzg,
          end of invt.
    regard
    nawa

  • Hi, coding to display popup window after first alv grid display

    hi
    can anybody please send coding to display popup window after first alv grid display i.e.  first the prog shows grid display and from grid display the user select the field and on the basis of field value i need to show pop up window in the first secondary window and then third popup window.
    thanx
    rocky

    Hi rocky,
    here is the sample code .hope this helps you.
    TYPE-POOLS : SLIS.
    DATA : GT_OUTTAB TYPE VBAK OCCURS 0,
           GS_PRIVATE TYPE SLIS_DATA_CALLER_EXIT,
           GS_SELFIELD TYPE SLIS_SELFIELD.
    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA : ITAB TYPE TABLE OF SLIS_SELFIELD,
           WA_ITAB LIKE LINE OF ITAB.
    START-OF-SELECTION.
    PERFORM POPULATE_GT_OUTTAB.
    PERFORM GET_POPUP.
    PERFORM POPULATE_ITAB.
    PERFORM FIELDCAT.
    PERFORM DISPLAY_DETAILS.
    *&      Form  FIELDCAT
          text
    -->  p1        text
    <--  p2        text
    FORM FIELDCAT .
    LOOP AT ITAB INTO WA_ITAB.
    WA_FIELDCAT-FIELDNAME = 'TABINDEX'.
    WA_FIELDCAT-TABNAME = 'WA_ITAB'.
    WA_FIELDCAT-COL_POS = 1.
    WA_FIELDCAT-SELTEXT_L = 'TABLE INDEX'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'SEL_TAB_FIELD'.
    WA_FIELDCAT-TABNAME = 'WA_ITAB'.
    WA_FIELDCAT-COL_POS = 2.
    WA_FIELDCAT-OUTPUTLEN = 20.
    WA_FIELDCAT-SELTEXT_L = 'FIELD NAME'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'VALUE'.
    WA_FIELDCAT-TABNAME = 'WA_ITAB'.
    WA_FIELDCAT-COL_POS = 3.
    WA_FIELDCAT-SELTEXT_L = 'FIELD VALUE'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    ENDLOOP.
    ENDFORM.                    " FIELDCAT
    *&      Form  POPULATE_GT_OUTTAB
          text
    -->  p1        text
    <--  p2        text
    FORM POPULATE_GT_OUTTAB .
    SELECT * FROM VBAK
           UP TO 10 ROWS
           INTO TABLE GT_OUTTAB.
    ENDFORM.                    " POPULATE_GT_OUTTAB
    *&      Form  GET_POPUP
          text
    -->  p1        text
    <--  p2        text
    FORM GET_POPUP .
    CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
      EXPORTING
       I_TITLE                       = 'SALES ORDER'
      I_SELECTION                   = 'X'
      I_ALLOW_NO_SELECTION          =
       I_ZEBRA                       = 'X'
      I_SCREEN_START_COLUMN         = 0
      I_SCREEN_START_LINE           = 0
      I_SCREEN_END_COLUMN           = 0
      I_SCREEN_END_LINE             = 0
      I_CHECKBOX_FIELDNAME          =
      I_LINEMARK_FIELDNAME          =
      I_SCROLL_TO_SEL_LINE          = 'X'
        I_TABNAME                     = 'SALES ORDER'
        I_STRUCTURE_NAME              = 'VBAK'
      IT_FIELDCAT                   =
      IT_EXCLUDING                  =
      I_CALLBACK_PROGRAM            =
      I_CALLBACK_USER_COMMAND       =
       IS_PRIVATE                    = GS_PRIVATE
    IMPORTING
       ES_SELFIELD                   = GS_SELFIELD
      E_EXIT                        = G_EXIT
      TABLES
        T_OUTTAB                      = GT_OUTTAB
    EXCEPTIONS
       PROGRAM_ERROR                 = 1
       OTHERS                        = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    " GET_POPUP
    *&      Form  POPULATE_ITAB
          text
    -->  p1        text
    <--  p2        text
    FORM POPULATE_ITAB .
    WA_ITAB-TABNAME = GS_SELFIELD-TABNAME.
    WA_ITAB-TABINDEX = GS_SELFIELD-TABINDEX.
    WA_ITAB-SEL_TAB_FIELD = GS_SELFIELD-SEL_TAB_FIELD.
    WA_ITAB-VALUE = GS_SELFIELD-VALUE.
    APPEND WA_ITAB TO ITAB.
    ENDFORM.                    " POPULATE_ITAB
    *&      Form  DISPLAY_DETAILS
          text
    -->  p1        text
    <--  p2        text
    FORM DISPLAY_DETAILS .
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
      I_CALLBACK_PROGRAM             = ' '
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
      I_STRUCTURE_NAME               =
      IS_LAYOUT                      =
       IT_FIELDCAT                    = IT_FIELDCAT
      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
    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.
    ENDFORM.                    " DISPLAY_DETAILS
    award points if helpful.
    regards,
    deepthi reddy

  • Row seperator in the ALV grid display after the various highest level prod.

    Hi,
      I have a requirement like user wants a row seperator against the various high level products (Each parent material)in ALV Grid display.We made this change but quantity and pricey fields  showing the zero's in the blank line.i know that if we use NO-ZERO
    in the ALV field catalog , we can remove the zero's from blank line. But other  zerou2019s will remove from rest of the line items. User want's the zero's in other line items, but not in the blank line.
    We can convert packed fileds into character format, but this will effect to the summing the quantity, price coumns.
    If any body have idea on above mentioned.
    Regards,
    SK.

    Hi Suresh,
    There is no short cut for this requirement. You have to do following steps.
    1. Change the data type of column to char.
    2. Programatically  find the totals.
    Reagards,
    Anversha

  • Update values in AlV grid display after entering value

    Hi,
         I have an issue in ALV grid display.
        Let me explain.
        i have 8 fields to display in which one is editiable.
       Fields are: date
                       material,
                       material Description,
                       Opening Stock,
                       Closing stock-  (  this field is editiable)
                       Closing stock,
                       Received Stock,
                       Actual production.
    Actual production = Closing stock + removal stock
                                 - receipt stock - opening stock.
    when i change the value of closing stock and press enter, actual production should get update, the new values should display.
    Thany you in advance.

    Hi,
    Please refer the code below:
    REPORT z_demo_alv_jg.*******************************************************************
    * TYPE-POOLS                                                      *
    TYPE-POOLS: slis. *******************************************************************
    * INTERNAL TABLES/WORK AREAS/VARIABLES     *
    DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
          i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
          w_field TYPE slis_fieldcat_alv,
          p_table LIKE dd02l-tabname,
          dy_table TYPE REF TO data,
          dy_tab TYPE REF TO data,
          dy_line TYPE REF TO data.*******************************************************************
    * FIELD-SYMBOLS                                                   *
    FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
                   <dyn_wa> TYPE ANY,
                   <dyn_field> TYPE ANY,
                   <dyn_tab_temp> TYPE STANDARD TABLE.*******************************************************************
    * SELECTION SCREEN                                                *
    PARAMETERS: tabname(30) TYPE c,
                lines(5)  TYPE n.*******************************************************************
    * START-OF-SELECTION                                              *
    START-OF-SELECTION.* Storing table name
      p_table = tabname.* Create internal table dynamically with the stucture of table name
    * entered in the selection screen
      CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table).
      ASSIGN dy_table->* TO <dyn_table>.
      IF sy-subrc <> 0.
        MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'.    LEAVE TO LIST-PROCESSING.
      ENDIF.
    * Create workarea for the table
      CREATE DATA dy_line LIKE LINE OF <dyn_table>.
      ASSIGN dy_line->* TO <dyn_wa>.* Create another temp. table
      CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table).
      ASSIGN dy_tab->* TO <dyn_tab_temp>.  SORT i_fieldcat BY col_pos.* Select data from table
      SELECT * FROM (p_table)
      INTO TABLE <dyn_table>
      UP TO lines ROWS.  REFRESH <dyn_tab_temp>.* Display report
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program       = sy-repid
          i_structure_name         = p_table
          i_callback_user_command  = 'USER_COMMAND'
          i_callback_pf_status_set = 'SET_PF_STATUS'
        TABLES
          t_outtab                 = <dyn_table>
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.  IF sy-subrc <> 0.  ENDIF.*&-----------------------------------------------------------------*
    *&      Form  SET_PF_STATUS
    *       Setting custom PF-Status
    *      -->RT_EXTAB   Excluding table
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.  SET PF-STATUS 'Z_STANDARD'.ENDFORM.                    "SET_PF_STATUS*&----------------------------------------------------------------*
    *&      Form  user_command
    *       Handling custom function codes
    *      -->R_UCOMM      Function code value
    *      -->RS_SELFIELD  Info. of cursor position in ALV
    FORM user_command  USING    r_ucomm LIKE sy-ucomm
                               rs_selfield TYPE slis_selfield.* Local data declaration
      DATA: li_tab TYPE REF TO data,
            l_line TYPE REF TO data.* Local field-symbols
      FIELD-SYMBOLS:<l_tab> TYPE table,
                    <l_wa>  TYPE ANY.* Create table
      CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
      ASSIGN li_tab->* TO <l_tab>.* Create workarea
      CREATE DATA l_line LIKE LINE OF <l_tab>.
      ASSIGN l_line->* TO <l_wa>.  CASE r_ucomm.*   When a record is selected
        WHEN '&IC1'.*     Read the selected record
          READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
          rs_selfield-tabindex.      IF sy-subrc = 0.*       Store the record in an internal table
            APPEND <dyn_wa> TO <l_tab>.*       Fetch the field catalog info
            CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
              EXPORTING
                i_program_name         = 'Z_DEMO_PDF_JG'
                i_structure_name       = p_table
              CHANGING
                ct_fieldcat            = i_fieldcat
              EXCEPTIONS
                inconsistent_interface = 1
                program_error          = 2
                OTHERS                 = 3.
            IF sy-subrc = 0.*         Make all the fields input enabled except key fields
              w_field-input = 'X'.          MODIFY i_fieldcat FROM w_field TRANSPORTING input
              WHERE key IS INITIAL.        ENDIF.*       Display the record for editing purpose
            CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
              EXPORTING
                i_callback_program    = sy-repid
                i_structure_name      = p_table
                it_fieldcat           = i_fieldcat
                i_screen_start_column = 10
                i_screen_start_line   = 15
                i_screen_end_column   = 200
                i_screen_end_line     = 20
              TABLES
                t_outtab              = <l_tab>
              EXCEPTIONS
                program_error         = 1
                OTHERS                = 2.        IF sy-subrc = 0.*         Read the modified data
              READ TABLE <l_tab> INDEX 1 INTO <l_wa>.*         If the record is changed then track its index no.
    *         and populate it in an internal table for future
    *         action
              IF sy-subrc = 0 AND <dyn_wa> <> <l_wa>.
                <dyn_wa> = <l_wa>.
                i_index = rs_selfield-tabindex.
                APPEND i_index.
              ENDIF.
            ENDIF.      ENDIF.*   When save button is pressed
        WHEN 'SAVE'.*     Sort the index table
          SORT i_index.*     Delete all duplicate records
          DELETE ADJACENT DUPLICATES FROM i_index.      LOOP AT i_index.*       Find out the changes in the internal table
    *       and populate these changes in another internal table
            READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX i_index.
            IF sy-subrc = 0.
              APPEND <dyn_wa> TO <dyn_tab_temp>.
            ENDIF.      ENDLOOP.*     Lock the table
          CALL FUNCTION 'ENQUEUE_E_TABLE'
            EXPORTING
              mode_rstable   = 'E'
              tabname        = p_table
            EXCEPTIONS
              foreign_lock   = 1
              system_failure = 2
              OTHERS         = 3.      IF sy-subrc = 0.*       Modify the database table with these changes
            MODIFY (p_table) FROM TABLE <dyn_tab_temp>.        REFRESH <dyn_tab_temp>.*       Unlock the table
            CALL FUNCTION 'DEQUEUE_E_TABLE'
              EXPORTING
                mode_rstable = 'E'
                tabname      = p_table.      ENDIF.
      ENDCASE.  rs_selfield-refresh = 'X'.ENDFORM.                    "user_command
    Thanks,
    Sriram Ponna.

  • Problem with ALV Grid Display screen Back Button

    Dear Friends ,
    I have an ALV Grid Display,Here am facing a problem for my 'Back' button,i haven't defined any PF Status and is using the standard one.But after the Display when i press Back Button a blank Screen is appearing n then again i have to press back button to go to my Selection Screen.
    Please Suggest if i have to take care of something else.
    I want my Selection Screen when i press Back on my Display Screen.
    DATA:  IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
            EXPORTING
             I_BYPASSING_BUFFER          =
             I_BUFFER_ACTIVE             =
             I_INTERFACE_CHECK           = ' '
                 I_CALLBACK_PROGRAM          = 'ZRMMPD01A'
             I_CALLBACK_PF_STATUS_SET    = ' '
             I_CALLBACK_USER_COMMAND     = ' '
             I_CALLBACK_TOP_OF_PAGE      = ' '
             I_CALLBACK_HTML_TOP_OF_PAGE = ' '
             I_CALLBACK_HTML_END_OF_LIST = ' '
             I_STRUCTURE_NAME            =
             I_BACKGROUND_ID             = ' '
             I_GRID_TITLE                =
             I_GRID_SETTINGS             =
               IS_LAYOUT                     =  I_LAYOUT
               IT_FIELDCAT                 =  IT_FIELDCAT
             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
        IMPORTING
             E_EXIT_CAUSED_BY_CALLER     =
             ES_EXIT_CAUSED_BY_USER      =
             TABLES
                  T_OUTTAB                    = IT_FINAL
            EXCEPTIONS
                 PROGRAM_ERROR               = 1
                 OTHERS                      = 2
    Thanks and Regards,
    Ashwini

    Hi Vijay ,
    No i dont have any write statement in my proggram.
    Here it is
    REPORT ZRMMPD01A  NO STANDARD PAGE HEADING.
    TABLES : EQUI,SER03,MKPF,OBJK.
    TYPE-POOLS : SLIS.
    DATA  IT_EQUI LIKE EQUI OCCURS 0 WITH HEADER LINE.
    DATA  IT_OBJK LIKE OBJK OCCURS 0 WITH HEADER LINE..
    DATA  IT_SER03 LIKE SER03 OCCURS 0 WITH HEADER LINE.
    DATA  IT_MKPF LIKE MKPF OCCURS 0 WITH HEADER LINE .
    DATA : BEGIN OF IT_DISPLAY OCCURS 0,
                MATNR LIKE EQUI-MATNR,
                SERNR LIKE EQUI-SERNR,
                BWART LIKE SER03-BWART,
                WERK LIKE SER03-WERK,
                CHARGE LIKE SER03-CHARGE,
                LAGERORT LIKE SER03-LAGERORT,
                MBLNR LIKE SER03-MBLNR,
                MJAHR LIKE SER03-MJAHR,
                ZEILE LIKE SER03-ZEILE,
                BUDAT LIKE MKPF-BUDAT,
                BKTXT LIKE MKPF-BKTXT,
                USNAM LIKE MKPF-USNAM,
                XBLNR LIKE MKPF-XBLNR,
            END OF IT_DISPLAY.
    DATA : WA_DISPLAY LIKE IT_DISPLAY.
    DATA  IT_FINAL LIKE IT_DISPLAY OCCURS 0 WITH HEADER LINE.
    DATA  IT_TEMP LIKE IT_DISPLAY OCCURS 0 WITH HEADER LINE.
    DATA:  IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA :I_LAYOUT TYPE SLIS_LAYOUT_ALV,
          I_EVENTS TYPE SLIS_T_EVENT.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS : S_MATNR FOR EQUI-MATNR MATCHCODE OBJECT MCD,"OBLIGATORY
                    S_SERNR FOR EQUI-SERNR, "MATCHCODE OBJECT MCD OBLIGATORY
                    S_MBLNR FOR SER03-MBLNR MATCHCODE OBJECT MCD,
                    S_BWART FOR SER03-BWART MATCHCODE OBJECT MCD,
                    S_WERK FOR SER03-WERK MATCHCODE OBJECT MCD,
                    S_LAGET FOR SER03-LAGERORT MATCHCODE OBJECT MCD,
                    S_BUDAT FOR MKPF-BUDAT MATCHCODE OBJECT MCD,
                    S_XBLNR FOR MKPF-XBLNR MATCHCODE OBJECT MCD.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
    PARAMETERS : R1 RADIOBUTTON GROUP G1 DEFAULT 'X',
                 R2 RADIOBUTTON GROUP G1.
    SELECTION-SCREEN END OF BLOCK B2.
    START-OF-SELECTION.
    *Fetch Data.
      PERFORM GET_DATA.
    *Fill Display Fields.
      PERFORM FILL_TABLE.
    *Segregate data according to radio button selection.
      PERFORM SELECT_CONDITION.
    *Fill The Feild catalog.
      PERFORM FIELD_CATALOG.
    *Display Output.
      PERFORM OUTPUT_DISPLAY..
    *&      Form  GET_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DATA.
      SELECT * FROM EQUI INTO TABLE IT_EQUI
        WHERE MATNR IN S_MATNR
        AND SERNR IN S_SERNR.
      SELECT * FROM OBJK INTO TABLE IT_OBJK
      FOR ALL ENTRIES IN IT_EQUI
      WHERE EQUNR = IT_EQUI-EQUNR.
      SELECT * FROM SER03 INTO TABLE IT_SER03
      FOR ALL ENTRIES IN IT_OBJK
      WHERE OBKNR = IT_OBJK-OBKNR
      AND MBLNR IN S_MBLNR
      AND BWART IN S_BWART
      AND WERK IN S_WERK
      AND LAGERORT IN S_LAGET.
      SELECT * FROM MKPF INTO TABLE IT_MKPF
      FOR ALL ENTRIES IN IT_SER03
      WHERE MBLNR = IT_SER03-MBLNR
      AND BUDAT IN S_BUDAT
      AND XBLNR IN S_XBLNR.
    ENDFORM.                    " GET_DATA
    *&      Form  FILL_TABLE
          text
    -->  p1        text
    <--  p2        text
    FORM FILL_TABLE.
      LOOP AT IT_EQUI.
        LOOP AT IT_OBJK.
          IF IT_OBJK-EQUNR <> IT_EQUI-EQUNR.
            SKIP.
          ELSE.
            READ TABLE IT_SER03 WITH KEY OBKNR = IT_OBJK-OBKNR.
            IF SY-SUBRC = 0.
              WA_DISPLAY-MATNR = IT_EQUI-MATNR.
              WA_DISPLAY-SERNR = IT_EQUI-SERNR.
              WA_DISPLAY-BWART = IT_SER03-BWART.
              WA_DISPLAY-WERK = IT_SER03-WERK.
              WA_DISPLAY-CHARGE = IT_SER03-CHARGE.
              WA_DISPLAY-LAGERORT = IT_SER03-LAGERORT.
              WA_DISPLAY-MBLNR = IT_SER03-MBLNR.
              WA_DISPLAY-MJAHR = IT_SER03-MJAHR.
              WA_DISPLAY-ZEILE = IT_SER03-ZEILE.
             READ TABLE IT_MKPF WITH KEY MBLNR = IT_SER03-MBLNR.
              IF SY-SUBRC = 0.
                WA_DISPLAY-BUDAT = IT_MKPF-BUDAT.
                WA_DISPLAY-BKTXT = IT_MKPF-BKTXT.
                WA_DISPLAY-USNAM = IT_MKPF-USNAM.
                WA_DISPLAY-XBLNR = IT_MKPF-XBLNR.
              ENDIF.
            ENDIF.
          ENDIF.
          IF NOT WA_DISPLAY IS INITIAL.
            APPEND WA_DISPLAY TO IT_DISPLAY.
            CLEAR WA_DISPLAY.
          ENDIF.
        ENDLOOP.
      ENDLOOP.
    ENDFORM.                    " FILL_TABLE
    *&      Form  FIELD_CATALOG
          text
    -->  p1        text
    <--  p2        text
    FORM FIELD_CATALOG.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'MATNR'.
      FIELDCAT-SELTEXT_M = 'Material Number'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'SERNR'.
      FIELDCAT-SELTEXT_M = 'Serial number'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'MBLNR'.
      FIELDCAT-SELTEXT_L = 'Number of material document'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'BWART'.
      FIELDCAT-SELTEXT_M = 'Movement type'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'WERK'.
      FIELDCAT-SELTEXT_M = 'Plant'.
      FIELDCAT-OUTPUTLEN =  5.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'CHARGE'.
      FIELDCAT-SELTEXT_M = 'Batch number'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'LAGERORT'.
      FIELDCAT-SELTEXT_M = 'Storage Location'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'MJAHR'.
      FIELDCAT-SELTEXT_M = 'Material doc. year'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'ZEILE'.
      FIELDCAT-SELTEXT_L = 'Item in material document'.
      FIELDCAT-OUTPUTLEN =  18.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'BUDAT'.
      FIELDCAT-SELTEXT_L = 'Posting date in the document'.
      FIELDCAT-OUTPUTLEN =  10.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'BKTXT'.
      FIELDCAT-SELTEXT_L = 'Document header text'.
      FIELDCAT-OUTPUTLEN =  25.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'USNAM'.
      FIELDCAT-SELTEXT_M = 'User name'.
      FIELDCAT-OUTPUTLEN =  15.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
      FIELDCAT-TABNAME = 'IT_DISPLAY'.
      FIELDCAT-FIELDNAME = 'XBLNR'.
      FIELDCAT-SELTEXT_L = 'Reference document number'.
      FIELDCAT-OUTPUTLEN =  25.
      APPEND FIELDCAT TO IT_FIELDCAT.
      CLEAR FIELDCAT.
    ENDFORM.                    " FIELD_CATALOG
    *&      Form  DISPLAY_OUTPUT
          text
    -->  p1        text
    <--  p2        text
    FORM OUTPUT_DISPLAY.
      IF R1 = 'X'.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
              I_CALLBACK_PROGRAM          = 'ZRMMPD01A'
              IS_LAYOUT                   =  I_LAYOUT
              IT_FIELDCAT                 = IT_FIELDCAT
          TABLES
              T_OUTTAB                    = IT_DISPLAY
            EXCEPTIONS
                 PROGRAM_ERROR               = 1
                 OTHERS                      = 2
        IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        REFRESH IT_DISPLAY.
        CLEAR IT_DISPLAY.
      ELSEIF R2 = 'X'.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
            EXPORTING
                 I_CALLBACK_PROGRAM          = 'ZRMMPD01A'
                 IS_LAYOUT                     =  I_LAYOUT
                 IT_FIELDCAT                 =  IT_FIELDCAT
             TABLES
                  T_OUTTAB                    = IT_FINAL
            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.
        REFRESH IT_DISPLAY.
        CLEAR IT_DISPLAY.
      ENDIF.
    ENDFORM.                    " DISPLAY_OUTPUT
    *&      Form  SELECT_CONDITION
          text
    -->  p1        text
    <--  p2        text
    FORM SELECT_CONDITION.
      IF R2 = 'X'.
        CLEAR WA_DISPLAY.
        SORT IT_DISPLAY BY MATNR SERNR MBLNR ZEILE.
        DELETE ADJACENT DUPLICATES FROM IT_DISPLAY.
        LOOP AT IT_DISPLAY WHERE ZEILE = '0002'.
          READ TABLE IT_DISPLAY WITH KEY MATNR = IT_DISPLAY-MATNR
          SERNR = IT_DISPLAY-SERNR ZEILE = '0001'.
          IF SY-SUBRC = 0.
            DELETE IT_DISPLAY.
          ENDIF.
        ENDLOOP.
        SORT IT_DISPLAY BY MATNR SERNR BWART MBLNR.
        DELETE ADJACENT DUPLICATES FROM IT_DISPLAY.
        LOOP AT IT_DISPLAY.
          IF WA_DISPLAY IS INITIAL.
            WA_DISPLAY =  IT_DISPLAY.
          ENDIF.
          LOOP AT IT_DISPLAY WHERE MATNR = WA_DISPLAY-MATNR
          AND SERNR = WA_DISPLAY-SERNR.
            IF IT_DISPLAY-BUDAT > WA_DISPLAY-BUDAT.
              WA_DISPLAY = IT_DISPLAY.
            ELSE.
              DELETE IT_DISPLAY.
            ENDIF.
          ENDLOOP.
          APPEND WA_DISPLAY TO IT_TEMP.
          CLEAR WA_DISPLAY.
        ENDLOOP.
        DELETE ADJACENT DUPLICATES FROM IT_TEMP.
        IF NOT IT_TEMP[] IS INITIAL.
          IT_FINAL[] = IT_TEMP[].
        ENDIF.
      ENDIF.
    ENDFORM.                    " SELECT_CONDITION
    Regards,
    Ashwini

  • ALV GRID DISPLAY USING FACTORY METHODS

    Hi all
    I am using factory methods for my alv grid display.
    I have a list of functionalities, for which i am not able to find a correct method..
    1) Header of alv(with all the values of the selection-screen)
    2)How to give text to a subtotal(ed) column, i.e. if i subtotal a qty field against a sorted field, i want to display ==> Nett Wt. = 123.00 (for first header entry) and so on for each header entry.
    3)how to remove the zeroes from a quantity field?
    4) Displaying the cells as blanks where data is 0( for quantity fields if i have a cell with zero value, it should be blank.)
    5) double click on a cell to open a transaction with the cell's value.
    Any help on this would be appreciated.
    Points will be rewarded for sure...
    Thanks & Regards
    Ravish Garg

    Hello Ravish
    Regarding the display of zero values as empty cells have a look at my <i>modified </i>sample report <b>ZUS_SDN_CL_SALV_TABLE_INTERACT</b>.
    *& Report  ZUS_SDN_CL_SALV_TABLE_INTERACT
    REPORT  zus_sdn_cl_salv_table_interact.
    TYPE-POOLS: abap.
    DATA:
      gt_knb1        TYPE STANDARD TABLE OF knb1.
    DATA:
      go_table       TYPE REF TO cl_salv_table,
      go_events      TYPE REF TO cl_salv_events_table.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_double_click FOR EVENT
              if_salv_events_actions_table~double_click
              OF cl_salv_events_table
              IMPORTING
                row
                column.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_double_click.
    *   define local data
        DATA:
          lo_table   TYPE REF TO cl_salv_table,
          lt_orders  TYPE STANDARD TABLE OF bapiorders,
          ls_knb1    TYPE knb1.
        READ TABLE gt_knb1 INTO ls_knb1 INDEX row.
        IF ( syst-subrc = 0 ).
          CALL FUNCTION 'BAPI_SALESORDER_GETLIST'
            EXPORTING
              customer_number             = ls_knb1-kunnr
              sales_organization          = '1000'
    *         MATERIAL                    =
    *         DOCUMENT_DATE               =
    *         DOCUMENT_DATE_TO            =
    *         PURCHASE_ORDER              =
    *         TRANSACTION_GROUP           = 0
    *         PURCHASE_ORDER_NUMBER       =
    *       IMPORTING
    *         RETURN                      =
            TABLES
              sales_orders                = lt_orders.
    *     Create ALV grid instance
          TRY.
              CALL METHOD cl_salv_table=>factory
    *        EXPORTING
    *          LIST_DISPLAY   = IF_SALV_C_BOOL_SAP=>FALSE
    *          R_CONTAINER    =
    *          CONTAINER_NAME =
                IMPORTING
                  r_salv_table   = lo_table
                CHANGING
                  t_table        = lt_orders.
            CATCH cx_salv_msg .
          ENDTRY.
          lo_table->display( ).
    **      SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
    **      SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
    **      CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDMETHOD.                    "handle_double_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT        * FROM  knb1 INTO TABLE gt_knb1
             WHERE  bukrs  = '1000'.
    * Create ALV grid instance
      TRY.
          CALL METHOD cl_salv_table=>factory
    *    EXPORTING
    *      LIST_DISPLAY   = IF_SALV_C_BOOL_SAP=>FALSE
    *      R_CONTAINER    =
    *      CONTAINER_NAME =
            IMPORTING
              r_salv_table   = go_table
            CHANGING
              t_table        = gt_knb1.
        CATCH cx_salv_msg .
      ENDTRY.
    * Create event instance
      go_events = go_table->get_event( ).
    * Set event handler
      SET HANDLER:
        lcl_eventhandler=>handle_double_click FOR go_events.
      PERFORM modify_columns.
      go_table->display( ).
    END-OF-SELECTION.
    *&      Form  MODIFY_COLUMNS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM modify_columns .
    * define local data
      DATA:
        lt_dfies        TYPE ddfields,
        ls_dfies        TYPE dfies,
        lo_typedescr    TYPE REF TO cl_abap_typedescr,
        lo_strucdescr   TYPE REF TO cl_abap_structdescr,
        lo_tabledescr   TYPE REF TO cl_abap_tabledescr,
        lo_columns      TYPE REF TO cl_salv_columns_table,
        lo_column       TYPE REF TO cl_salv_column.
      lo_columns = go_table->get_columns( ).
      lo_typedescr = cl_abap_typedescr=>describe_by_data( gt_knb1 ).
      lo_tabledescr ?= lo_typedescr.
      lo_strucdescr ?= lo_tabledescr->get_table_line_type( ).
      lt_dfies = lo_strucdescr->get_ddic_field_list( ).
      LOOP AT lt_dfies INTO ls_dfies.
        lo_column = lo_columns->get_column( ls_dfies-fieldname ).
        IF ( ls_dfies-keyflag = abap_true ).
          CONTINUE.
        ELSEIF ( ls_dfies-fieldname = 'WEBTR' ).  " Bill of ex. limit
          lo_column->set_zero( if_salv_c_bool_sap=>true ).   " display zero
          lo_column->set_zero( if_salv_c_bool_sap=>false ).  " hide zero
        ELSE.
          lo_column->set_technical( if_salv_c_bool_sap=>true ).  " hide col
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " MODIFY_COLUMNS
    Regards
      Uwe

  • Dump when summing up CURR field in ALV GRID display

    Hi All,
    I am getting dump when I try to sum the CURR field in my ALV Grid Display. The field is of CURR 23.  I am using classes and methods to display alv grid.
    I tried passing <fs_fieldcat>-do_sum = 'X'. When I did this, it is dumping without even displaying the alv grid.
    Here is the part it is throwing dump:
            ls_lvc_data-value = space.
            clear ls_lvc_data-style.
            loop at it_fcat_local assigning <ls_fcat>
                    where tech ne 'X' and no_out ne 'X'.
              if l_invisible eq 'X'.
                clear l_invisible.
                if <ls_fcat>-do_sum is initial.
                  continue.
                else.
                  clear ls_lvc_data-col_pos.
                endif.
              endif.
              add 1 to ls_lvc_data-col_pos.
              assign component <ls_fcat>-fieldname
                               of structure <ls_data> to <l_field_value>.
              _if sy-subrc ne 0.
                message x000(0k).
              endif._
    Regards,
    Guru

    Thomas,
    Here is the dump:
    Runtime Errors         MESSAGE_TYPE_X
    Date and Time          10/22/2010 23:30:53
    Short text
    The current application triggered a termination with a short dump.
    What happened?
    The current application program detected a situation which really
    should not occur. Therefore, a termination with a short dump was
    triggered on purpose by the key word MESSAGE (type X).
    Error analysis
    Short text of error message:
    Long text of error message:
    Technical information about the message:
    Message class....... "0K"
    Number.............. 000
    Variable 1.......... " "
    Variable 2.......... " "
    Variable 3.......... " "
    Variable 4.......... " "
    How to correct the error
    Probably the only way to eliminate the error is to correct the program.
    If the error occures in a non-modified SAP program, you may be able to
    find an interim solution in an SAP Note.
    If you have access to SAP Notes, carry out a search with the following
    keywords:
    "MESSAGE_TYPE_X" " "
    "SAPLSLVC" or "LSLVCF36"
    "FILL_DATA_TABLE"
    If you cannot solve the problem yourself and want to send an error
    notification to SAP, include the following information:
    1. The description of the current problem (short dump)
    To save the description, choose "System->List->Save->Local File
    (Unconverted)".
    2. Corresponding system log
    Display the system log by calling transaction SM21.
    Restrict the time interval to 10 minutes before and five minutes
    after the short dump. Then choose "System->List->Save->Local File
    (Unconverted)".
    3. If the problem occurs in a problem of your own or a modified SAP
    program: The source code of the program
    In the editor, choose "Utilities->More
    Utilities->Upload/Download->Download".
    4. Details about the conditions under which the error occurred or which
    actions and input led to the error.
    Source Code Extract
    Line
    SourceCde
    2708
    is_subtottxt_info = ls_subtot_info
    2709
    ip_subtot_line    = lr_data
    2710
    changing
    2711
    c_subtottxt       = l_subtottxt.
    2712
    ls_lvc_data-value = l_subtottxt.
    2713
    2714
    append ls_lvc_data to ct_lvc_data.
    2715
    endif.
    2716
    2717
    2718
    Column per Fieldcat Entry
    2719
    2720
    ls_lvc_data-value = space.
    2721
    clear ls_lvc_data-style.
    2722
    loop at it_fcat_local assigning <ls_fcat>
    2723
    where tech ne 'X' and no_out ne 'X'.
    2724
    if l_invisible eq 'X'.
    2725
    clear l_invisible.
    2726
    if <ls_fcat>-do_sum is initial.
    2727
    continue.
    2728
    else.
    2729
    clear ls_lvc_data-col_pos.
    2730
    endif.
    2731
    endif.
    2732
    2733
    add 1 to ls_lvc_data-col_pos.
    2734
    2735
    assign component <ls_fcat>-fieldname
    2736
    of structure <ls_data> to <l_field_value>.
    2737
    if sy-subrc ne 0.
    >>>>>
    message x000(0k).
    2739
    endif.
    2740
    2741
    *... work on average
    2742
    if <ls_fcat>-do_sum eq 'C'.
    2743
              Initialize average result and entries
    2744
    <l_field_value> = 0.
    2745
    clear l_entries.
    2746
    2747
              retrive unit from fieldcatalog
    2748
    assign space to <l_unit>.
    2749
    if not <ls_fcat>-cfieldname is initial.
    2750
    assign component <ls_fcat>-cfieldname
    2751
    of structure <ls_data> to <l_unit>.
    2752
    endif.
    2753
    if not <ls_fcat>-qfieldname is initial.
    2754
    assign component <ls_fcat>-qfieldname
    2755
    of structure <ls_data> to <l_unit>.
    2756
    endif.
    2757

  • ALV GRID DISPLAY

    Hi,
    I'm modifying a program with ALV Grid Display.There are lot of Classes and Methods which i don't understand.
    In my program, the Program is executes and displays an Output. Now in the O/P , when I dbl click a field of a row a POP up is displayed with the existing value.now i can edit this value or Update with a new value.After closing the POP up the edited valueor the new value is displayed in the field. The program works good upto here.Now if my O/P has 20 Pages and if i edit a field in the 18 page, then after closing the popup the cursor ( or display ) is displayed in the 1 page( the 1 page of the O/P is displayed). Now, again, if i want to edit a field in the 18 page i have to scroll to the 18 page. Is there any way to hold the display at the 18 page after closing the POPUP.
    I arrived at using CALL METHOD <ref.var. to CL_GUI_ALV_GRID > ->set_current_cell_via_id
    EXPORTING
    IS_ROW_ID = <structure of type LVC_S_ROW >
    IS_COLUMN_ID = <structure of type LVC_S_COL >
    IS_ROW_NO = <structure of type LVC_S_ROID >.
    can some one help me how to pass values to is_row_id and all the parameters.
    Is there any other way?Thanks in advance.
    Thanks,
    Bhaskar.

    Dear Bhaskar,
    To acheieve this follow the below steps:
    1.  On double click first get the scroll information using the method GET_SCROLL_INFO_VIA_ID of class CL_GUI_ALV_GRID.
    CALL METHOD go_alv_grid->get_scroll_info_via_id
    IMPORTING
    es_row_no   = gv_s_roid
    es_row_info  = gv_s_row
    es_col_info  = gv_s_col.
    2.  Again at the end of your double click event call the method SET_SCROLL_INFO_VIA_ID to set the scroll.
    CALL METHOD go_alv_grid->set_scroll_info_via_id
    EXPORTING
    is_row_info = gv_s_row
    is_col_info = gv_s_col
    is_row_no  = gv_s_roid.
    Regards
    Kesava

  • Maximum number of character we can print in a column uing ALV grid display

    Hi frnds,
    My requirment is to print 500 charcter data in a column using ALV grid display.
    Could any body tell me is it possible and the maximum character it can i print in a column using ALV grid dispaly.
    Regards,
    Sandipan

    Hi Sandipan,
    refer notes 857823, 910300 and 959775. All these say there is a limitation of 128 characters.
    857823 - ALV grid: Strings with a maximum of 128 characters
    Symptom
    Entries in cells of the type CHAR or string are truncated after 128
    characters in the SAP GUI.
    also refer,
    ALV Grid Control (cl_gui_alv_grid), function module (Full-screen) Grid
    (Reuse_alv_grid_display, SAPLSLVC_FULLSCREEN), SAPGUI, back end, front end
    Cause and Prerequisites
    The data table that is sent to the front end only allows character values
    with the length 128.
    Solution
    This is the standard system behavior and cannot be changed.

  • How to change the selected row color in an alv grid display ?

    Hello ,
    I WANT TO CHANGE THE COLOR OF THE SELECTED RECORDS  IN AN ALV GRID DISPLAY ?
    ITS URGENT..
    WILL BE REWARDED...

    hai   Ssnagh Samala 
    EXicut This report >
    Hope It Will  Meet U r Requirement.
    If Found Helpfull Reward.
    REPORT zcuitest_alv_07.
    Use of colours in ALV grid (cell, line and column) *
    Table
    TABLES : mara.
    Type
    TYPES : BEGIN OF ty_mara,
    matnr LIKE mara-matnr,
    matkl LIKE mara-matkl,
    counter(4) TYPE n,
    free_text(15) TYPE c,
    color_line(4) TYPE c, " Line color
    color_cell TYPE lvc_t_scol, " Cell color
    END OF ty_mara.
    Structures
    DATA : wa_mara TYPE ty_mara,
    wa_fieldcat TYPE lvc_s_fcat,
    is_layout TYPE lvc_s_layo,
    wa_color TYPE lvc_s_scol.
    Internal table
    DATA : it_mara TYPE STANDARD TABLE OF ty_mara,
    it_fieldcat TYPE STANDARD TABLE OF lvc_s_fcat,
    it_color TYPE TABLE OF lvc_s_scol.
    Variables
    DATA : okcode LIKE sy-ucomm,
    w_alv_grid TYPE REF TO cl_gui_alv_grid,
    w_docking_container TYPE REF TO cl_gui_docking_container.
    PARAMETERS : p_column AS CHECKBOX,
    p_line AS CHECKBOX,
    p_cell AS CHECKBOX.
    START-OF-SELECTION.
    PERFORM get_data.
    END-OF-SELECTION.
    PERFORM fill_catalog.
    PERFORM fill_layout.
    CALL SCREEN 2000.
    *& Module status_2000 OUTPUT
    text
    MODULE status_2000 OUTPUT.
    SET PF-STATUS '2000'.
    ENDMODULE. " status_2000 OUTPUT
    *& Module user_command_2000 INPUT
    text
    MODULE user_command_2000 INPUT.
    DATA : w_okcode LIKE sy-ucomm.
    MOVE okcode TO w_okcode.
    CLEAR okcode.
    CASE w_okcode.
    WHEN 'BACK'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE. " user_command_2000 INPUT
    *& Module alv_grid OUTPUT
    text
    MODULE alv_grid OUTPUT.
    IF w_docking_container IS INITIAL.
    PERFORM create_objects.
    PERFORM display_alv_grid.
    ENDIF.
    ENDMODULE. " alv_grid OUTPUT
    *& Form create_objects
    text
    --> p1 text
    <-- p2 text
    FORM create_objects.
    Ratio must be included in http://5..95
    CREATE OBJECT w_docking_container
    EXPORTING
    ratio = 95
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    create_error = 3
    lifetime_error = 4
    lifetime_dynpro_dynpro_link = 5
    others = 6.
    CREATE OBJECT w_alv_grid
    EXPORTING
    i_parent = w_docking_container.
    ENDFORM. " create_objects
    *& Form display_alv_grid
    text
    --> p1 text
    <-- p2 text
    FORM display_alv_grid.
    CALL METHOD w_alv_grid->set_table_for_first_display
    EXPORTING
    is_layout = is_layout
    CHANGING
    it_outtab = it_mara
    it_fieldcatalog = it_fieldcat
    EXCEPTIONS
    invalid_parameter_combination = 1
    program_error = 2
    too_many_lines = 3
    OTHERS = 4.
    ENDFORM. " display_alv_grid
    *& Form get_data
    text
    --> p1 text
    <-- p2 text
    FORM get_data.
    SELECT * FROM mara UP TO 5 ROWS.
    CLEAR : wa_mara-color_line, wa_mara-color_cell.
    MOVE-CORRESPONDING mara TO wa_mara.
    ADD 1 TO wa_mara-counter.
    MOVE 'Blabla' TO wa_mara-free_text.
    IF wa_mara-counter = '0002'
    AND p_line = 'X'.
    Color line
    MOVE 'C410' TO wa_mara-color_line.
    ELSEIF wa_mara-counter = '0004'
    AND p_cell = 'X'.
    Color cell
    MOVE 'FREE_TEXT' TO wa_color-fname.
    MOVE '5' TO wa_color-color-col.
    MOVE '1' TO wa_color-color-int.
    MOVE '1' TO wa_color-color-inv.
    APPEND wa_color TO it_color.
    wa_mara-color_cell] = it_color[.
    ENDIF.
    APPEND wa_mara TO it_mara.
    ENDSELECT.
    ENDFORM. " get_data
    *& Form fill_catalog
    text
    --> p1 text
    <-- p2 text
    FORM fill_catalog.
    Colour code : *
    Colour is a 4-char field where : *
    - 1st char = C (color property) *
    - 2nd char = color code (from 0 to 7) *
    0 = background color *
    1 = blue *
    2 = gray *
    3 = yellow *
    4 = blue/gray *
    5 = green *
    6 = red *
    7 = orange *
    - 3rd char = intensified (0=off, 1=on) *
    - 4th char = inverse display (0=off, 1=on) *
    Colour overwriting priority : *
    1. Line *
    2. Cell *
    3. Column *
    DATA : w_position TYPE i VALUE '1'.
    CLEAR wa_fieldcat.
    MOVE w_position TO wa_fieldcat-col_pos.
    MOVE 'MATNR' TO wa_fieldcat-fieldname.
    MOVE 'MARA' TO wa_fieldcat-ref_table.
    MOVE 'MATNR' TO wa_fieldcat-ref_field.
    APPEND wa_fieldcat TO it_fieldcat.
    ADD 1 TO w_position.
    CLEAR wa_fieldcat.
    MOVE w_position TO wa_fieldcat-col_pos.
    MOVE 'MATKL' TO wa_fieldcat-fieldname.
    MOVE 'MARA' TO wa_fieldcat-ref_table.
    MOVE 'MATKL' TO wa_fieldcat-ref_field.
    Color column
    IF p_column = 'X'.
    MOVE 'C610' TO wa_fieldcat-emphasize.
    ENDIF.
    APPEND wa_fieldcat TO it_fieldcat.
    ADD 1 TO w_position.
    CLEAR wa_fieldcat.
    MOVE w_position TO wa_fieldcat-col_pos.
    MOVE 'COUNTER' TO wa_fieldcat-fieldname.
    MOVE 'N' TO wa_fieldcat-inttype.
    MOVE '4' TO wa_fieldcat-intlen.
    MOVE 'Counter' TO wa_fieldcat-coltext.
    APPEND wa_fieldcat TO it_fieldcat.
    ADD 1 TO w_position.
    CLEAR wa_fieldcat.
    MOVE w_position TO wa_fieldcat-col_pos.
    MOVE 'FREE_TEXT' TO wa_fieldcat-fieldname.
    MOVE 'C' TO wa_fieldcat-inttype.
    MOVE '20' TO wa_fieldcat-intlen.
    MOVE 'Text' TO wa_fieldcat-coltext.
    APPEND wa_fieldcat TO it_fieldcat.
    ENDFORM. " fill_catalog
    *& Form fill_layout
    text
    --> p1 text
    <-- p2 text
    FORM fill_layout.
    Field that identify color line in internal table
    MOVE 'COLOR_LINE' TO is_layout-info_fname.
    Field that identify cell color in inetrnal table
    MOVE 'COLOR_CELL' TO is_layout-ctab_fname.
    ENDFORM. " fill_layout
    Regards.
    Eshwar.

  • How change standard field lable in alv grid display

    Hi Experts,
        How are you doing! I am having some doubts in the alv grid display, I am new to this concepts.
    I want to display field  lable manually, actually its taking from table field discription but I want to display one field name manually.
    example code.
    ls_fldcat-fieldname = 'BPKIND'.
      ls_fldcat-ref_tabname = 'BUT000'.
      ls_fldcat-ref_fieldname = 'BPKIND'.
      APPEND ls_fldcat TO lt_fldcat.
      ls_fldcat-fieldname = 'PARTNER2'.
      ls_fldcat-ref_tabname = 'BUT051'.
      ls_fldcat-ref_fieldname = 'PARTNER2'.
    Here I dont want to display 'PARTNER2' I need 'KEY ACCOUNT MANAGER'.
    Please send me how to do this.
    Surya Ramireddy.

    Hi
      Please check out this program.
    Type-pools: slis.
    Tables: likp.
    Data: Begin of i_likp occurs 0,
            vbeln like likp-vbeln,
            ernam like likp-ernam,
            erzet like likp-erzet,
            erdat like likp-erdat,
          End of i_likp.
    Data: it_fieldcat type slis_t_fieldcat_alv,
          wa_fieldcat type SLIS_FIELDCAT_ALV,
          it_events type slis_t_event.
    Selection-screen: Begin of block b1 with frame title text-001.
      select-options: s_vbeln for likp-vbeln.
    Selection-screen: End of block b1.
    start-of-selection.
    perform get_sales_header_data.
    end-of-selection.
    perform field_catalogue.
    perform modify_field_catalogue.
    perform display_alv_grid_display.
    *&      Form  get_sales_header_data
          text
    -->  p1        text
    <--  p2        text
    form get_sales_header_data .
    select vbeln
           ernam
           erzet
           erdat
           into table i_likp
           from likp
           where vbeln in s_vbeln.
    endform.                    " get_sales_header_data
    *&      Form  field_catalogue
          text
    -->  p1        text
    <--  p2        text
    form field_catalogue .
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = sy-repid
       I_INTERNAL_TABNAME           = 'I_LIKP'
       I_INCLNAME                   = sy-repid
      CHANGING
        ct_fieldcat                  = it_fieldcat
    EXCEPTIONS
       INCONSISTENT_INTERFACE       = 1
       PROGRAM_ERROR                = 2
       OTHERS                       = 3
    endform.                    " field_catalogue
    *&      Form  modify_field_catalogue
          text
    -->  p1        text
    <--  p2        text
    form modify_field_catalogue .
    loop at it_fieldcat into wa_fieldcat.
    case wa_fieldcat-fieldname.
      when 'VBELN'.
       wa_fieldcat-col_pos = 1.
       wa_fieldcat-seltext_l = 'Sales Doc Header No'.
       wa_fieldcat-emphasize = 'C100'.
      when 'ERNAM'.
       wa_fieldcat-col_pos = 2.
       wa_fieldcat-seltext_l = 'Created By'.
       wa_fieldcat-emphasize = 'C200'.
      when 'ERZET'.
       wa_fieldcat-col_pos = 3.
       wa_fieldcat-seltext_l = 'Entry Time'.
       wa_fieldcat-emphasize = 'C300'.
      when 'ERDAT'.
       wa_fieldcat-col_pos = 4.
       wa_fieldcat-seltext_l = 'Created On'.
       wa_fieldcat-emphasize = 'C400'.
      endcase.
      modify it_fieldcat from wa_fieldcat.
    endloop.
    endform.                    " modify_field_catalogue
    *&      Form  display_alv_grid_display
          text
    -->  p1        text
    <--  p2        text
    form display_alv_grid_display .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = sy-repid
       IT_FIELDCAT                       = IT_FIELDCAT
      TABLES
        t_outtab                          = i_likp
    EXCEPTIONS
       PROGRAM_ERROR                     = 1
       OTHERS                            = 2
    endform.                    " display_alv_grid_display
    Regards
    Haritha.

  • Top of page in ALV GRID display

    Hi All,
    Is it possible to have a top of page in ALV grid display?
    If yes, then how?
    Thanks and Regards,
    Sirisha

    hi
    check out the following code:
    report  z_alv2 line-count 20.
    type-pools : slis.
    type-pools : icon.
    tables:
    lfa1, lfb1, lfm1.
    selection-screen begin of block b1  with frame title text-001.
    select-options:
    s_lifnr for lfa1-lifnr, "VENDOR
    s_bukrs for lfb1-bukrs, "COMPANY CODE
    s_ekorg for lfm1-ekorg, "PURCHASING ORGANIZATION
    s_ktokk for lfa1-ktokk. "ACCOUNT GROUP
    selection-screen end of block b1.
    selection-screen begin of block b2  with frame title text-002.
    parameters: r1 radiobutton group g1,
                r2 radiobutton group g1.
    selection-screen end of block b2.
    data:
          v_repid like sy-repid,
          begin of itab occurs 0,
          lifnr like lfa1-lifnr,
          bukrs like lfb1-bukrs,
          ekorg like lfm1-ekorg,
          ktokk like lfa1-ktokk,
          name1 like lfa1-name1,
          stras like lfa1-stras,
          ort01 like lfa1-ort01,
          regio like lfa1-regio,
          pfort like lfa1-pfort,
          pstlz like lfa1-pstlz,
          pstl2 like lfa1-pstl2,
          telf1 like lfa1-telf1,
          end of itab.
    data : itab_event type slis_t_event,
           wa_event   type slis_alv_event.
    data : itab_fld_cat  type slis_t_fieldcat_alv,
           wa_fldcat     type slis_fieldcat_alv.
    data : wa_layout     type slis_layout_alv.
    start-of-selection.
    *PERFORM GET_VARIANT.
    PERFORM data_validation.
      perform select_data.
      perform get_events using itab_event .
      perform fieldcatmerge.
      if r1 = 'X'.
        perform alvlistdisplay.
      elseif r2 = 'X' .
        perform alvgriddisplay.
      endif.
    *&      Form  DATA_VALIDATION
          text
    -->  p1        text
    <--  p2        text
    form data_validation .
      data: v_count type i.
      if s_lifnr is initial and
         s_bukrs is initial and
         s_ekorg is initial and
         s_ktokk is initial.
        message e000(z13325).
      Enter any value in the Selection Screen
      endif.
      select count(*) from lfa1 where lifnr in s_lifnr.
      if sy-subrc <> 0.
        message e000(z13325).
      Enter any value in the Selection Screen
      endif.
      select count(*) from lfb1 where lifnr in s_bukrs.
      if sy-subrc <> 0.
        message e000(z13325).
      Enter any value in the Selection Screen
      endif.
      select count(*) from lfm1 where lifnr in s_ekorg.
      if sy-subrc <> 0.
        message e000(z13325).
      Enter any value in the Selection Screen
      endif.
      select count(*) from lfa1 where lifnr in s_ktokk.
      if sy-subrc <> 0.
        message e000(z13325).
      Enter any value in the Selection Screen
      endif.
    endform.                    " DATA_VALIDATION
    *&      Form  SELECT_DATA
          text
    -->  p1        text
    <--  p2        text
    form select_data .
      select a~lifnr
             b~bukrs
             c~ekorg
             a~ktokk
             a~name1
             a~stras
             a~ort01
             a~regio
             a~pfort
             a~pstlz
             a~pstl2
             a~telf1
          into corresponding fields of table itab
          from lfa1 as a inner join lfb1 as b
                         on alifnr = blifnr
                         inner join lfm1 as c
                         on alifnr = clifnr
                         where a~lifnr in s_lifnr
                         and b~bukrs in s_bukrs
                         and c~ekorg in s_ekorg
                         and a~ktokk in s_ktokk.
      sort itab by lifnr bukrs ekorg.
    endform.                    " SELECT_DATA
    *&      Form  FIELDCATMERGE
          text
    -->  p1        text
    <--  p2        text
    form fieldcatmerge .
      v_repid = sy-repid.
      call function 'REUSE_ALV_FIELDCATALOG_MERGE'
       exporting
         i_program_name               =  v_repid
         i_internal_tabname           =  'ITAB'
        I_STRUCTURE_NAME             =
        I_CLIENT_NEVER_DISPLAY       = 'X'
         i_inclname                   = v_repid
        I_BYPASSING_BUFFER           =
        I_BUFFER_ACTIVE              =
        changing
          ct_fieldcat                  = itab_fld_cat
       exceptions
         inconsistent_interface       = 1
         program_error                = 2
         others                       = 3.
      if sy-subrc <> 0.
       message id sy-msgid type sy-msgty number sy-msgno
       with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    endform.                    " FIELDCATMERGE
    *&      Form  ALVLISTDISPLAY
          text
    -->  p1        text
    <--  p2        text
    form alvlistdisplay .
      v_repid = sy-repid.
      call function 'REUSE_ALV_LIST_DISPLAY'
        exporting
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
          i_callback_program             = v_repid
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
      I_STRUCTURE_NAME               =
          is_layout                      = wa_layout
          it_fieldcat                    = itab_fld_cat
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
          i_default                      = 'X'
       I_SAVE                         = 'A'
      IS_VARIANT                     =
          it_events                      = itab_event
       IT_EVENT_EXIT                 = itab_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
    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.
    endform.                    " ALVLISTDISPLAY
    *&      Form  ALVGRIDDISPLAY
          text
    -->  p1        text
    <--  p2        text
    form alvgriddisplay .
      call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
          i_callback_program                = v_repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
       I_GRID_TITLE                      = 'GRID DISPLAY'
      I_GRID_SETTINGS                   =
       IS_LAYOUT                         = WS_LAYOUT1
          it_fieldcat                       =  itab_fld_cat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
          it_events                         = itab_event
       IT_EVENT_EXIT                     = itab_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
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
    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.
    endform.                    " ALVGRIDDISPLAY
    *&      Form  GET_EVENTS
          text
    -->  p1        text
    <--  p2        text
    form get_events using itab_event type slis_t_event.
      call function 'REUSE_ALV_EVENTS_GET'
    EXPORTING
      I_LIST_TYPE           = 0
       importing
          et_events             = itab_event
       exceptions
         list_type_wrong       = 1
         others                = 2.
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    read table itab_event with key name = slis_ev_top_of_page into wa_event
      if sy-subrc = 0.
        wa_event-form = 'FRM_TOP_OF_PAGE'.
        modify itab_event from wa_event index sy-tabix.
      endif.
    endform.                    " GET_EVENTS
    *&      Form  FRM_TOP_OF_PAGE
          text
    form frm_top_of_page.
    write : 130 'Time:'  ,sy-uzeit  .
      write :/2 'User: ', sy-uname.
      write: 59 sy-title, 130 'Page:' , sy-pagno.
      write:/ 'this is swathi and this is top of page '.
    endform.                    "FRM_TOP_OF_PAGE
    Reward points if helpful.
    Regards
    Swathi

  • Push Button on Alv Grid display

    Hi experts,
       I strcuk in the middle of one program, i need to have push buttons on the output ALV Grid display, i have copied the standard status and used the same in the Function module for pf-status, iam able to get the output
    but my requirement is how to add the push buttons to the out put screen, as when iam clicking on status which i have copied iam unable to find where to add these push button in the application tool bar, iam unable to edit the push button can any body help me out, thanks in advance.

    Hello Madan
    I cannot help you with the FM-based ALV lists. However, for OO-based ALV grids (CL_GUI_ALV_GRID) I have a sample program that simulates radio buttons by using icons with hotspots.
    PROGRAM ZUS_SDN_BCALV_GRID_DEMO_2.
    * Based on: BCALV_GRID_DEMO.
    TYPE-POOLS: icon.
    TYPES: BEGIN OF ty_s_sflight.
    INCLUDE TYPE sflight.
    TYPES: button1    TYPE lvc_emphsz.
    TYPES: button2    TYPE lvc_emphsz.
    TYPES: button3    TYPE lvc_emphsz.
    TYPES: button4    TYPE lvc_emphsz.
    TYPES: END OF ty_s_sflight.
    DATA:
      gt_sflight    TYPE STANDARD TABLE OF ty_s_sflight,
      gt_fcat       TYPE lvc_t_fcat.
    DATA: ok_code LIKE sy-ucomm,
    *      gt_sflight TYPE TABLE OF sflight,
          g_container TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',
          grid1  TYPE REF TO cl_gui_alv_grid,
          g_custom_container TYPE REF TO cl_gui_custom_container.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-DATA:
          md_cnt    TYPE i.
        CLASS-METHODS:
          handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
            IMPORTING
              e_row_id
              e_column_id
              es_row_no
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_hotspot_click.
    * define local data
        FIELD-SYMBOLS:
          <ls_entry>    TYPE ty_s_sflight,
          <ld_fld>      TYPE ANY.
        READ TABLE gt_sflight ASSIGNING <ls_entry> INDEX es_row_no-row_id.
        CHECK ( <ls_entry> IS ASSIGNED ).
    *   Set all radio buttons "unselected"
        <ls_entry>-button1 =  icon_wd_radio_button_empty.
        <ls_entry>-button2 =  icon_wd_radio_button_empty.
        <ls_entry>-button3 =  icon_wd_radio_button_empty.
        <ls_entry>-button4 =  icon_wd_radio_button_empty.
        ASSIGN COMPONENT e_column_id-fieldname OF STRUCTURE <ls_entry>
                                                  TO <ld_fld>.
        IF ( <ld_fld> IS ASSIGNED ).
    *     Set selected radio button "selected".
          <ld_fld> = icon_wd_radio_button.
        ENDIF.
    *   Force PAI followed by refresh of table display in PBO
        CALL METHOD cl_gui_cfw=>set_new_ok_code
          EXPORTING
            new_code = 'DUMMY'
    *      IMPORTING
    *        RC       =
      ENDMETHOD.                    "handle_hotspot_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
    *       MAIN                                                          *
      PERFORM select_data.
      CALL SCREEN 100.
    *       MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
      SET PF-STATUS 'MAIN100'.
      IF g_custom_container IS INITIAL.
        CREATE OBJECT g_custom_container
               EXPORTING container_name = g_container.
        CREATE OBJECT grid1
               EXPORTING i_parent = g_custom_container.
        PERFORM build_fieldcatalog.
        CALL METHOD grid1->set_table_for_first_display
    *      EXPORTING
    *        i_structure_name = 'SFLIGHT'
          CHANGING
            it_fieldcatalog  = gt_fcat
            it_outtab        = gt_sflight.
    *   Set event handler for event TOOLBAR
        SET HANDLER:
          lcl_eventhandler=>handle_hotspot_click FOR grid1.
      else.
        CALL METHOD grid1->refresh_table_display
    *      EXPORTING
    *        IS_STABLE      =
    *        I_SOFT_REFRESH =
          EXCEPTIONS
            FINISHED       = 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.
      ENDIF.
    ENDMODULE.                    "PBO OUTPUT
    *       MODULE PAI INPUT                                              *
    MODULE pai INPUT.
    *   to react on oi_custom_events:
      CALL METHOD cl_gui_cfw=>dispatch.
      CASE ok_code.
        WHEN 'EXIT'.
          PERFORM exit_program.
        WHEN OTHERS.
    *     do nothing
      ENDCASE.
      CLEAR ok_code.
    ENDMODULE.                    "PAI INPUT
    *       FORM EXIT_PROGRAM                                             *
    FORM exit_program.
    *  CALL METHOD G_CUSTOM_CONTAINER->FREE.
    *  CALL METHOD CL_GUI_CFW=>FLUSH.
      LEAVE PROGRAM.
    ENDFORM.                    "EXIT_PROGRAM
    *&      Form  BUILD_FIELDCATALOG
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_fieldcatalog .
    * define local data
      DATA:
        ls_fcat        TYPE lvc_s_fcat,
        ls_hype        TYPE lvc_s_hype.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = 'LVC_S_FCAT'
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
    *     I_BYPASSING_BUFFER           =
    *     I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        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.
      DELETE gt_fcat WHERE ( fieldname <> 'EMPHASIZE' ).
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = 'SFLIGHT'
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
    *     I_BYPASSING_BUFFER           =
    *     I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        EXCEPTIONS
          inconsistent_interface       = 1
          program_error                = 2
          OTHERS                       = 3.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      READ TABLE gt_fcat INTO ls_fcat
           WITH KEY fieldname = 'EMPHASIZE'.
      IF ( syst-subrc = 0 ).
        DELETE gt_fcat INDEX syst-tabix.
      ENDIF.
      ls_fcat-fieldname = 'BUTTON4'.
      ls_fcat-icon    = 'X'.
      ls_fcat-hotspot = 'X'.
      INSERT ls_fcat INTO gt_fcat INDEX 4.
      ls_fcat-fieldname = 'BUTTON3'.
      INSERT ls_fcat INTO gt_fcat INDEX 4.
      ls_fcat-fieldname = 'BUTTON2'.
      INSERT ls_fcat INTO gt_fcat INDEX 4.
      ls_fcat-fieldname = 'BUTTON1'.
      INSERT ls_fcat INTO gt_fcat INDEX 4.
      LOOP AT gt_fcat INTO ls_fcat.
        ls_fcat-col_pos = syst-tabix.
        MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
      ENDLOOP.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  SELECT_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM select_data .
    * define local data
      DATA:
        ls_sflight    TYPE ty_s_sflight.
      SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE gt_sflight.
      ls_sflight-button1 = icon_wd_radio_button.
      ls_sflight-button2 = icon_wd_radio_button_empty.
      ls_sflight-button3 = icon_wd_radio_button_empty.
      ls_sflight-button4 = icon_wd_radio_button_empty.
      MODIFY gt_sflight FROM ls_sflight
          TRANSPORTING button1 button2 button3 button4
        WHERE ( carrid IS NOT INITIAL ).
    ENDFORM.                    " SELECT_DATA
    Regards
    Uwe

  • Problem with check box in ALV Grid Display

    I am Displaying Material Master Data in ALV Grid Display with Check Box for each record and if i checked check box then i am processing Update operation in Database,  my question is after perform update operation check box should be clear.
    Kindly help me!!!!

    Hello Raj
    Given the fact that you do not tell us the most important piece of information (namely whether you are using OO-based ALV or not) I assume you are using fm-based ALV lists.
    In this case you probably have defined a USER_COMMAND routine as described in the documentation of the fm.
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
    * define local data
      DATA: ls_outtab  LIKE LINE OF gt_outtab,
                ld_idx       TYPE i.
      LOOP AT gt_outtab INTO ls_outtab
                     WHERE ( chkbox = 'X' ).
        ld_idx = syst-tabix.
        " Call your update function / method / perform
       ls_outtab-chkbox = space.
       MODIFY gt_outtab FROM ls_outtab INDEX ld_Idx
          TRANSPORTING chkbox.
      ENDLOOP.
    " And now trigger refresh of the ALV display:
      rs_selfield-refresh = 'X'.  " <<< !!!
    ENDFORM.
    Regards
      Uwe

Maybe you are looking for

  • FI-SD AND FI-MM QUERIES.. PLEASE HELP

    Hi Gurus, Please help me with the following queries- 1. How movement type and valuation class helps in determining G/L A/C? 2. Where do I configure GL A/C as per movement type and valuation class? 3. Where I can see G/L postings of individual materia

  • ITunes Transfer

    What I wanted to do was transfer the "iTunes" folder on my old PC to my ext. hdd and go into iTunes on my new pc and change the "iTunes music location" pathway to the ext. hdd. After a lot of research i've found that it is not that simple and you cou

  • BPM Transformation Question

    Hi all, i have a BPM where i have 2 subsequent Transformation Steps within one block with the following properties Step1: SourceMessage = aaa TargetMessage = zzz Step2: SourceMessage = bbb TargetMessage = zzz As i have the same target message in both

  • Dynamic change of wage type texts on salary slip

    Hi Gurus. Maybe someone can help with a request. I want to do following. If someone input a wage type e.g. 6666 in Infotype 0015 I want to open a new input-field. In this input field the user should enter a text. In the payroll run I want to change t

  • Catalog Backups - any reason to keep old ones?

    I do a Catlog Backup once a week. I notice that Lightroom keeps previous backups and before I delete them, does anyone have a reason not to? The memory they collective use is starting to get into the multiple GB range and I'd rather not waste the spa