ALV with multiple header & dynamic columns

Hello All,
I have a requirement where in I need to print multiple header in alv.
For eg.
User Name : <Name_1>
Channel     : <Channel_1>
Sale Org    : <Sales Org_1>
Col1 Col2 Col3 Col4 Col5 Col6 Col7 Col8
User Name : <Name_2>
Channel     : <Channel_2>
Sale Org    : <Sales Org_2>
Col1 Col2 Col3 Col4 Col5 Col6 Col7 Col8
no of columns (Col1 , col2 )  are dynamic  . Which would be the best alv type do I need do use?  Is it possible using simple alv grid display. How to handle dynamic column.
Thnx.

it is not possible with normal grid or list.
I guess it is possible by using ALV Block list
Modified below program to get mutiple header
REPORT z_alv_block_list.
Type-pools
TYPE-POOLS: slis.
Data declarations.
DATA: BEGIN OF t_vbak OCCURS 0,
        vbeln TYPE vbeln,
        bstnk TYPE vbak-bstnk,
        erdat TYPE vbak-erdat,
        kunnr TYPE vbak-kunnr,
      END OF t_vbak.
DATA: BEGIN OF t_vbap OCCURS 0,
        vbeln  TYPE vbeln,
        matnr  TYPE vbap-matnr,
        netpr  TYPE vbap-netpr,
        waerk  TYPE vbap-waerk,
        kwmeng TYPE vbap-kwmeng,
        meins  TYPE vbap-meins,
      END OF t_vbap.
DATA: t_fieldcatalog1 TYPE slis_t_fieldcat_alv.
DATA: t_fieldcatalog2 TYPE slis_t_fieldcat_alv.
DATA: v_repid         TYPE syrepid.
DATA: s_layout        TYPE slis_layout_alv.
DATA: v_tabname       TYPE slis_tabname.
DATA: t_events        TYPE slis_t_event.
start-of-selection event.
START-OF-SELECTION.
  v_repid = sy-repid.
Get the fieldcatalog for the first block
  PERFORM get_fieldcat1 CHANGING t_fieldcatalog1.
Get the fieldcatalog for the second block
  PERFORM get_fieldcat2 CHANGING t_fieldcatalog2.
Get the data for the first block
  SELECT vbeln bstnk erdat kunnr UP TO 10 ROWS
         INTO TABLE t_vbak
         FROM vbak WHERE vbeln > '0060000100'.
Get the data for the second block
  SELECT vbeln matnr netpr waerk kwmeng meins UP TO 10
ROWS
         INTO TABLE t_vbap
         FROM vbap WHERE vbeln > '0060000100'.
init
  CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
       EXPORTING
            i_callback_program = v_repid.
First block
  v_tabname = 'ITAB1'.
  CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
       EXPORTING
            is_layout   = s_layout
            it_fieldcat = t_fieldcatalog1
            i_tabname   = v_tabname
            it_events   = t_events
       TABLES
            t_outtab    = t_vbak.
Second block
  v_tabname = 'ITAB2'.
  CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
       EXPORTING
            is_layout   = s_layout
            it_fieldcat = t_fieldcatalog2
            i_tabname   = v_tabname
            it_events   = t_events
       TABLES
            t_outtab    = t_vbap.
*Display
  CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
      FORM GET_FIELDCAT1                           
      Get the field catalog for the first block    
FORM get_fieldcat1 CHANGING lt_fieldcatalog TYPE
slis_t_fieldcat_alv.
  DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
Order number
  s_fieldcatalog-col_pos       = '1'.
  s_fieldcatalog-fieldname     = 'VBELN'.
  s_fieldcatalog-tabname       = 'T_VBAK'.
  s_fieldcatalog-ref_tabname   = 'VBAK'.
  s_fieldcatalog-ref_fieldname = 'VBELN'.
  APPEND s_fieldcatalog TO lt_fieldcatalog.
  CLEAR s_fieldcatalog.
Customer purchase order.
  s_fieldcatalog-col_pos       = '2'.
  s_fieldcatalog-fieldname     = 'BSTNK'.
  s_fieldcatalog-tabname       = 'T_VBAK'.
  s_fieldcatalog-ref_tabname   = 'VBAK'.
  s_fieldcatalog-ref_fieldname = 'BSTNK'.
  APPEND s_fieldcatalog TO lt_fieldcatalog.
  CLEAR s_fieldcatalog.
Creation date.
  s_fieldcatalog-col_pos       = '3'.
  s_fieldcatalog-fieldname     = 'ERDAT'.
  s_fieldcatalog-tabname       = 'T_VBAK'.
  s_fieldcatalog-ref_tabname   = 'VBAK'.
  s_fieldcatalog-ref_fieldname = 'ERDAT'.
  APPEND s_fieldcatalog TO lt_fieldcatalog.
  CLEAR s_fieldcatalog.
Customer
  s_fieldcatalog-col_pos       = '4'.
  s_fieldcatalog-fieldname     = 'KUNNR'.
  s_fieldcatalog-tabname       = 'T_VBAK'.
  s_fieldcatalog-ref_tabname   = 'VBAK'.
  s_fieldcatalog-ref_fieldname = 'KUNNR'.
  APPEND s_fieldcatalog TO lt_fieldcatalog.
  CLEAR s_fieldcatalog.
ENDFORM.
      FORM GET_FIELDCAT2                           
      Get the field catalog for the second block   
FORM get_fieldcat2 CHANGING lt_fieldcatalog TYPE
slis_t_fieldcat_alv.
  DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
Order number
  s_fieldcatalog-col_pos       = '1'.
  s_fieldcatalog-fieldname     = 'VBELN'.
  s_fieldcatalog-tabname       = 'T_VBAP'.
  s_fieldcatalog-ref_tabname   = 'VBAP'.
  s_fieldcatalog-ref_fieldname = 'VBELN'.
  APPEND s_fieldcatalog TO lt_fieldcatalog.
  CLEAR s_fieldcatalog.
Material number
  s_fieldcatalog-col_pos       = '2'.
  s_fieldcatalog-fieldname     = 'MATNR'.
  s_fieldcatalog-tabname       = 'T_VBAP'.
  s_fieldcatalog-ref_tabname   = 'VBAP'.
  s_fieldcatalog-ref_fieldname = 'MATNR'.
  APPEND s_fieldcatalog TO lt_fieldcatalog.
  CLEAR s_fieldcatalog.
Net price
  s_fieldcatalog-col_pos       = '3'.
  s_fieldcatalog-fieldname     = 'NETPR'.
  s_fieldcatalog-tabname       = 'T_VBAP'.
  s_fieldcatalog-ref_tabname   = 'VBAP'.
  s_fieldcatalog-ref_fieldname = 'NETPR'.
  s_fieldcatalog-cfieldname    = 'WAERK'.
  s_fieldcatalog-ctabname      = 'T_VBAP'.
  APPEND s_fieldcatalog TO lt_fieldcatalog.
  CLEAR s_fieldcatalog.
Currency.
  s_fieldcatalog-col_pos       = '4'.
  s_fieldcatalog-fieldname     = 'WAERK'.
  s_fieldcatalog-tabname       = 'T_VBAP'.
  s_fieldcatalog-ref_tabname   = 'VBAP'.
  s_fieldcatalog-ref_fieldname = 'WAERK'.
  APPEND s_fieldcatalog TO lt_fieldcatalog.
  CLEAR s_fieldcatalog.
Quantity
  s_fieldcatalog-col_pos       = '5'.
  s_fieldcatalog-fieldname     = 'KWMENG'.
  s_fieldcatalog-tabname       = 'T_VBAP'.
  s_fieldcatalog-ref_tabname   = 'VBAP'.
  s_fieldcatalog-ref_fieldname = 'KWMENG'.
  s_fieldcatalog-qfieldname    = 'MEINS'.
  s_fieldcatalog-qtabname      = 'T_VBAP'.
  APPEND s_fieldcatalog TO lt_fieldcatalog.
  CLEAR s_fieldcatalog.
UOM
  s_fieldcatalog-col_pos       = '6'.
  s_fieldcatalog-fieldname     = 'MEINS'.
  s_fieldcatalog-tabname       = 'T_VBAP'.
  s_fieldcatalog-ref_tabname   = 'VBAP'.
  s_fieldcatalog-ref_fieldname = 'MEINS'.
  APPEND s_fieldcatalog TO lt_fieldcatalog.
  CLEAR s_fieldcatalog.
ENDFORM.

Similar Messages

  • Help on ALV with multiple header/item output

    Dear all:
    Below is the actual working code on a multiple header/item display. The alv is supposed to output the details differently in each list. But somehow it only display the last i_tab I gave in all the list(they all look the same). Please help me out here how I can change my code to work properly. Thanks...
    *& Report  ZTEST2
    REPORT  ZTEST2.
    type-pools: slis.
    data : NUM1 type I,
           NUM type I,
           begin of str,
           client like mara-mandt,
           mat like mara-matnr,
           end of str,
           tab like standard table of str.
    data :wa2 type slis_alv_event ,
          tab2 like standard table of wa2,
          wa1 type   slis_layout_alv,
          wa type line of slis_t_fieldcat_alv,
           tab1 like standard table of wa.
           wa-reptext_ddic = 'Client Num'.
           wa-fieldname = 'CLIENT'.
           wa-tabname = 'TAB'.
           wa-ref_fieldname = 'MANDT'.
           wa-ref_tabname = 'MARA'.
           wa-seltext_l = 'CLIENT'.
           append wa to tab1.
           wa-reptext_ddic = 'Mat Number'.
           wa-fieldname = 'MAT'.
           wa-tabname = 'TAB'.
           wa-ref_fieldname = 'MATNR'.
           wa-ref_tabname = 'MARA'.
           wa-seltext_l = 'MATERIAL'.
           append wa to tab1.
          wa1-no_colhead = 'X'.
           wa2-NAME = SLIS_EV_TOP_OF_PAGE.
           wa2-FORM = 'WRITE_TOP_PAGE'.
           APPEND wa2 TO tab2.
    NUM = 0.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
      EXPORTING
        I_CALLBACK_PROGRAM             = sy-cprog.
    do 2 times.
    NUM1 = NUM1 + 10.
    refresh: tab.
    select mandt matnr up to NUM1 rows from mara into table tab.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
      EXPORTING
        IS_LAYOUT                        = wa1
        IT_FIELDCAT                      = tab1
        I_TABNAME                        = 'TAB'
        IT_EVENTS                        = tab2
      TABLES
        T_OUTTAB                         = tab.
    enddo.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
    FORM WRITE_TOP_PAGE.
      NUM = NUM + 1.
      WRITE: / ,
             / 'TABLE NUMBER :', NUM.
    ENDFORM.

    Hi Jim,
    yes for some reason ALV expects you to be using different tables. It seems that it does not save the contents of the tables at each call of 'append' rather it waits until 'display' to deal with the table contents at that time, which in your case is the 20 items.
    What you can do is use dynamic tables. check this out:
    REPORT  ZNRW_ALV_BLOCK                          .
    type-pools: slis.
    data : NUM1 type I,
    NUM type I.
    types:
    begin of str,
    client like mara-mandt,
    mat like mara-matnr,
    end of str.
    data
    tab type standard table of str.
    data :wa2 type slis_alv_event ,
    tab2 like standard table of wa2,
    wa1 type slis_layout_alv,
    wa type line of slis_t_fieldcat_alv,
    tab1 like standard table of wa.
    wa-reptext_ddic = 'Client Num'.
    wa-fieldname = 'CLIENT'.
    wa-tabname = 'TAB'.
    wa-ref_fieldname = 'MANDT'.
    wa-ref_tabname = 'MARA'.
    wa-seltext_l = 'CLIENT'.
    append wa to tab1.
    wa-reptext_ddic = 'Mat Number'.
    wa-fieldname = 'MAT'.
    wa-tabname = 'TAB'.
    wa-ref_fieldname = 'MATNR'.
    wa-ref_tabname = 'MARA'.
    wa-seltext_l = 'MATERIAL'.
    append wa to tab1.
    wa1-no_colhead = 'X'.
    wa2-NAME = SLIS_EV_TOP_OF_PAGE.
    wa2-FORM = 'WRITE_TOP_PAGE'.
    APPEND wa2 TO tab2.
    NUM = 0.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
    EXPORTING
    I_CALLBACK_PROGRAM = sy-cprog.
    DATA tabDREF TYPE REF TO DATA.
    FIELD-SYMBOLS <tab> TYPE table.
    do 2 times.
    CREATE DATA tabdref TYPE table of str.
    ASSIGN tabDREF->* TO <tab>.
    NUM1 = NUM1 + 10.
    refresh: tab.
    select mandt matnr up to NUM1 rows from mara into table <tab>.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
    EXPORTING
    IS_LAYOUT = wa1
    IT_FIELDCAT = tab1
    I_TABNAME = 'TAB'
    IT_EVENTS = tab2
    TABLES
    T_OUTTAB = <tab>.
    enddo.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
    FORM WRITE_TOP_PAGE.
    NUM = NUM + 1.
    WRITE: / ,
    / 'TABLE NUMBER :', NUM.
    ENDFORM.

  • Unable to create cross tab report with multiple level dynamic columns

    Hi Gurus,
    We are trying to develope group above cross tab report with BI Publisher.
    i am unable to achieve multiple level columns dynamically.Using cross tab wizard i can achieve single level measure column ,but not the second level column.
    Output should look like this:
    Country1
    Region1 Region2 Region3 --(level1 column)
    d1 d2 d3 d1 d2 d3 d1 d2 d3 -- (level2 column)
    Row1 10 20 30 70 80 90 40 70 90 --data
    Row2 21 24 54 65 23 64 64 76 87
    Here regions and d1 d2 d3 may vary based on xml data.Also we have page break on country.
    Thanks,
    Mahesh

    Hi kavipriya,
    Any update on this.I have set the rtf and xml to ur gmail id.
    Thanks,
    mahesh

  • ALV With Multiple Header information

    Hi Friends,
    I have the following requirement.
    Company Header Information 1
    Company Header Information 2
    Company Header Information 3
    Company Header Information 4
    Company Header Information 5
    Operator1 Details1
    Operator1 Details2
         Customer Information A
                 Sales InformationA1
                 Sales InformationA2
                 Sales InformationA3
                 Sales InformationA4
    Operator1 Information2
         Customer Information B
                 Sales InformationB1
                 Sales InformationB2
                 Sales InformationB3
                 Sales InformationB4
    Is this possible through any ALV?
    Thanks & Regards,
    Lijo Joseph

    hi,
    Execute this program nad check if this helps in ur requirement.
    *& Report  ZKEERTHI_ALV3                                               *
    REPORT  ZKEERTHI_ALV3   LINE-COUNT 100                        .
    *& tables declaration
    TABLES: MARA.
    *& type-pools declaration
    TYPE-POOLS: SLIS.
    *& data declaration
    DATA: G_REPID TYPE SY-REPID.
    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,  "mara
           WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA : IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,  "makt
           WA_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV.
    DATA : IT_FIELDCAT2 TYPE SLIS_T_FIELDCAT_ALV,  "marc
           WA_FIELDCAT2 TYPE SLIS_FIELDCAT_ALV.
    DATA: GT_PRINT TYPE SLIS_PRINT_ALV,
          WA_LAYOUT TYPE SLIS_LAYOUT_ALV,
          XS_EVENT  TYPE SLIS_ALV_EVENT,
          GT_XEVENTS TYPE SLIS_T_EVENT,
          GT_YEVENTS TYPE SLIS_T_EVENT,
          GT_ZEVENTS TYPE SLIS_T_EVENT,
          WA_SORT TYPE SLIS_SORTINFO_ALV,
          IT_SORT TYPE SLIS_T_SORTINFO_ALV.
    DATA: BEGIN OF IT_MARA OCCURS 0,
            MATNR LIKE MARA-MATNR,
            MTART LIKE MARA-MTART,
            MATKL LIKE MARA-MATKL,
            MEINS LIKE MARA-MEINS,
            NTGEW LIKE MARA-NTGEW,
          END OF IT_MARA.
    DATA: BEGIN OF IT_MAKT OCCURS 0,
            MATNR LIKE MAKT-MATNR,
            SPRAS LIKE MAKT-SPRAS,
            MAKTX LIKE MAKT-MAKTX,
            MAKTG LIKE MAKT-MAKTG,
          END OF IT_MAKT.
    DATA: BEGIN OF IT_MARC OCCURS 0,
            MATNR LIKE MARC-MATNR,
            WERKS LIKE MARC-WERKS,
            LADGR LIKE MARC-LADGR,
            MTVFP LIKE MARC-MTVFP,
            DISPR LIKE MARC-DISPR,
            DISMM LIKE MARC-DISMM,
            DISPO LIKE MARC-DISPO,
          END OF IT_MARC.
    *& initialisation
    INITIALIZATION.
    G_REPID = SY-REPID.
    *& selection screen
    SELECTION-SCREEN BEGIN OF BLOCK B WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS: S_MATNR FOR MARA-MATNR,
                    S_MTART FOR MARA-MTART.
    SELECTION-SCREEN END OF BLOCK B.
    *& start of selection
    START-OF-SELECTION.
    PERFORM GET_MARADETAILS.
    PERFORM GET_MAKTDETAILS.
    PERFORM GET_MARCDETAILS.
    *&      Form  get_maradetails
          text
    -->  p1        text
    <--  p2        text
    FORM GET_MARADETAILS .
    SELECT MATNR
           MTART
           MATKL
           MEINS
           NTGEW FROM MARA
           INTO TABLE IT_MARA
           WHERE MATNR IN S_MATNR AND
                 MTART IN S_MTART.
    ENDFORM.                    " get_maradetails
    *&      Form  get_maktdetails
          text
    -->  p1        text
    <--  p2        text
    FORM GET_MAKTDETAILS .
    SELECT MATNR
           SPRAS
           MAKTX
           MAKTG FROM MAKT INTO TABLE IT_MAKT
           FOR ALL ENTRIES IN IT_MARA
           WHERE MATNR = IT_MARA-MATNR..
    ENDFORM.                    " get_maktdetails
    *&      Form  get_marcdetails
          text
    -->  p1        text
    <--  p2        text
    FORM GET_MARCDETAILS .
    SELECT MATNR
           WERKS
           LADGR
           MTVFP
           DISPR
           DISMM
           DISPO FROM MARC
           INTO TABLE IT_MARC
           FOR ALL ENTRIES IN IT_MARA
           WHERE MATNR = IT_MARA-MATNR.
    ENDFORM.                    " get_marcdetails
    *& end of selection
    END-OF-SELECTION.
    PERFORM SORT_LIST.
    PERFORM MODIFY_FIELDCAT.
    PERFORM EVENT_LIST.
    PERFORM BLOCK_LIST.
    *&      Form  modify_fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM MODIFY_FIELDCAT .
    CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-TABNAME = 'IT_MARA'.
      WA_FIELDCAT-SELTEXT_L = 'MATERIAL NUM'.
      WA_FIELDCAT-COL_POS = 1.
      WA_FIELDCAT-OUTPUTLEN = 18.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'MTART'.
      WA_FIELDCAT-TABNAME = 'IT_MARA'.
      WA_FIELDCAT-SELTEXT_L = 'MAT TYPE'.
      WA_FIELDCAT-COL_POS = 2.
      WA_FIELDCAT-OUTPUTLEN = 5.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'MATKL'.
      WA_FIELDCAT-TABNAME = 'IT_MARA'.
      WA_FIELDCAT-SELTEXT_L = 'MAT GROUP'.
      WA_FIELDCAT-COL_POS = 3.
      WA_FIELDCAT-OUTPUTLEN = 10.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'MEINS'.
      WA_FIELDCAT-TABNAME = 'IT_MARA'.
      WA_FIELDCAT-SELTEXT_L = 'UNIT'.
      WA_FIELDCAT-COL_POS = 4.
      WA_FIELDCAT-OUTPUTLEN = 5.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'NTGEW'.
      WA_FIELDCAT-TABNAME = 'IT_MARA'.
      WA_FIELDCAT-DO_SUM = 'X'.
      WA_FIELDCAT-SELTEXT_L = 'QUANTITY'.
      WA_FIELDCAT-COL_POS = 5.
      WA_FIELDCAT-OUTPUTLEN = 15.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
    CLEAR WA_FIELDCAT1.
      WA_FIELDCAT1-FIELDNAME = 'MATNR'.
      WA_FIELDCAT1-TABNAME = 'IT_MAKT'.
      WA_FIELDCAT1-SELTEXT_L = 'MATERIAL NUM'.
      WA_FIELDCAT1-COL_POS = 1.
      WA_FIELDCAT1-OUTPUTLEN = 18.
    APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
      CLEAR WA_FIELDCAT1.
      WA_FIELDCAT1-FIELDNAME = 'SPRAS'.
      WA_FIELDCAT1-TABNAME = 'IT_MAKT'.
      WA_FIELDCAT1-SELTEXT_L = 'LANGUAGE'.
      WA_FIELDCAT1-COL_POS = 2.
      WA_FIELDCAT1-OUTPUTLEN = 2.
    APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
      CLEAR WA_FIELDCAT1.
      WA_FIELDCAT1-FIELDNAME = 'MAKTX'.
      WA_FIELDCAT1-TABNAME = 'IT_MAKT'.
      WA_FIELDCAT1-SELTEXT_L = 'MAT DESC'.
      WA_FIELDCAT1-COL_POS = 3.
      WA_FIELDCAT1-OUTPUTLEN = 40.
    APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
      CLEAR WA_FIELDCAT1.
      WA_FIELDCAT1-FIELDNAME = 'MAKTG'.
      WA_FIELDCAT1-TABNAME = 'IT_MAKT'.
      WA_FIELDCAT1-SELTEXT_L = 'GRP DESC'.
      WA_FIELDCAT1-COL_POS = 4.
      WA_FIELDCAT1-OUTPUTLEN = 40.
    APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
      CLEAR WA_FIELDCAT1.
    CLEAR WA_FIELDCAT2.
      WA_FIELDCAT2-FIELDNAME = 'MATNR'.
      WA_FIELDCAT2-TABNAME = 'IT_MARC'.
      WA_FIELDCAT2-SELTEXT_L = 'MATERIAL NUM'.
      WA_FIELDCAT2-COL_POS = 1.
      WA_FIELDCAT2-OUTPUTLEN = 18.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
      CLEAR WA_FIELDCAT2.
      WA_FIELDCAT2-FIELDNAME = 'WERKS'.
      WA_FIELDCAT2-TABNAME = 'IT_MARC'.
      WA_FIELDCAT2-SELTEXT_L = 'PLANT'.
      WA_FIELDCAT2-COL_POS = 2.
      WA_FIELDCAT2-OUTPUTLEN = 4.
      APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
      CLEAR WA_FIELDCAT2.
      WA_FIELDCAT2-FIELDNAME = 'LADGR'.
      WA_FIELDCAT2-TABNAME = 'IT_MARC'.
      WA_FIELDCAT2-SELTEXT_L = 'LOAD GRP'.
      WA_FIELDCAT2-COL_POS = 3.
      WA_FIELDCAT2-OUTPUTLEN = 4.
      APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
      CLEAR WA_FIELDCAT2.
      WA_FIELDCAT2-FIELDNAME = 'MTVFP'.
      WA_FIELDCAT2-TABNAME = 'IT_MARC'.
      WA_FIELDCAT2-SELTEXT_L = 'GRP CHK'.
      WA_FIELDCAT2-COL_POS = 4.
      WA_FIELDCAT2-OUTPUTLEN = 4.
      APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
      CLEAR WA_FIELDCAT2.
      WA_FIELDCAT2-FIELDNAME = 'DISPR'.
      WA_FIELDCAT2-TABNAME = 'IT_MARC'.
      WA_FIELDCAT2-SELTEXT_L = 'MRP PROFILE'.
      WA_FIELDCAT2-COL_POS = 5.
      WA_FIELDCAT2-OUTPUTLEN = 4.
      APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
      CLEAR WA_FIELDCAT2.
      WA_FIELDCAT2-FIELDNAME = 'DISMM'.
      WA_FIELDCAT2-TABNAME = 'IT_MARC'.
      WA_FIELDCAT2-SELTEXT_L = 'MRP TYPE'.
      WA_FIELDCAT2-COL_POS = 6.
      WA_FIELDCAT2-OUTPUTLEN = 4.
      APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
      CLEAR WA_FIELDCAT2.
      WA_FIELDCAT2-FIELDNAME = 'DISPO'.
      WA_FIELDCAT2-TABNAME = 'IT_MARC'.
      WA_FIELDCAT2-SELTEXT_L = 'MRP CON'.
      WA_FIELDCAT2-COL_POS = 7.
      WA_FIELDCAT2-OUTPUTLEN = 4.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
      CLEAR WA_FIELDCAT2.
    ENDFORM.                    " modify_fieldcat
    *&      Form  BLOCK_LIST
          text
    -->  p1        text
    <--  p2        text
    FORM BLOCK_LIST .
    CLEAR WA_LAYOUT.
    WA_LAYOUT-ZEBRA = 'X'.
    WA_LAYOUT-TOTALS_TEXT = 'TOTAL'.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
      EXPORTING
        I_CALLBACK_PROGRAM             = G_REPID
       I_CALLBACK_PF_STATUS_SET       = ' '
       I_CALLBACK_USER_COMMAND        = 'user_command'.
      IT_EXCLUDING                   =
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
      EXPORTING
        IS_LAYOUT                        = WA_LAYOUT
        IT_FIELDCAT                      = IT_FIELDCAT[]
        I_TABNAME                        = 'IT_MARA'
        IT_EVENTS                        = GT_XEVENTS
       IT_SORT                          = IT_SORT
      I_TEXT                           = ' '
      TABLES
        T_OUTTAB                         = IT_MARA
    EXCEPTIONS
      PROGRAM_ERROR                    = 1
      MAXIMUM_OF_APPENDS_REACHED       = 2
      OTHERS                           = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
      EXPORTING
        IS_LAYOUT                        = WA_LAYOUT
        IT_FIELDCAT                      = IT_FIELDCAT1
        I_TABNAME                        = 'IT_MAKT'
        IT_EVENTS                        = GT_YEVENTS
      IT_SORT                          =
      I_TEXT                           = ' '
      TABLES
        T_OUTTAB                         = IT_MAKT
    EXCEPTIONS
      PROGRAM_ERROR                    = 1
      MAXIMUM_OF_APPENDS_REACHED       = 2
      OTHERS                           = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
      EXPORTING
        IS_LAYOUT                        = WA_LAYOUT
        IT_FIELDCAT                      = IT_FIELDCAT2
        I_TABNAME                        = 'IT_MARC'
        IT_EVENTS                        = GT_ZEVENTS
      IT_SORT                          =
      I_TEXT                           = ' '
      TABLES
        T_OUTTAB                         = IT_MARC
    EXCEPTIONS
      PROGRAM_ERROR                    = 1
      MAXIMUM_OF_APPENDS_REACHED       = 2
      OTHERS                           = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK             = ' '
       IS_PRINT                      = GT_PRINT
      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        =
    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.                    " BLOCK_LIST
    *&      Form  EVENT_LIST
          text
    -->  p1        text
    <--  p2        text
    FORM EVENT_LIST .
    CLEAR XS_EVENT.
      XS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
      XS_EVENT-FORM = 'XTOP_OF_PAGE'.
      APPEND XS_EVENT TO GT_XEVENTS.
      CLEAR XS_EVENT.
      XS_EVENT-NAME = SLIS_EV_END_OF_PAGE.
      XS_EVENT-FORM = 'XEND_OF_PAGE'.
      APPEND XS_EVENT TO GT_XEVENTS.
      CLEAR XS_EVENT.
      XS_EVENT-NAME = SLIS_EV_TOP_OF_LIST.
      XS_EVENT-FORM = 'XTOP_OF_LIST'.
      APPEND XS_EVENT TO GT_XEVENTS.
      CLEAR XS_EVENT.
      XS_EVENT-NAME = SLIS_EV_END_OF_LIST.
      XS_EVENT-FORM = 'XEND_OF_LIST'.
      APPEND XS_EVENT TO GT_XEVENTS.
      CLEAR XS_EVENT.
      XS_EVENT-NAME = SLIS_EV_END_OF_PAGE.
      XS_EVENT-FORM = 'YEND_OF_PAGE'.
      APPEND XS_EVENT TO GT_YEVENTS.
      CLEAR XS_EVENT.
      XS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
      XS_EVENT-FORM = 'YTOP_OF_PAGE'.
      APPEND XS_EVENT TO GT_YEVENTS.
      CLEAR XS_EVENT.
      XS_EVENT-NAME = SLIS_EV_TOP_OF_LIST.
      XS_EVENT-FORM = 'YTOP_OF_LIST'.
      APPEND XS_EVENT TO GT_YEVENTS.
      CLEAR XS_EVENT.
      XS_EVENT-NAME = SLIS_EV_END_OF_LIST.
      XS_EVENT-FORM = 'YEND_OF_LIST'.
      APPEND XS_EVENT TO GT_YEVENTS.
      CLEAR XS_EVENT.
      XS_EVENT-NAME = SLIS_EV_END_OF_PAGE.
      XS_EVENT-FORM = 'ZEND_OF_PAGE'.
      APPEND XS_EVENT TO GT_ZEVENTS.
      CLEAR XS_EVENT.
      XS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
      XS_EVENT-FORM = 'ZTOP_OF_PAGE'.
      APPEND XS_EVENT TO GT_ZEVENTS.
      CLEAR XS_EVENT.
      XS_EVENT-NAME = SLIS_EV_TOP_OF_LIST.
      XS_EVENT-FORM = 'ZTOP_OF_LIST'.
      APPEND XS_EVENT TO GT_ZEVENTS.
      CLEAR XS_EVENT.
      XS_EVENT-NAME = SLIS_EV_END_OF_LIST.
      XS_EVENT-FORM = 'ZEND_OF_LIST'.
      APPEND XS_EVENT TO GT_ZEVENTS.
      CLEAR XS_EVENT.
    ENDFORM.                    " EVENT_LIST
    FORM XTOP_OF_PAGE.
    WRITE:/ 'TOP OF PAGE FOR MARA'.
    ENDFORM.
    FORM YTOP_OF_PAGE.
    WRITE:/ 'TOP OF PAGE FOR MAKT'.
    ENDFORM.
    FORM ZTOP_OF_PAGE.
    WRITE:/ 'TOP OF PAGE FOR MARC'.
    ENDFORM.
    FORM XEND_OF_PAGE.
    WRITE:/ 'END OF PAGE FOR MARA'.
    ENDFORM.
    FORM YEND_OF_PAGE.
    WRITE:/ 'END OF PAGE FOR MAKT'.
    ENDFORM.
    FORM ZEND_OF_PAGE.
    WRITE:/ 'END OF PAGE FOR MARC'.
    ENDFORM.
    FORM XTOP_OF_LIST.
    WRITE:/ 'TOP OF LIST FOR MARA'.
    ENDFORM.
    FORM YTOP_OF_LIST.
    WRITE:/ 'TOP OF LIST FOR MAKT'.
    ENDFORM.
    FORM ZTOP_OF_LIST.
    WRITE:/ 'TOP OF LIST FOR MARC'.
    ENDFORM.
    FORM XEND_OF_LIST.
    WRITE:/ 'END OF LIST FOR MARA'.
    ENDFORM.
    FORM YEND_OF_LIST.
    WRITE:/ 'END OF LIST FOR MAKT'.
    ENDFORM.
    FORM ZEND_OF_LIST.
    WRITE:/ 'END OF LIST FOR MARC'.
    ENDFORM.
    *&      Form  sort_list
          text
    -->  p1        text
    <--  p2        text
    FORM SORT_LIST .
      CLEAR WA_SORT.
      WA_SORT-FIELDNAME = 'MTART'.
      WA_SORT-SUBTOT = 'X'.
        APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
      WA_SORT-FIELDNAME = 'MATKL'.
    WA_SORT-SUBTOT = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
    ENDFORM.                    " sort_list
    regards,
    keerthi

  • Dynamic ALV with Static and Dynamic attributes

    Hi All,
    In my requirement we have some 5 static attributes and rest attributes needs needs to be dynamically created based upon the input selections. for eg my input for start date and end date is between 201023 to 201152 then weeks between this range should apear as dynamic columns.
    i am able to create a dummy alv table display with out populating data into it but unable to set the data to it . Kindly help me in solving this issue.
    Regards,
    Sana.

    You might have created a dynamic node, bind the data to this node and after that use the SET_DATA method of ALV interface controller to set the data by passing the dynamically created node.

  • Downloading .xls file with multiple rows and Columns

    Hi ALL,
    I need to genarate .xls file with multiple rows and and Columns and sent as an email.Since our customer having Problem with .CSV files need to genarate .XLS file.
    Please do the needful.
    Thanks
    Madhu

    Hi Madhu,
    You might also consider using Excel Spreadsheet XML as the target structure (namespace is urn:schemas-microsoft-com:office:spreadsheet).  When you double-click the resulting xml on a PC it automatically opens with Excel. So, users don't see a difference.  It will open up a lot of options with formatting including creating multiple worksheets if you wanted to.  Best of all you can stick with XML.
    See my response in this thread:
    Re: Convert XML data into XLS 
    Thanks,
    -Russ

  • Timesheet formulas in numbers '09 with multiple Start/Stop columns

    Hi there you amazing people
    I am creating a timesheet which will have the date, start time, stop time but also 3/4 start/stop times for breaks.
    I would like to have formulas that allow me to enter as many or as little info as I need (sometimes there are no breaks and sometimes there will be several) and still give me total hours works in that day.
    Apoliges if my quiery isn't clear or this has been answered before, I have had a good look!

    Hi Lil,
    Numbers '09 will think for you. Start with an empty table with one Header Row and enter the headings for your work day:
    In Cell A2, enter the Start Time as 8 am (not 8am)
    In Cell B2, enter Morning Coffee as 15 m (not 15m)
    In Cell C2, Lunch is 1 h (not 1h)
    In Cell D2, Afternoon Tea is 15 m (not 15m)
    In Cell E2, Stop Time is 5 pm (not 5pm)
    Please note the spaces (for example, 8 am, not 8am) then the cells will automatically format as Date-and-Time or Duration.
    Formula in F2 (and copy down) is
    =E2-A2-B2-C2-D2
    Tip: When you enter a Time, it carries a Date with it. The Date-and-Time format in Numbers is exactly that. A Date and a Time from 1 January 1904 (the starting date that Apple uses as the base date).
    Call back if this does not help.
    Regards,
    Ian

  • Re: to create outbound file with multiple header ,detail and trailor in informatica

    Dear Mohan Prakash, Please mentation The Target Which Format you need. Please let me know. Thanks & RegardsKasireddy+966545281845

    hi I want to create a file with muiltple header detail and trailorSample of my file  1F99500094959                    5F99000000999911025F99000000999912025F99000000999913029F99500094959                    1G83341002729803                5G83000000999918020109G83341002729803                1G83910377940                    5G830000009999190201011050003522029G83910377940                    T20110720000000900000006750{  In this file 1 is header and 5 is detail and 9 is trailer and in last T segment is also trailerI have any idea to create seperate 3 files and in lastconcatenate all file with the help of unixbut in my case data is so large (in millions) this approach is not use full please suggest my any ideaHow to create VSAM file

  • Displaying columns of alv with Main Heading and Sub Heading

    Hi friends.
    I have certain fields in display of ALV.
    Out of all fields(columns), I would have to display some columns with one Main Heading,Below it's being split in multiple rows.
    I have data relevent to that multiple fields.
    Let say ,
    In first row it will show |Allowance            |
    In second                 |HRA    |PA   | OTHERS|
    Thanks And Regards,
    Amit Raut

    Hi,
    This is not possible
    Refer these links
    Re: ALV query
    Re: Multiple lines in alv column headings
    If this solves ur problem reward points and close the thread

  • Report with multiple choice in column for same dimension......

    Hi All,
    We have a report with two dimensions in col , one in row remaining in pov...user want to select multiple members [its more than 10 members..so we thought prompts will not be good.] for one column for different members in second dimension of column and want see the variance between them.
    can anyone suggest me how can i achieve this. thank you
    regards,
    Ravi

    Hi All,
    Can any one suggest me on this. thanks inadvance.
    Regards,
    Ravi

  • ALV with multiple headers

    Hello All,
         i have a requirement where i have to have multiple headers in a single alv.
    The exact requirement is like.
    Header1----
    row1
    row2                     1 unit
    row3
    row4----
    Header2
    row1
    row2
    row3
    row4
    Header3
    row1
    row2
    row3
    row4
    and the number of individual units is not fixed and will be determined at runtime.
    Can somebody tell me the steps to achieve it.
    actually i tried using block alv in loop but it is showing inconsistent data and moreover it has a limitation of 19 appends.

    make you are looking a break page
    check this
    http://hosteddocs.ittoolbox.com/kk021909.pdf

  • ALV with variable columns

    Hi All,
    I have to do a ALV with variable no. of columns. i.e Depending on the data , the columns should get populated.
    Thanks in advance.
    Dnyanesh

    Hi Dnyanesh,
        If you know the no. of columns to be used in the ALV before hand then you can change the field catalog.
    but if you dont know the no. of columns then you can create dynamic table.
    eg:
    1. Create your field catalog either manually or automatically using the function module, LVC_FIELDCATALOG_MERGE. Add more rows to the field catalog table (T_FIELDCAT) at run time.
    2. Use the field catalog to create a table dynamically using the method below.
    DATA: T_OUTPUT TYPE REF TO DATA
    FIELD-SYMBOLS: <T_OUTPUT> TYPE TABLE
    Call Method CL_ALV_TABLE_CREATE->CREATE_DYNAMIC_TABLE
    Exporting
    IT_FIELDCATALOG = T_FIELDCAT
    Importing
    EP_TABLE = T_OUTPUT
    ASSIGN T_OUTPUT->* TO <T_OUTPUT>.
    Now the field symbol <T_OUTPUT> is pointing to an output table of the structure that contains the fields which were determined at runtime. Now fill this table with the data and pass <T_OUTPUT> to the method SET_TABLE_FOR_FIRST_DISPLAY and the ALV grid should show the data properly.
    Example:
    *the content of itab will be fields of the new table
    loop at itab1 into wa1.
      Gs_FIELDCAT-TABNAME     = 'itab2'.
      GS_FIELDCAT-FIELDNAME = wa1-packid.
      GS_FIELDCAT-OUTPUTLEN = 2.
      GS_FIELDCAT-KEY         = space.
      GS_FIELDCAT-SELTEXT_L = wa1-packid.
      GS_FIELDCAT-COL_POS     =  1.
      GS_FIELDCAT-JUST        = 'L'.
      APPEND GS_FIELDCAT TO GT_FIELDCAT.
    endloop.
    LOOP AT GT_FIELDCAT INTO GS_FIELDCAT.
         MOVE-CORRESPONDING GS_FIELDCAT TO ls_fcat.
         APPEND ls_fcat TO lt_fieldcat.
    ENDLOOP.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
                 EXPORTING it_fieldcatalog = lt_fieldcat
                          IMPORTING ep_table = t_output.
    you can refer the following link also.
    ALV grid
    hope this helps.
    do get back if you need further clarification.
    Regards,
    Kinshuk

  • Match 2 itab into 1 alv with not identical header.

    Hello experts,
    I have 2 itab:  it_reguh  with 12 fields, and it_regup with 9 fields.
    For all 1 row from it_reguh can be some row correctly in it_regup, and header not identical.
    How can i to join them  to 1 alv  with the header of it_reguh and header of it_regup ?
    For example:  ALV like this:
    IT_REGUH-HEADER.
    IT_REGUH-ROW1.
    IT_REGUP-HEADER.
    IT_REGUP-ROW1.
    IT_REGUP-ROW2.
    IT_REGUH-HEADER.
    IT_REGUH-ROW2.
    IT_REGUP-HEADER.
    IT_REGUP-ROW1.
    IT_REGUP-ROW2.
    Thanks for the help,
    Avi.

    Hi,
    Generally this is the relationship between Header(REGUH) and Item(REGUP)
    **  Getting the item Data REGUP from header table REGUH
        CLEAR : l_regup_data,wa_with_item.
        REFRESH :l_regup_data.
        SELECT *  FROM regup INTO TABLE l_regup_data
                                      WHERE laufd = reguh_data-laufd
                                      AND   laufi = reguh_data-laufi
                                      AND   xvorl = reguh_data-xvorl
                                      AND   zbukr = reguh_data-zbukr
                                      AND   lifnr = reguh_data-lifnr
                                      AND   vblnr = reguh_data-vblnr.
        IF sy-subrc = 0.
        ENDIF.
    so try to create common internal table with Reguh and regup table.
    write the below query
    Loop at regup.
    read table reguh with above key combination.
    If sy-subrc = 0.
         "Append reguh and regup contents to final internal table
    endif.
    ENDloop.
    Prabhudas

  • Multiple Header line in Receiver File adapter

    Hi,
    I have an issue in Receiver File adapter with multiple header lines. I am able to get only 1 header lines in the receiver file but not multiple header lines with 'nl' since it is static in file mode
    [CommunityTag:Header]
    empNo,EmpName,Age
    [CommunityTag]
    I tried with the below in content conversion one as below with no luck
    Root.addHeaderLine=1
    Root.headerLine=[CommunityTag:Header] 'nl' empNo,EmpName,Age 'nl' [CommunityTag]
    Root.fiedSeparator=,
    Root.endSeparator='nl'
    I am getting the Header line as same row as static text.
    Can you advise this.

    Hi Gabriel, I suggest to produce the header lines from additional nodes in the message payload. That means you need to modify the data type of the target message in order to generate an extra structure in the payload. Use constants in message mapping to generate the header column names, e.g.
    <Header>
      <H1>CommunityTag:Header</H1>
      <H2>empNo,EmpName,Age</H2>
      <H3>CommunityTag</H3>
    </Header>
    In content conversion you have to convert the Header row with
    Header.endSeparator='nl'
    You won't need parameter addHeaderLine anymore then.
    Regards, Martin

  • TO DRAW A TABLE WITH MULTIPLE ROWS AND MULTIPLE COLOUMNS IN FORM

    Hi,
       How to draw a table with multiple rows and columns seperated by lines in form printing?

    check this
    http://sap-img.com/ts003.htm
    Regards
    Prabhu

Maybe you are looking for