ALV  - coulmn names differ from Grid display to Excel download

Hi,
When I display report in ALV grid,  the layout looks fine. But the column headings and field output length differs from Grid to Excel sheet data.
suppose if some column heading is like ABCDEF and content is of 2 characters. Then it grid i am getting like ABCDEF. But in Excel I am getting it like ABC. ( which is seltext_S).
My question is why the layout is not being copied to Excel as it is like in GRID display??
Thanks in advance.
Praneet

HI,
Just Try this,
Eg: suppose this is the field VBELN
Declare in the internal table like
vbeln(10) type c,
instead of         vbeln     LIKE vbak-vbeln,
Hope it'll work

Similar Messages

  • Leading Zeros Missing - When exporting data from ALV grid display to Excel

    Hi,
    Am exporting the data from ALV GRID DISPLAY to Excel sheet using standard toolbar icon 'Local file'
    the leading zeros displayed in the ALV output is missing in the EXCEL sheet.
    (eg)  in ALV o/p - 0029. 
            in Excel - Only 29 is appearing.
    As per the requiement i have to show the leading zeros in excel also.
    Pls help on this issue.
    Thanks in advance..

    Hi ,
      Please set the property  :
      wa_fieldcat-lzero = 'X' .
    when you are creating field catalog for display alv data .
    your prob will solved .
    Regards ,
    Nilesh Jain

  • Why does icloud account name differ from Apple ID?

    Hi all. My first Apple product was an iPad (original). At the time I had to set up an account. I used an email address that is no longer active. I've got a new Apple ID - which references my current active email address.
    I also have an iPhone. The Apple ID is current, and I'm able to use it to purchase APPS, and login to view my profile, etc.
    But, in Settings on the iPhone, when I click on iCloud, and the Account, it lists the original account name (which is the no-long active email address) and a blocked-out password which I don't remember. I'm unable to view Payment Information because it requires a password. I can no longer get wireless  on my iPad because the Payment Information credit card has expired.
    So - in sum - my ICloud info is wrong and inaccessible, but my Apple ID is accessible. What should I do????

    Hello Alligusto,
    After reviewing your post, I have located an article that can help with iCloud accounts. It contains a number of troubleshooting steps and helpful advice for the issue you are experiencing:
    iCloud: Account troubleshooting - Apple Support
    If you're unable to resolve an account issue, contact iCloud Support.
    Thank you for contributing to Apple Support Communities.
    Cheers,
    BobbyD

  • 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

  • Excel download from ALV not working inproduction

    Hi all,
    I am using "set_table_for_first_display" for alv display. the excel download from alv is woking fine in development and quality stystem but in production only first 3-4 rows are getting downloaded. Other rows donot appear in excel.
    Any Idea !!!
    Thanks
    Madhu

    Hi Experts,
    I have noticed that same problem is occuring in development system also with same set of data . The ascii file created has some missing rows. I guess its due to some special characters though i am not able to see any special character . Any solution for this.
    Regs
    madhu

  • Not able to download all the rows to excel sheet from alv grid display

    Hi experts,
    I am not able to download all the rows which are displayed in alv grid display for some material numbers.
    for some materials i am able to download, i used two ways to download 1) from icon(local file) on grid 2) menu list->export.
    i checked in debugging till selecting the spread sheet pop up window, i am able to see all the data in internal table.
    Can you suggest me what will be the problem....
    thanks in advance,

    hi sandeep,
    sorry for didnt specify clearly.
    note: EX: "asaasdada  in this sentence i said  " this symbol is special character not the text.
    building final internal table code
    CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
        EXPORTING
          capid                 = p_capid
          datuv                 = sy-datum
          ehndl                 = '1'
          mktls                 = 'X'
          mehrs                 = 'X'
          mmory                 = '1'
          mtnrv                 = p_matnr
          stlal                 = '1'
          stpst                 = 0
          svwvo                 = 'X'
          werks                 = p_werks
          vrsvo                 = 'X'
        TABLES
          stb                   = i_stb
        EXCEPTIONS
          alt_not_found         = 1
          call_invalid          = 2
          material_not_found    = 3
          missing_authorization = 4
          no_bom_found          = 5
          no_plant_data         = 6
          no_suitable_bom_found = 7
          conversion_error      = 8
          OTHERS                = 9.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      i_stb1[] = i_stb[].
      IF NOT i_stb1[] IS INITIAL.
        SORT i_stb1 BY idnrk.
        DELETE ADJACENT DUPLICATES FROM i_stb1 COMPARING idnrk.
        SELECT bmatn ematn FROM ampl INTO TABLE i_ampl
          FOR ALL ENTRIES IN i_stb1
          WHERE bmatn = i_stb1-idnrk AND
                datuv LE sy-datum AND                          
                datub GE sy-datum.                              
        SELECT
        matnr
        bwkey
        verpr
        stprs
        bwprh
        FROM mbew
        INTO TABLE i_mbew
        FOR ALL ENTRIES IN i_stb1
        WHERE
            matnr EQ i_stb1-idnrk AND
            bwkey EQ i_stb1-werks.
        IF NOT i_stb1[] IS INITIAL.
          SELECT matnr werks beskz
                 dzeit webaz plifz                              
                 ekgrp                                         
          INTO TABLE i_marc
          FROM marc
          FOR ALL ENTRIES IN i_stb1
          WHERE matnr = i_stb1-idnrk
          AND werks = i_stb1-werks.
          SORT i_marc BY matnr werks.
        ENDIF.
        CLEAR i_ekpo.
        CLEAR i_vend.
        IF NOT i_stb1[] IS INITIAL.
          SELECT ebeln ebelp matnr werks loekz aedat
                 netpr peinh                                   
          INTO TABLE i_ekpo
          FROM ekpo
                FOR ALL ENTRIES IN i_stb1
                WHERE matnr = i_stb1-idnrk
                AND werks = i_stb1-werks.
          SORT i_ekpo BY matnr ASCENDING
                         aedat DESCENDING
                         ebeln DESCENDING
                         ebelp DESCENDING.
          IF NOT i_ekpo IS INITIAL.
            SELECT k~ebeln k~lifnr l~name1
            INTO TABLE i_vend
            FROM ekko AS k INNER JOIN lfa1 AS l
            ON k~lifnr EQ l~lifnr
            FOR ALL ENTRIES IN i_ekpo
            WHERE ebeln = i_ekpo-ebeln.
            SORT i_vend BY ebeln.
          ENDIF.
        ENDIF.
      ENDIF.
      i_ampl1[] = i_ampl[].
      IF NOT i_ampl1[] IS INITIAL.
        SORT i_ampl1 BY ematn.
        DELETE ADJACENT DUPLICATES FROM i_ampl1 COMPARING ematn.
        SELECT matnr mfrpn mfrnr FROM mara INTO TABLE i_mara
          FOR ALL ENTRIES IN i_ampl1
           WHERE matnr = i_ampl1-ematn.
      ENDIF.
      SORT i_ampl BY bmatn.
      IF NOT i_stb[] IS INITIAL.
        SELECT stlty stlnr stlkn stpoz idnrk potx1 potx2
        INTO TABLE i_stpo
        FROM stpo
        FOR ALL ENTRIES IN i_stb
        WHERE stlty = i_stb-stlty
          AND stlnr = i_stb-stlnr
          AND stlkn = i_stb-stlkn
          AND stpoz = i_stb-stpoz
          AND idnrk = i_stb-idnrk.
        SORT i_stpo BY stlty stlnr stlkn stpoz idnrk.
      ENDIF.
      LOOP AT i_stb INTO wa_stb.
        READ TABLE i_marc INTO wa_marc
        WITH KEY     matnr = wa_stb-idnrk
                     werks = wa_stb-werks
                     BINARY SEARCH.
        IF sy-subrc = 0.
          wa_outtab-beskz = wa_marc-beskz.
          wa_outtab-dzeit = wa_marc-dzeit.                      
          wa_outtab-webaz = wa_marc-webaz.                     
          wa_outtab-plifz = wa_marc-plifz.                     
          wa_outtab-ekgrp = wa_marc-ekgrp.                     
        ENDIF.
        READ TABLE i_ekpo INTO wa_ekpo
            WITH KEY matnr = wa_stb-idnrk.
        IF sy-subrc = 0.
          wa_outtab-netpr = wa_ekpo-netpr.                     
          wa_outtab-peinh = wa_ekpo-peinh.                     
          READ TABLE i_vend INTO wa_vend
          WITH KEY ebeln = wa_ekpo-ebeln
                   BINARY SEARCH.
          IF sy-subrc = 0.
            wa_outtab-lifnr = wa_vend-lifnr.
            wa_outtab-name_sup = wa_vend-name1.
          ENDIF.
        ENDIF.
        READ TABLE i_stpo INTO wa_stpo
        WITH KEY stlty = wa_stb-stlty
                 stlnr = wa_stb-stlnr
                 stlkn = wa_stb-stlkn
                 stpoz = wa_stb-stpoz
                 idnrk = wa_stb-idnrk
                 BINARY SEARCH.
        IF sy-subrc = 0.
          wa_outtab-potx1 = wa_stpo-potx1.
          wa_outtab-potx2 = wa_stpo-potx2.
        ENDIF.
        READ TABLE i_mbew INTO wa_mbew
        WITH KEY
        matnr = wa_stb-idnrk
        bwkey = wa_stb-werks.
        IF sy-subrc IS INITIAL.
          MOVE:
          wa_mbew-verpr TO wa_outtab-verpr,
          wa_mbew-stprs TO wa_outtab-stprs,
          wa_mbew-bwprh TO wa_outtab-bwprh.
        ENDIF.
        wa_outtab-matnr = p_matnr.
        wa_outtab-posnr = wa_stb-posnr.
        wa_outtab-stufe = wa_stb-stufe.
        wa_outtab-idnrk = wa_stb-idnrk.
        wa_outtab-ojtxb = wa_stb-ojtxp.
        wa_outtab-menge = wa_stb-menge.
        wa_outtab-meins = wa_stb-meins.
        MOVE: wa_stb-zzitem_draw_no TO wa_outtab-zzitem_draw_no.
        IF wa_stb-upskz = 'X'.
          SELECT * FROM stpu INTO TABLE i_stpu
                   WHERE  stlty = wa_stb-stlty AND
                          stlnr = wa_stb-stlnr AND
                          stlkn = wa_stb-stlkn AND
                          stpoz = wa_stb-stpoz.
        ENDIF.
        LOOP AT i_stpu INTO wa_stpu.
          wa_outtab-upmng = wa_stpu-upmng.
          wa_outtab-ebort = wa_stpu-ebort.
          wa_outtab-uposz = wa_stpu-uposz.
          CONCATENATE v_ebort wa_stpu-ebort      INTO v_ebort
          SEPARATED BY space.
        ENDLOOP.
        MOVE strlen( v_ebort ) TO v_len.
        MOVE: 0 TO x,
          128 TO y.
        DATA : lt_tab TYPE TABLE OF swastrtab.
        DATA : ls_tab LIKE LINE OF lt_tab.
        DATA : lv_ebort TYPE string.
        CLEAR lv_ebort. CLEAR lt_tab.
        MOVE v_ebort TO lv_ebort.
        CALL FUNCTION 'SWA_STRING_SPLIT'
          EXPORTING
            input_string                 = lv_ebort
            max_component_length         = 128
          TABLES
            string_components            = lt_tab
          EXCEPTIONS
            max_component_length_invalid = 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.
        IF lt_tab[] IS NOT INITIAL.
          LOOP AT lt_tab INTO ls_tab.
            CLEAR lv_ebort.
            MOVE: ls_tab-str TO lv_ebort.
            CONDENSE lv_ebort.
            MOVE lv_ebort TO wa_outtab-ebort.
            APPEND wa_outtab TO i_outtab.
            CLEAR:
            wa_outtab-matnr,
            wa_outtab-posnr,
            wa_outtab-zzitem_draw_no,
            wa_outtab-ojtxb,
            wa_outtab-menge,
            wa_outtab-meins,
            wa_outtab-uposz,
            wa_outtab-upmng,
            wa_outtab-verpr,
            wa_outtab-stprs,
            wa_outtab-bwprh,
            wa_outtab-lifnr,
            wa_outtab-name_sup,
            wa_outtab-potx1,
            wa_outtab-potx2,
            wa_outtab-netpr,
            wa_outtab-peinh.
    *        wa_outtab-idnrk.
          ENDLOOP.
        ELSE.
          APPEND wa_outtab TO i_outtab.
        ENDIF.
        CLEAR v_ebort.
        CLEAR: wa_stpu.
        REFRESH: i_stpu.
        LOOP AT i_ampl INTO wa_ampl WHERE bmatn = wa_stb-idnrk.
        READ TABLE i_mara INTO wa_mara WITH TABLE KEY matnr = wa_ampl-ematn.
          IF sy-subrc = 0.
            LOOP AT i_outtab INTO wa_outtab
            WHERE
            idnrk = wa_stb-idnrk AND
            flag NE 'X'.
              wa_outtab-mfrpn = wa_mara-mfrpn.
              wa_outtab-mfrnr = wa_mara-mfrnr.
              SELECT SINGLE name1 FROM lfa1 INTO wa_outtab-name1 WHERE lifnr = wa_mara-mfrnr.
              MOVE 'X' TO wa_outtab-flag.
              MODIFY i_outtab FROM wa_outtab
              TRANSPORTING mfrpn mfrnr name1 flag.
              EXIT.
            ENDLOOP.
            IF sy-subrc <> 0.
              CLEAR:
              wa_outtab-matnr,
              wa_outtab-posnr,
              wa_outtab-zzitem_draw_no,
              wa_outtab-ojtxb,
              wa_outtab-ebort,
    *          wa_outtab-idnrk,
              wa_outtab-menge,
              wa_outtab-meins,
              wa_outtab-uposz,
              wa_outtab-upmng,
              wa_outtab-verpr,
              wa_outtab-stprs,
              wa_outtab-bwprh,
              wa_outtab-lifnr,                                 
              wa_outtab-name_sup,                              
              wa_outtab-potx1,                                 
              wa_outtab-potx2,                                 
              wa_outtab-netpr,                                 
              wa_outtab-peinh.                                 
              wa_outtab-mfrpn = wa_mara-mfrpn.
              wa_outtab-mfrnr = wa_mara-mfrnr.
              SELECT SINGLE name1 FROM lfa1 INTO wa_outtab-name1 WHERE lifnr = wa_mara-mfrnr.
              APPEND wa_outtab TO i_outtab.
            ENDIF.
          ENDIF.
          REFRESH i_stpu.
          CLEAR i_stpu.
        ENDLOOP.    CLEAR: wa_matnr1, wa_mfrnr, wa_outtab.
      ENDLOOP.
    Edited by: srinivasareddy j on Mar 9, 2011 7:16 AM
    Edited by: srinivasareddy j on Mar 9, 2011 7:20 AM

  • Selecting Multiple Rows from ALV GRID Display

    Hi,
    I am having a ALV GRID Display. I want to select multiple rows from the Output and move them to an internal table.
    Please let me know how do I acheive this.
    Thanks in advance,
    Ishaq.

    Hi,
    Have a look on the following code. It displays the selected rows which hv been selected in basic list.
    TABLES:
      spfli.
    TYPE-POOLS:
      slis.
    DATA:
      BEGIN OF t_spfli OCCURS 0,
        checkbox.
            INCLUDE STRUCTURE spfli.
    DATA:  END OF t_spfli.
    DATA:
      t_sspfli LIKE STANDARD TABLE OF t_spfli .
    DATA:
      fs_spfli LIKE LINE OF t_sspfli.
    DATA:
      fs_layout TYPE  slis_layout_alv,
      w_program TYPE sy-repid.
    SELECT *
      FROM spfli
      INTO CORRESPONDING FIELDS OF TABLE t_spfli.
    *fs_layout-info_fieldname = 'COLOR'.
    fs_layout-box_fieldname = 'CHECKBOX'.
    w_program = sy-repid.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
      EXPORTING
        i_callback_program       = w_program
        i_callback_pf_status_set = 'FLIGHT'
        i_callback_user_command  = 'SPFLI_INFO'
        i_structure_name         = 'SPFLI'
        is_layout                = fs_layout
      TABLES
        t_outtab                 = t_spfli
      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.
    *&      Form  FLIGHT
          text
         -->RT_EXTAB   text
    FORM flight    USING rt_extab TYPE slis_t_extab..
      SET PF-STATUS 'FLIGHT' EXCLUDING rt_extab.
    ENDFORM.                    "FLIGHT
    *&      Form  SPFLI_INFO
          text
         -->UCOMM      text
         -->SELFIELD   text
    FORM spfli_info USING ucomm LIKE sy-ucomm
                           selfield TYPE slis_selfield.
      selfield-refresh = 'X'.
      CASE ucomm.
        WHEN 'FLIGHT'.
          LOOP AT t_spfli.
            IF t_spfli-checkbox = 'X'.
              t_spfli-checkbox = ' '.
             t_spfli-color = 'C51'.
              MODIFY t_spfli TRANSPORTING checkbox.
              fs_spfli = t_spfli.
              APPEND fs_spfli TO t_sspfli.
            ENDIF.
          ENDLOOP.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
      ENDCASE.
      CLEAR fs_spfli.
      fs_layout-info_fieldname = 'COLOR'.
    fs_layout-confirmation_prompt = 'X'.
      fs_layout-key_hotspot = 'X'.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program = w_program
          i_structure_name   = 'SFLIGHT'
          is_layout          = fs_layout
        TABLES
          t_outtab           = t_sspfli
        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 t_sspfli.
    ENDFORM.                    "SPFLI_INFO
    Regards,
    Chandu

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

  • Color a specific row in ALV GRID display when user clicks on that row

    hi
    i have the entire code ready of how to check the line selected by the user and also to color that line but after settings those parameters
    for to refresh the GRID so that the row apppears coloured .plz reply soon.... points will be awarded.....
    wat i have done is
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       i_callback_program                 = i_repid
       i_callback_user_command           = 'USER_COMMAND'
       is_layout                         = it_layout
       it_fieldcat                       = int_fieldcat
      TABLES
           t_outtab                          = int
      EXCEPTIONS
       program_error                     = 1
       OTHERS                            = 2.
    to display the GRID then when user clicks on any row this module gets called
       FORM user_command USING r_ucomm TYPE sy-ucomm
                               rs_selfield TYPE slis_selfield.
         READ TABLE int INDEX rs_selfield-tabindex.
         int-rowcolor = 'C410'.
         MODIFY  int INDEX rs_selfield-tabindex TRANSPORTING rowcolor.
         it_layout-info_fieldname = 'ROWCOLOR'.
    then  again i call 'REUSE_ALV_GRID_DISPLAY'
    to display the GRID with the user selected line colored . the problem with this is when u go back from this screen u go to the previously displayed grid ....... whihc i dont want .....
       ENDFORM.                    "user_command

    Hi,
    By using following code,you can set the colors for each row,
    Change this based on your requirement.
    TABLES VBAK.
    TYPE-POOLS SLIS.
    Data Declaration
    TYPES: BEGIN OF T_VBAK,
          VBELN TYPE VBAK-VBELN,
          ERDAT TYPE VBAK-ERDAT,
          ERNAM TYPE VBAK-ERNAM,
          AUDAT TYPE VBAK-AUDAT,
          VBTYP TYPE VBAK-VBTYP,
          NETWR TYPE VBAK-NETWR,
          VKORG TYPE VBAK-VKORG,
          VKGRP TYPE VBAK-VKGRP,
          LINE_COLOR(4) TYPE C,
          END OF T_VBAK.
    DATA: IT_VBAK TYPE STANDARD TABLE OF T_VBAK INITIAL SIZE 0,
          WA_VBAK TYPE T_VBAK.
    ALV Data Declaration
    DATA: FLDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
          GD_LAYOUT TYPE SLIS_LAYOUT_ALV,
          GD_REPID TYPE SY-REPID.
    START-OF-SELECTION.
    PERFORM DATA_RETRIEVAL.
    PERFORM BLD_FLDCAT.
    PERFORM BLD_LAYOUT.
    PERFORM DISPLAY_ALV_REPORT.
    Build Field Catalog for ALV Report
    FORM BLD_FLDCAT.
    FLDCAT-FIELDNAME = 'VBELN'.
    FLDCAT-SELTEXT_M = 'Sales Document'.
    FLDCAT-COL_POS = 0.
    *FLDCAT-EMPHASIZE = 'C411'.
    FLDCAT-OUTPUTLEN = 20.
    FLDCAT-KEY = 'X'.
    APPEND FLDCAT TO FLDCAT.
    CLEAR FLDCAT.
    FLDCAT-FIELDNAME = 'ERDAT'.
    FLDCAT-SELTEXT_L = 'Record Date created'.
    FLDCAT-COL_POS = 1.
    FLDCAT-KEY = 'X'.
    APPEND FLDCAT TO FLDCAT.
    CLEAR FLDCAT.
    FLDCAT-FIELDNAME = 'ERNAM'.
    FLDCAT-SELTEXT_L = 'Cteated Object Person Name'.
    APPEND FLDCAT TO FLDCAT.
    CLEAR FLDCAT.
    FLDCAT-FIELDNAME = 'AUDAT'.
    FLDCAT-SELTEXT_M = 'Document Date'.
    FLDCAT-COL_POS = 3.
    FLDCAT-EMPHASIZE = 'C110'.
    APPEND FLDCAT TO FLDCAT.
    CLEAR FLDCAT.
    FLDCAT-FIELDNAME = 'VBTYP'.
    FLDCAT-SELTEXT_L = 'SD Document category'.
    FLDCAT-COL_POS = 4.
    APPEND FLDCAT TO FLDCAT.
    CLEAR FLDCAT.
    FLDCAT-FIELDNAME = 'NETWR'.
    FLDCAT-SELTEXT_L = 'Net Value of the SO in Document Currency'.
    FLDCAT-COL_POS = 5.
    FLDCAT-OUTPUTLEN = 60.
    FLDCAT-DO_SUM = 'X'.
    FLDCAT-DATATYPE = 'CURR'.
    APPEND FLDCAT TO FLDCAT.
    CLEAR FLDCAT.
    FLDCAT-FIELDNAME = 'VKORG'.
    FLDCAT-SELTEXT_L = 'Sales Organization'.
    FLDCAT-COL_POS = 6.
    APPEND FLDCAT TO FLDCAT.
    CLEAR FLDCAT.
    FLDCAT-FIELDNAME = 'VKGRP'.
    FLDCAT-SELTEXT_M = 'Sales Group'.
    FLDCAT-COL_POS = 7.
    FLDCAT-EMPHASIZE = 'C801'.
    APPEND FLDCAT TO FLDCAT.
    CLEAR FLDCAT.
    ENDFORM.
    Build Layout for ALV Grid Report
    FORM BLD_LAYOUT.
    GD_LAYOUT-NO_INPUT = 'X'.
    GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    GD_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
    GD_LAYOUT-WINDOW_TITLEBAR = 'GRID DISPLAY'.
    GD_LAYOUT-CONFIRMATION_PROMPT = 'X'.  “ This asks the confirmation before leaving the screen.
    ENDFORM.
    Display report using ALV grid
    FORM DISPLAY_ALV_REPORT.
    GD_REPID = SY-REPID.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = GD_REPID
       IS_LAYOUT                         = GD_LAYOUT
       I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
       I_GRID_TITLE                      = 'SALES DOCUMENT HEADER'
       IT_FIELDCAT                       = FLDCAT[]
       I_SAVE                            = 'X'
      TABLES
        T_OUTTAB                          = IT_VBAK
    EXCEPTIONS
       PROGRAM_ERROR                     = 1
       OTHERS                            = 2.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.
    Retrieve data from VBAK table and populate itab IT_VBAK
    FORM DATA_RETRIEVAL.
    DATA LD_COLOR(1) TYPE C.
    SELECT VBELN ERDAT ERNAM AUDAT VBTYP NETWR VKORG
    UP TO 20 ROWS
    FROM VBAK
    INTO TABLE IT_VBAK.
    LOOP AT IT_VBAK INTO WA_VBAK.
    LD_COLOR = LD_COLOR + 1.
    IF LD_COLOR = 8.
      LD_COLOR = 1.
    ENDIF.
    CONCATENATE 'C' LD_COLOR '10' INTO WA_VBAK-LINE_COLOR.
    MODIFY IT_VBAK FROM WA_VBAK.
    ENDLOOP.
    ENDFORM.
    FORM TOP_OF_PAGE.
    DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
          W_HEADER TYPE SLIS_LISTHEADER.
    W_HEADER-TYP = 'H'.
    W_HEADER-INFO = 'WELCOME HEADER LIST'.
    APPEND W_HEADER TO T_HEADER.
    W_HEADER-TYP = 'S'.
    W_HEADER-KEY = 'REPORT:'.
    W_HEADER-INFO = SY-REPID.
    APPEND W_HEADER TO T_HEADER.
    W_HEADER-TYP = 'S'.
    W_HEADER-KEY = 'DATE:'.
    CONCATENATE SY-DATUM6(2) ' / ' SY-DATUM4(2) ' / ' SY-DATUM(4) INTO W_HEADER-INFO.
    APPEND W_HEADER TO T_HEADER.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = T_HEADER
    ENDFORM.
    Reward points,if it is useful.
    Thanks,
    chandu.

  • 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

  • To change the colour of the particular cell of ALV report in Grid display.

    Hai Friends,
                      I have created an Alv report in grid display .In that i want to change the colour of the particular cell.Plz provide the answer with a solved example.
             Thank u.

    This works for a Custom Control and OO ALV in a Dialog Module
    TABLES: kna1.
    * Data (for the ALV Grid)
    TYPES:
      BEGIN OF t_alv_data,
        cust_id    TYPE kunnr,        "Customer Number
        cust_name  TYPE name1_gp,     "Customer Name
        cust_color TYPE i,
    *   cell coloring field
        color     TYPE lvc_t_scol,   "Cell coloring
      END OF t_alv_data.
    DATA:
      v_alv_data TYPE t_alv_data,
      i_alv_data TYPE STANDARD TABLE OF t_alv_data.
    * ALV grid containers and objects
    DATA:
      o_alv_grid TYPE REF TO cl_gui_alv_grid,
      o_alv_cont TYPE REF TO cl_gui_custom_container.
    * ALV field catalog
    DATA:
      i_alv_fc TYPE lvc_t_fcat,
      v_alv_fc LIKE lvc_s_fcat.
    * ALV Layout (colors)
    DATA:
      v_alv_layout TYPE lvc_s_layo,
      i_alv_color TYPE lvc_t_scol,
      v_alv_color TYPE lvc_s_scol,
      v_alv_color_cell TYPE lvc_s_colo.
    * ALV variant
    DATA:
      v_alv_variant  TYPE disvariant.
    PARAMETERS:
      p_alvvar TYPE disvariant-variant DEFAULT 'DEFAULT'.
    DATA: ok_code LIKE sy-ucomm.
    * Class for event handling
    *       CLASS lcl_event_receiver DEFINITION
    * [+] Event listener for the ALV grid
    * [+] Handles hotspots and data changes
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
    *     Hotspot clicking
          hotspot_click
               FOR EVENT hotspot_click OF cl_gui_alv_grid
                 IMPORTING e_row_id
                           e_column_id
                           es_row_no,
    *     Data changed (such as checkbox clicking)
          handle_data_changed
            FOR EVENT data_changed OF cl_gui_alv_grid
                IMPORTING er_data_changed.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    *       CLASS lcl_event_receiver IMPLEMENTATION
    * [+] Implementation of the ALV Grid event handler class
    CLASS lcl_event_receiver IMPLEMENTATION.
    *       METHOD hotspot_click                                          *
    * [+] Calls evvent_hotspot_click when a hotspot is clicked in the ALV
      METHOD hotspot_click.
        PERFORM event_hotspot_click
                      USING e_row_id
                            e_column_id.
      ENDMETHOD.                    "hotspot_click
    *       METHOD handle_data_changed                                    *
    * [+] Updates the source data when the data in the ALV display has
    * been changed, such as by clicking a checkbox.
      METHOD handle_data_changed.
        DATA: lv_changed TYPE lvc_s_modi.
        LOOP AT er_data_changed->mt_good_cells INTO lv_changed
          WHERE fieldname = 'CUST_NAME'.
          READ TABLE i_alv_data INTO v_alv_data INDEX lv_changed-row_id.
          IF sy-subrc = 0.
            MOVE lv_changed-value TO v_alv_data-cust_name.
            MODIFY i_alv_data FROM v_alv_data INDEX lv_changed-row_id.
          ENDIF.
        ENDLOOP.
      ENDMETHOD.                    "handle_data_changed
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    * Reference to the event listener class
    DATA: event_receiver TYPE REF TO lcl_event_receiver.
    *       FORM build_event_listener
    * [+] Set the event handler on the ALV Grid
    FORM build_event_listener.
    * Assigning the event listener to the ALV
      CREATE OBJECT event_receiver.
      SET HANDLER event_receiver->handle_data_changed FOR o_alv_grid.
      SET HANDLER event_receiver->hotspot_click       FOR o_alv_grid.
    ENDFORM.                    "build_event_listener
    *       AT SELECTION-SCREEN
    *         ON VALUE-REQUEST FOR p_alvvar
    * [+] Calls choose_alv_variant to ask the user to select an alv grid
    *     layout variant
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_alvvar.
      PERFORM choose_alv_variant
        CHANGING
          p_alvvar
          v_alv_variant.
    *       START_OF_SELECTION
    START-OF-SELECTION.
      PERFORM get_data.
      SET PF-STATUS 'ALVSCREEN' IMMEDIATELY.
      CALL SCREEN 2000.
    *       FORM get_data
    * [+] Gets the data for the ALV grid
    FORM get_data.
      SELECT kunnr name1
        INTO (v_alv_data-cust_id,
              v_alv_data-cust_name)
        FROM kna1.
        APPEND v_alv_data TO i_alv_data.
      ENDSELECT.
    ENDFORM.                    "get_data
    *       MODULE build_alv_grid
    *   THIS SHOULD BE IN THE "PROCESS BEFORE OUTPUT" OF THE ALV SCREEN
    * [+] Builds the ALV Grid objects
    * [+] Calls to build the field catalog table
    * [+] Loads the field catalog table into the ALV Grid
    * [+] Loads the table data into the ALV Grid
    MODULE build_alv_grid OUTPUT.
      SET TITLEBAR  '2000'.
    * Also enables layout saving
      PERFORM set_alv_variant
        USING
          p_alvvar
        CHANGING
          v_alv_variant.
    * Building the grid and container on the screen
    * NOTE: the container name MUST be upper-case
    * Also, we don't want the objects to be created if in batch mode!
      IF sy-batch IS INITIAL.
        CREATE OBJECT o_alv_cont
          EXPORTING
            container_name = 'O_ALV_TABLE'.
      ENDIF.
      CREATE OBJECT o_alv_grid
        EXPORTING
          i_parent = o_alv_cont.
    * builds the event listener
      PERFORM build_event_listener.
    * Color the cells
      PERFORM color_cells.
    * Build the field catalog
      PERFORM build_alv_fc.
    * Loads the data into the grid
      CALL METHOD o_alv_grid->set_table_for_first_display
        EXPORTING
          i_save          = 'A'
          i_default       = 'X'
          is_variant      = v_alv_variant
          is_layout       = v_alv_layout
        CHANGING
          it_outtab       = i_alv_data
          it_fieldcatalog = i_alv_fc.
    ENDMODULE.                    "build_alv_grid OUTPUT
    *       FORM build_alv_fc
    * [+] Constructs the ALV Grid field catalog table
    FORM build_alv_fc.
      CLEAR i_alv_fc.
      REFRESH i_alv_fc.
    * NOTE: the field name MUST be upper-case
    *                   field       heading         hide  hot
    *                   name                        zero  spot  just
      PERFORM:
        alv_field USING 'CUST_ID'    'Cust ID'        ' '  'X'  'R',
        alv_field USING 'CUST_NAME'  'Customer Name'  ' '  ' '  'L',
        alv_field USING 'CUST_COLOR' 'Color'          ' '  ' '  'R'.
    ENDFORM.                    "build_alv_fc
    *       FORM alv_field
    * [+] Describes and constructs a single field for the ALV Grid field
    *     catalog. The field length and type are both obtained from the
    *     actual field passed in to this method.
    * [+] Adds the constructed field to the ALV Grid field catalog table
    FORM alv_field
      USING
        p_field_name TYPE c
        p_heading    TYPE c
        p_hide_zeros TYPE c
        p_hotspot    TYPE c
        p_justify    TYPE c.
      CLEAR v_alv_fc.
      DATA:
        lv_type(1) TYPE c,
        lv_length TYPE i,
        lv_heading_length TYPE i.
    * get the type and length of this field
      FIELD-SYMBOLS <field>.
      ASSIGN p_field_name TO <field>.
      DESCRIBE FIELD <field> TYPE lv_type OUTPUT-LENGTH lv_length.
    * re-adjust the length to the length of the header, if too short
      lv_heading_length = strlen( p_heading ).
      IF lv_length < lv_heading_length.
        lv_length = lv_heading_length.
      ENDIF.
    * NOTE: the field name MUST be upper-case
      v_alv_fc-fieldname = p_field_name.
      TRANSLATE v_alv_fc-fieldname TO UPPER CASE.
      v_alv_fc-inttype   = lv_type.
      v_alv_fc-outputlen = lv_length.
      v_alv_fc-coltext   = p_heading.
      v_alv_fc-seltext   = p_heading.
      v_alv_fc-hotspot   = p_hotspot.
    * Determining which fields should show zeros
      IF p_hide_zeros = 'X'.
        v_alv_fc-no_zero = 'X'.
        v_alv_fc-lzero   = ' '.
      ELSE.
        v_alv_fc-no_zero = ' '.
        v_alv_fc-lzero   = 'X'.
      ENDIF.
      v_alv_fc-just = p_justify.
    * Add the field to the field catalog
      APPEND v_alv_fc TO i_alv_fc.
    ENDFORM.                    "alv_field
    *       FORM choose_alv_variant
    * [+] Shows a popup that allows the user to choose the layout variant
    *     for the alv grid of the current program
    * [+] Usually called by an AT SELECTION-SCREEN method.
    FORM choose_alv_variant
      CHANGING
        p_variant_name TYPE disvariant-variant
        p_variant      TYPE disvariant.
      CLEAR p_variant.
      DATA:
        p_exit_check(1) TYPE c.
      MOVE sy-repid TO p_variant-report.
      CALL FUNCTION 'LVC_VARIANT_F4'
           EXPORTING
                is_variant = p_variant
                i_save     = 'A'
           IMPORTING
                e_exit     = p_exit_check
                es_variant = p_variant
           EXCEPTIONS
                not_found  = 1
                OTHERS     = 99.
      IF sy-subrc = 0.
        IF p_exit_check <> 'X'.
          p_variant_name = p_variant-variant.
        ENDIF.
      ENDIF.
    ENDFORM.                    "choose_alv_variant
    *       FORM set_alv_variant
    * [+] Sets the alv grid layout variant. Used for setting the variant
    *     when its name is entered in a parameter rather than by using the
    *     popup, or when loading the variant from a variable of type C
    FORM set_alv_variant
      USING
        p_variant_name TYPE disvariant-variant
      CHANGING
        p_variant      TYPE disvariant.
      MOVE sy-repid TO p_variant-report.
      p_variant-variant = p_variant_name.
    ENDFORM.                    "set_alv_variant
    *       FORM color_cells
    * [+] Loop through the data and apply coloring
    FORM color_cells.
      DATA:
        my_color  TYPE i.
    * tell the ALV grid what field in v_alv_data contains color information
      v_alv_layout-ctab_fname = 'COLOR'.
      my_color = 0.
    * loop through each row of the table
      LOOP AT i_alv_data INTO v_alv_data.
    *   clear the variables
        CLEAR:
          v_alv_color,
          v_alv_color_cell,
          i_alv_color.
        REFRESH:
          i_alv_color.
        v_alv_data-cust_color = my_color.
        PERFORM color_cell USING 'CUST_COLOR' my_color. "negative
    *   apply the colors
    *    IF v_alv_data-cust_name = 'Testing Credit'.
    *      PERFORM color_cell USING 'CUST_NAME' 6. "negative
    *    ELSEIF v_alv_data-cust_name = 'Goober Goober Also'.
    *      PERFORM color_cell USING 'CUST_NAME' 5. "positive
    *    ENDIF.
    *   set the color data for this table row
        v_alv_data-color = i_alv_color.
        MODIFY i_alv_data FROM v_alv_data.
        my_color = my_color + 1.
        IF my_color GT 7.
          CLEAR my_color.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    "color_cells
    *       FORM color_cell
    * [+] Colors a cell in the ALV grid
    FORM color_cell
      USING
        p_cellname TYPE c
        p_color    TYPE i.
      CLEAR:
        v_alv_color_cell,
        v_alv_color.
    * set the color for the cell
    *  IF p_color = 0.
    *    v_alv_color_cell-col = 0. "cl_gui_resources=>list_col_background.
    *  ELSEIF p_color = 1.
    *    v_alv_color_cell-col = 1. "cl_gui_resources=>list_col_heading.
    *  ELSEIF p_color = 2.
    *    v_alv_color_cell-col = 2. "cl_gui_resources=>list_col_normal.
    *  ELSEIF p_color = 3.
    *    v_alv_color_cell-col = 3. "cl_gui_resources=>list_col_total.
    *  ELSEIF p_color = 4.
    *    v_alv_color_cell-col = 4. "cl_gui_resources=>list_col_key.
    *  ELSEIF p_color = 5.
    *    v_alv_color_cell-col = 5. "cl_gui_resources=>list_col_positive.
    *  ELSEIF p_color = 6.
    *    v_alv_color_cell-col = 6. "cl_gui_resources=>list_col_negative.
    *  ELSEIF p_color = 7.
    *    v_alv_color_cell-col = 7. "cl_gui_resources=>list_col_group.
    *  ENDIF.
      v_alv_color_cell-col = p_color.
      v_alv_color-nokeycol = 'X'.
      v_alv_color-fname = p_cellname.
    *  v_alv_color-color = p_color.
      v_alv_color-color = v_alv_color_cell.
      APPEND v_alv_color TO i_alv_color.
    ENDFORM.                    "color_cell
    *       FORM event_hotspot_click
    * [+] What to do when clicking on a hotspot in the ALV Grid
    FORM event_hotspot_click
      USING
        p_row    TYPE lvc_s_row
        p_column TYPE lvc_s_col.
      DATA:
        lv_docnum TYPE kunnr.
      READ TABLE i_alv_data INTO v_alv_data INDEX p_row-index.
      IF p_column = 'CUST_ID'.
    *   call a transaction when the cust_id is clicked
        SET PARAMETER ID 'AUN' FIELD v_alv_data-cust_id.
        CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
      ENDIF.
    ENDFORM.                    "event_hotspot_click
    *&      Module  USER_COMMAND_2000  INPUT
    *       text
    MODULE user_command_2000 INPUT.
      CASE ok_code.
        WHEN 'BACK'
          OR 'STOP'
          OR 'CANCEL'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_2000  INPUT

  • ALV LIST/GRID DISPLAY

    Hi,
    My program output is in ALV format either LIST or GRID based on Sy-batch.
    In that program they are using table Z1021.
    They are retreiving data from Z1021 table based on selection screen parameters like werks, bukrs, vkorg,
    auart and date and passing that data to one internal table.
    SELECT * FROM Z1021 INTO TABLE i_z1021
    WHERE werks in s_werks
    AND       bukrs in s_bukrs
    AND       vkorg in s_vkorg
    AND       auart in s_auart
    AND       pgi_date in s_date.
    SORT i_z1021 BY werks bukrs vkorg auart pgi_date.
    For fieldcatlog they used function module REUSE_ALV_FIELDCATALOG_MERGE'.
    passing only i_structure_name  = c_struct_name in Exporting parameters
    retreive to i_fieldcat from Changing parameters.
    from above both they are passing i_z1021 table data and i_fieldcat to function module
    'REUSE_ALV_GRID_DISPLAY' OR 'REUSE_ALV_LIST_DISPLAY' based on sy-batch.
    That is my current program.
    My new requirement is given below.
    Additional and change to fields:
    1) Add Intercompany purchase order number
        From the document flow table VBFA.
        The field name is VBFA-VBELN when Subs.doc.categ (VBFA-VBTYP_N) equal to "V" after sales order line item.
    2) Change field name u2018Customeru2019 to u2018Ship-tou2019
    From VBFA table need to retrieve VBELN value based on VBELN_VA and POSNR_VA from Z1021 table
    where VBFA-VBELV = Z1021-VBELN_VA and VBFA-POSNV = Z1021-POSNR_VA.
    This is the condition to fetch that data.
    And I want to change the description of Field 'CUSTOMER'( Z1021-KUNNR) to' Ship-to'.
    Is it possible to do without changing the original logic.
    IF it is possible what is the solution ?
    If it is not possible without changing the original code then what is the solution for that also.
    Current Code:
    Some code i am giving here.
    TABLES: Z1021.
    DATA: i_z1021 LIKE z1021 OCCURS 0.
    CONSTANTS: c_struct_name LIKE dd02l-tabname VALUE 'Z1021'.
    START-OF-SELECTION.
    PERFORM get_data.
    END-OF-SELECTION.
    PERFORM list_display.
    FORM get_data.
    SELECT * FROM Z1021 INTO TABLE i_z1021
    WHERE werks in s_werks
    AND       bukrs in s_bukrs
    AND       vkorg in s_vkorg
    AND       auart in s_auart
    AND       pgi_date in s_date.
    SORT i_z1021 BY werks bukrs vkorg auart pgi_date.
    ENDFORM.
    FORM list_display.
    PERFORM create_fieldcatalog.
    < another performs>
    PERFORM display_list.
    ENDOFRM.
    FORM create_fieldcatalog.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
           i_structure_name    = c_struct_name
        CHANGING    
           ct_fieldcat               = i_fieldcat.
    ENDFORM.
    FORM display_list.
    CASE sy-batch.
      WHEN 'X'.
    CALL FUNCTION ;REUSE_ALV_LIST_DISPLAY'
      WHEN ' '.
    CALL FUNCTION ;REUSE_ALV_GRID_DISPLAY'
    ENDCASE
    ENDFORM.
    Could you please suggest on this.
    Thanks & Regards.
    VSR

    Hi
    After fill the field catalog table by function module MERGE, u can modify the value before moving it to ALV LIST/GRID display fm:
    FORM create_fieldcatalog.
      DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
          i_structure_name = c_struct_name
       CHANGING
         ct_fieldcat = i_fieldcat.
    LOOP AT I_FIELDCAT INTO LS_FIELDCAT.
        CASE LS_FIELDCAT-FIELDNAME.
           WHEN 'KUNNR'.
            LS_FIELDCAT-SELTEXT_L = <new descrip.>.
            LS_FIELDCAT-SELTEXT_M = <new descrip.>.
            LS_FIELDCAT-SELTEXT_S = <new descrip.>.
            MODIFY I_FIELDCAT FROM LS_FIELDCAT.
        ENDCASE.
    ENDLOOP.
    ENDFORM.
    Max
    Edited by: max bianchi on Jan 29, 2009 8:15 PM

  • How to devide the top of page in alv grid display

    hi all
    in the alv grid display am getting the page number and total number of pages in the left hand side
    but what i need is i need in the right hand side
    how to get that

    Hi,
    PLease refer to the code below:
    *& Report  ZDEMO_ALVGRID                                               *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic requirement for this demo is to display a number of       *
    *& fields from the EKKO table.                                         *
    REPORT  zdemo_alvgrid                 .
    TABLES:     ekko.
    type-pools: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid,
          gt_events     type slis_t_event,
          gd_prntparams type slis_print_alv.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform build_events.
    perform build_print_params.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
    *       Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    * There are a number of ways to create a fieldcat.
    * For the purpose of this example i will build the fieldcatalog manualy
    * by populating the internal table fields individually and then
    * appending the rows. This method can be the most time consuming but can
    * also allow you  more control of the final product.
    * Beware though, you need to ensure that all fields required are
    * populated. When using some of functionality available via ALV, such as
    * total. You may need to provide more information than if you were
    * simply displaying the result
    *               I.e. Field type may be required in-order for
    *                    the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    *  fieldcatalog-do_sum      = 'X'.
    *  fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-do_sum      = 'X'.
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    *  gd_layout-totals_only        = 'X'.
    *  gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
    *                                         "click(press f2)
    *  gd_layout-zebra             = 'X'.
    *  gd_layout-group_change_edit = 'X'.
    *  gd_layout-header_text       = 'helllllo'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
    *       Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'USER_COMMAND'
    *            i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
    *            it_special_groups       = gd_tabgroup
                it_events               = gt_events
                is_print                = gd_prntparams
                i_save                  = 'X'
    *            is_variant              = z_template
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
      if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endform.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 10 rows
      from ekpo
      into table it_ekko.
    endform.                    " DATA_RETRIEVAL
    * Form  TOP-OF-PAGE                                                 *
    * ALV Report Header                                                 *
    Form top-of-page.
    *ALV Header declarations
    data: t_header type slis_t_listheader,
          wa_header type slis_listheader,
          t_line like wa_header-info,
          ld_lines type i,
          ld_linesc(10) type c.
    * Title
      wa_header-typ  = 'H'.
      wa_header-info = 'EKKO Table Report'.
      append wa_header to t_header.
      clear wa_header.
    * Date
      wa_header-typ  = 'S'.
      wa_header-key = 'Date: '.
      CONCATENATE  sy-datum+6(2) '.'
                   sy-datum+4(2) '.'
                   sy-datum(4) INTO wa_header-info.   "todays date
      append wa_header to t_header.
      clear: wa_header.
    * Total No. of Records Selected
      describe table it_ekko lines ld_lines.
      ld_linesc = ld_lines.
      concatenate 'Total No. of Records Selected: ' ld_linesc
                        into t_line separated by space.
      wa_header-typ  = 'A'.
      wa_header-info = t_line.
      append wa_header to t_header.
      clear: wa_header, t_line.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                it_list_commentary = t_header.
    *            i_logo             = 'Z_LOGO'.
    endform.
    *       FORM USER_COMMAND                                          *
    *       --> R_UCOMM                                                *
    *       --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    * Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
    *   Check field clicked on within ALVgrid report
        IF rs_selfield-fieldname = 'EBELN'.
    *     Read data table, using index of row user clicked on
          READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
    *     Set parameter ID for transaction screen field
          SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
    *     Sxecute transaction ME23N, and skip initial data entry screen
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDCASE.
    ENDFORM.
    *&      Form  BUILD_EVENTS
    *       Build events table
    form build_events.
      data: ls_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
           exporting
                i_list_type = 0
           importing
                et_events   = gt_events[].
      read table gt_events with key name =  slis_ev_end_of_page
                               into ls_event.
      if sy-subrc = 0.
        move 'END_OF_PAGE' to ls_event-form.
        append ls_event to gt_events.
      endif.
        read table gt_events with key name =  slis_ev_end_of_list
                               into ls_event.
      if sy-subrc = 0.
        move 'END_OF_LIST' to ls_event-form.
        append ls_event to gt_events.
      endif.
    endform.                    " BUILD_EVENTS
    *&      Form  BUILD_PRINT_PARAMS
    *       Setup print parameters
    form build_print_params.
      gd_prntparams-reserve_lines = '3'.   "Lines reserved for footer
      gd_prntparams-no_coverpage = 'X'.
    endform.                    " BUILD_PRINT_PARAMS
    *&      Form  END_OF_PAGE
    form END_OF_PAGE.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      write: sy-uline(50).
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    *&      Form  END_OF_LIST
    form END_OF_LIST.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    Thanks,
    Sriram Ponna.

  • How to focus a cell on ALV grid display

    hi,
    I need to set the focus to the first cell on the first row in the ALV grid.I am using object oriented ALV grid control.Can anyone help me out in this regard.
    Regards,
    Anil.

    Re: simple Grid display
    Have a look at below links. It contains sample code for alv grid.
    http://www.erpgenie.com/abap/controls/alvgrid.htm#Complete%20code%20for%20the%20ALV%20grid%20example
    http://www.sap-img.com/abap/sample-programs-on-alv-grid.htm
    http://sap.niraj.tripod.com/id64.html
    Also have a look at below for OO alv grid:
    http://help.sap.com/saphelp_erp2004/helpdata/en/0a/b5533cd30911d2b467006094192fe3/frameset.htm
    -->
    ABAP List Viewer
    The common features of report are column alignment, sorting, filtering, subtotals, totals etc. To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV).
    This helps us to implement all the features mentioned very effectively.
    Using ALV, We can have three types of reports:
    1. Simple Report
    2. Block Report
    3. Hierarchical Sequential Report
    There are some function modules which will enable to produce the above reports without much effort.
    All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.
    1. SIMPLE REPORT.
    The important function modules are
    a. Reuse_alv_list_display
    b. Reuse_alv_fieldcatalog_merge
    c. Reuse_alv_events_get
    d. Reuse_alv_commentary_write
    e. Reuse_alv_grid_display
    A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.
    The important parameters are :
    I. Export :
    i. I_callback_program : report id
    ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status iii. I_callback_user_command : routine where the function codes are handled iv. I_structure name : name of the dictionary table v. Is_layout : structure to set the layout of the report vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.
    II. Tables :
    i. t_outtab : internal table with the data to be output
    B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.
    The Important Parameters are :
    I. Export :
    i. I_program_name : report id
    ii. I_internal_tabname : the internal output table iii. I_inclname : include or the report name where all the dynamic forms are handled.
    II Changing
    ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is declared in the type pool SLIS.
    C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type
    Parameters :
    I. Import :
    Et_Events : The event table is returned with all possible CALLBACK events for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV.
    II. Export :
    I_List_type :
    0 = simple list REUSE_ALV_LIST_DISPLAY
    1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY
    2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND
    3 = hierarchical-sequential block list
    REUSE_ALV_BLOCK_LIST_HS_APPEND
    D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.
    Parameters :
    I. it_list_commentary : internal table with the headings of the type slis_t_listheader.
    This internal table has three fields :
    Typ : ‘H’ – header, ‘S’ – selection , ‘A’ - action Key : only when typ is ‘S’.
    Info : the text to be printed
    E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.
    Parameters : same as reuse_alv_list_display
    This is an example for simple list.
    2. BLOCK REPORT
    This is used to have multiple lists continuously.
    The important functions used in this report are:
    A. REUSE_ALV_BLOCK_LIST_INIT
    B. REUSE_ALV_BLOCK_LIST_APPEND
    C. REUSE_ALV_BLOCK_LIST_HS_APPEND
    D. REUSE_ALV_BLOCK_LIST_DISPLAY
    A. REUSE_ALV_BLOCK_LIST_INIT
    Parameters:
    I. I_CALLBACK_PROGRAM
    II. I_CALLBACK_PF_STATUS_SET
    III. I_CALLBACK_USER_COMMAND
    This function module is used to set the default gui status etc.
    B. REUSE_ALV_BLOCK_LIST_APPEND
    Parameters :
    Export :
    I. is_layout : layout settings for block II. it_fieldcat : field catalog III. i_tabname : internal table name with output data IV. it_events : internal table with all possible events
    Tables :
    i. t_outtab : internal table with output data.
    This function module adds the data to the block.
    Repeat this function for all the different blocks to be displayed one after the other.
    C. REUSE_ALV_BLOCK_LIST_HS_APPEND
    This function module is used for hierarchical sequential blocks.
    D. REUSE_ALV_BLOCK_LIST_DISPLAY
    Parameters : All the parameters are optional.
    This function module display the list with data appended by the above function.
    Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.
    3. Hierarchical reports :
    Hierarchical sequential list output.
    The function module is
    A. REUSE_ALV_HIERSEQ_LIST_DISPLAY
    Parameters:
    I. Export:
    i. I_CALLBACK_PROGRAM
    ii. I_CALLBACK_PF_STATUS_SET
    iii. I_CALLBACK_USER_COMMAND
    iv. IS_LAYOUT
    v. IT_FIELDCAT
    vi. IT_EVENTS
    vii. i_tabname_header : Name of the internal table in the program containing the output data of the highest hierarchy level.
    viii. i_tabname_item : Name of the internal table in the program containing the output data of the lowest hierarchy level.
    ix. is_keyinfo : This structure contains the header and item table field names which link the two tables (shared key).
    II. Tables
    i. t_outtab_header : Header table with data to be output ii. t_outtab_item : Name of the internal table in the program containing the output data of the lowest hierarchy level.
    slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using ‘REUSE_ALV_FIELDCATALOG_MERGE’.
    Important Attributes :
    A. col_pos : position of the column
    B. fieldname : internal fieldname
    C. tabname : internal table name
    D. ref_fieldname : fieldname (dictionary) E. ref_tabname : table (dictionary) F. key(1) : column with key-color G. icon(1) : icon H. symbol(1) : symbol I. checkbox(1) : checkbox J. just(1) : (R)ight (L)eft (C)ent.
    K. do_sum(1) : sum up
    L. no_out(1) : (O)blig.(X)no out
    M. outputlen : output length
    N. seltext_l : long key word
    O. seltext_m : middle key word
    P. seltext_s : short key word
    Q. reptext_ddic : heading (ddic)
    R. ddictxt(1) : (S)hort (M)iddle (L)ong
    S. datatype : datatype
    T. hotspot(1) : hotspot
    Simple ALV report
    http://www.sapgenie.com/abap/controls/alvgrid.htm
    http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    Go thru these programs they may help u to try on some hands on
    ALV Demo program
    BCALV_DEMO_HTML
    BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode BCALV_GRID_DEMO Simple ALV Control Call Demo Program BCALV_TREE_DEMO Demo for ALV tree control BCALV_TREE_SIMPLE_DEMO BC_ALV_DEMO_HTML_D0100
    Reward If useful

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

Maybe you are looking for

  • Cannot Edit Song Info

    I have several MP3 files that I cannot edit the info for. I just noticed/incurred this issue after upgrading to iTunes 9.0.0.70. After the iTunes 9.0.1.8 upgrade, I am still having the issue. When I try to click into a field, the cursor does not appe

  • IWeb page generates IE9 error for Google Maps API key

    My iWeb site generates an error in IE9 "This web site needs a different Google Maps API key". Is there any fix in iWeb for this? I've found this link that offers a solution for IE9 users. It seems to be a bug with IE9 mixed content security settings,

  • HT204308 Macbook Pro late 2013 keeps crashing

    My late 2013 Macbook Pro using 10.10.2 is crashing pretty much on a daily basis.  I am using Aperture 3.6.  Always seems to happen when I am using Aperture.  Then have to repair the library for inconsistencies.  Does anyone else have these problems?

  • Workflow and HR org stucture

    Hi Experts Please can you provide me advise of how a HR org structure should look to benefit workflow. For example, currently all our org units are in a flat structure but I think we'd be better off with a hierarchical structure i.e. with everyone at

  • Error when saving a book to PDF

    I had saved one previous copy of this unfinished book some time ago but now that I have finished it I get an error each time I try. After selecting save as PDF I get the error: "No pages from the document were selected to be printed". I have closed i