Problem in dynamic alv

hi,
   i am making a dynamic alv  and i am facing a problem
i have only one loop in which i perform all the operation
now i want at end of lot no. which is (prueflos) append in to main table.please solve my problem.
    the code for that loop is as follows.
loop at t_qamv into w_qamv.
     read table t_qals into w_qals with key prueflos = w_qamv-prueflos.
       if sy-subrc = 0.
      at new prueflos.
         MOVE W_QALS-WERK TO W_MAIN-WERK.
         move w_qals-prueflos to w_main-prueflos.
           SELECT SINGLE NAME1 INTO W_MAIN-NAME1
             FROM T001W WHERE SPRAS = 'EN'
               AND WERKS = W_QALS-WERK.
      endat.
       endif.
          v_count = v_Count + 1.
          read table t_qamr into w_qamr with key PRUEFLOS = W_QAls-PRUEFLOS MERKNR = W_QAMV-MERKNR.
            if sy-subrc = 0.
            if w_qamr-merknr = w_qamv-merknr.
               concatenate 'w_main-f' v_count into v_field.
                CONDENSE V_FIELD.
                 ASSIGN (v_field) to  <value>.
                  if w_qamr-pruefbemkt is initial.
                    WRITE w_qamr-mittelwert TO v_pak EXPONENT 0 DECIMALS 3.
                   else.
                    write w_qamr-pruefbemkt to v_pak.
                  endif.
                   <value>  =  v_pak.
             endif.
endloop.

Hi Aisurya,
                Your dynamic node is only refering to TEST_BLOCK. But you have not given any values to the node.
                You first bind your values (i.e internal table values) using BIND_TABLE method.
               dyn_node = wd_context->get_child_node( name = 'TEST_BLOCK' ).
               dyn_node->BIND_TABLE ( itab ).
Regards,
Harry

Similar Messages

  • Problem in Dynamic ALV - inserting values in proper field of a table.

    Hi gurus,
    As per the user requirement I need to create a dynamic alv report. The fields will be display according to the period entered.
    I have already build the alv and it is working fine. But My questio is how can I append data into internal table in its proper field.
    suppose I have enter period 1 to 3 in selection screen. Then my table structure will be
    JAN |  FEB | MAR
    Upto this is is working fine, fields are generated dynamically , but how can I insert data only in perticular field.
    like
    itab-JAN = 001.
    itab-FEB = 002.
    itab-MAR = 003.
    append itab
    JAN |  FEB | MAR
    001    002   003
    Please give me a solution of that. waiting for reply.

    hI,
    loop at <dyn_table> assigning <wa>.
    lv_count = 001.
    *perform get_short_tet of month in a varibale say lv_var
    assign component LV_VAR of structure <wa> to <dyn_field1>.
    <dyn_field1> = lv_count.
    lv_count = lv_count + 1.
    endloop.
    Regards,
    mrunal
    Edited by: Mrunal Shyamkant Patki on Nov 5, 2009 10:53 AM
    Edited by: Mrunal Shyamkant Patki on Nov 5, 2009 10:54 AM

  • Problem in Data Display in Dynamic ALV Report

    Hi all,
    I am developing a Dynamic ALV report where I want display material batch (zjpack_base-charg) in column and Material (zjpack_base-matnr) & Qty (Zjpack_base-netwr) field row wise.My intention is to show report datewise for a material how many batch developed with there qty.I am sending you the code which i already wrote.Here column is developed batchwise but I am not able to show the qty against each batch.Please see my code and guide me how to display.
    REPORT  zdynamic_test                           .
    *REPORT  ztest_notepad.
    *& Declarations
    *Type-pools
    TYPE-POOLS: slis.
    *TABLES
    TABLES: zjpack_base.
    *Types
    TYPES:
          ty_fcat      TYPE lvc_s_fcat,
          ty_fcatalog  TYPE slis_fieldcat_alv.
    *Work areas
    DATA:
          wa_fcat      TYPE ty_fcat,
          wa_fcatalog  TYPE ty_fcatalog.
    *Internal tables
    DATA:
          it_fcat      TYPE STANDARD TABLE OF ty_fcat,
          it_fcatalog  TYPE STANDARD TABLE OF ty_fcatalog.
    *Type reference
    DATA:
          it_dyn_tab   TYPE REF TO data,
          wa_newline   TYPE REF TO data.
    *INTERNAL TABLE
    DATA: BEGIN OF it_itab OCCURS 0.
            INCLUDE STRUCTURE zjpack_base.
    DATA: END OF it_itab.
    *Filed symbols
    FIELD-SYMBOLS:
          <gt_table>   TYPE STANDARD TABLE,
          <fs_dyntable>,
          <fs_fldval>  TYPE ANY,
          <l_field>    TYPE ANY.
    *Variables
    DATA:
          l_fieldname  TYPE lvc_s_fcat-fieldname,
          l_tabname    TYPE lvc_s_fcat-tabname,
          l_fieldtext  TYPE lvc_s_fcat-seltext,
          l_index      TYPE char2.
    "Selection-screen
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-s11 .
    SELECT-OPTIONS:s_matnr FOR zjpack_base-matnr.
    SELECT-OPTIONS:s_charg FOR zjpack_base-charg.
    SELECT-OPTIONS:s_fdate FOR zjpack_base-fdate .
    SELECTION-SCREEN END OF BLOCK b1.
    PARAMETERS:
             p_colms   TYPE i.
    *& start-of-selection.
    START-OF-SELECTION.
      PERFORM select_data.
      PERFORM build_fieldcat.
      PERFORM create_dynamic_table.
    DO 20 TIMES.
       DO p_colms TIMES.
         l_index = sy-index.
         CONCATENATE 'FIELD' l_index INTO l_fieldname.
         ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
         <l_field> = sy-index.
       ENDDO.
       INSERT <fs_dyntable> INTO TABLE <gt_table>.
    ENDDO.
      LOOP AT it_itab.
        l_index = sy-tabix.
        CONCATENATE 'FIELD' l_index INTO l_fieldname.
        ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
        <l_field> = it_itab-matnr.
        INSERT <fs_dyntable> INTO TABLE <gt_table>.
      ENDLOOP.
      LOOP AT it_fcat INTO wa_fcat.
        PERFORM fieldcatalog1 USING: wa_fcat-fieldname
                                      wa_fcat-tabname
                                      wa_fcat-seltext.
      ENDLOOP.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program = 'ZTEST_NOTEPAD'
          it_fieldcat        = it_fcatalog
        TABLES
          t_outtab           = <gt_table>.
    *&      Form  BUILD_FIELDCAT
    FORM build_fieldcat .
    CLEAR: l_fieldname,
            l_tabname,
            l_fieldtext,
            l_index.
    DO  p_colms TIMES.
       CLEAR l_index.
       l_index = sy-index.
       CONCATENATE 'FIELD' l_index INTO l_fieldname.
       CONCATENATE 'Field' l_index INTO l_fieldtext.
       l_tabname = '<GT_TABLE>'.
       PERFORM fieldcatalog USING: l_fieldname
                                   l_tabname
                                   l_fieldtext.
    ENDDO.
    ENDFORM.                    " BUILD_FIELDCAT
    *&      Form  CREATE_DYNAMIC_TABLE
    FORM create_dynamic_table .
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = it_fcat
        IMPORTING
          ep_table        = it_dyn_tab.
      ASSIGN it_dyn_tab->* TO <gt_table>.
    Create dynamic work area and assign to FS
      CREATE DATA wa_newline LIKE LINE OF <gt_table>.
      ASSIGN wa_newline->* TO <fs_dyntable>.
    ENDFORM.                    " CREATE_DYNAMIC_TABLE
    *&      Form  FIELDCATALOG
    FORM fieldcatalog USING field table f_txt.
      wa_fcat-fieldname = field.
      wa_fcat-tabname   = table.
      wa_fcat-seltext = f_txt.
      APPEND wa_fcat TO it_fcat.
      CLEAR  wa_fcat.
    ENDFORM.                    " FIELDCATALOG
    *&      Form  FIELDCATALOG1
    FORM fieldcatalog1 USING field table f_txt.
      wa_fcatalog-fieldname = field.
      wa_fcatalog-tabname   = table.
      wa_fcatalog-seltext_m = f_txt.
      APPEND wa_fcatalog TO it_fcatalog.
      CLEAR  wa_fcatalog.
    ENDFORM.                    " FIELDCATALOG1
    *&      Form  SELECT_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM select_data .
    DATA: v_srlno TYPE i.
      SELECT matnr charg blqty
      INTO CORRESPONDING FIELDS OF it_itab
      FROM zjpack_base
      WHERE matnr IN s_matnr
      AND   charg IN s_charg
      AND   fdate IN s_fdate.
        COLLECT it_itab.
      ENDSELECT.
    v_srlno.
    LOOP AT it_itab.
       v_srlno = v_srlno + 1.
    ENDLOOP.
      CLEAR: l_fieldname,
              l_tabname,
              l_fieldtext,
              l_index.
    1st Field
    l_index = sy-tabix.
      CONCATENATE 'FIELD' '1' INTO l_fieldname.
      l_fieldtext = 'MATNR'.
      l_tabname = '<GT_TABLE>'.
      PERFORM fieldcatalog USING: l_fieldname
                                  l_tabname
                                  l_fieldtext.
    Other fields
      LOOP AT it_itab.
        CLEAR l_index.
        l_index = sy-tabix + 1.
        CONCATENATE 'FIELD' l_index INTO l_fieldname.
        CONCATENATE 'CHARG-' it_itab-charg INTO l_fieldtext.
        l_tabname = '<GT_TABLE>'.
        PERFORM fieldcatalog USING: l_fieldname
                                    l_tabname
                                    l_fieldtext.
      ENDLOOP.
    Please guide me how my problem will solve.
    Thanks & Regards
    Nirmal

    Hi all, I am developing a Dynamic ALV report where I want display material batch (zjpack_base-charg) in column and Material (zjpack_base-matnr) & Qty (Zjpack_base-netwr) field row wise.My intention is to show report datewise for a material how many batch developed with there qty.I am sending you the code which i already wrote.Here column is developed batchwise but I am not able to show the qty against each batch.Please see my code and guide me how to display.
    *& Report  ZDYNAMIC_TEST                                               *
    REPORT  zdynamic_test                           .
    *REPORT  ztest_notepad.
    *& Declarations
    *Type-pools
    TYPE-POOLS: slis.
    *TABLES
    TABLES: zjpack_base.
    *Types
    TYPES:
          ty_fcat      TYPE lvc_s_fcat,
          ty_fcatalog  TYPE slis_fieldcat_alv.
    *Work areas
    DATA:
          wa_fcat      TYPE ty_fcat,
          wa_fcatalog  TYPE ty_fcatalog.
    *Internal tables
    DATA:
          it_fcat      TYPE STANDARD TABLE OF ty_fcat,
          it_fcatalog  TYPE STANDARD TABLE OF ty_fcatalog.
    *Type reference
    DATA:
          it_dyn_tab   TYPE REF TO data,
          wa_newline   TYPE REF TO data.
    *INTERNAL TABLE
    DATA: BEGIN OF it_itab OCCURS 0.
            INCLUDE STRUCTURE zjpack_base.
    DATA: END OF it_itab.
    *Filed symbols
    FIELD-SYMBOLS:
          <gt_table>   TYPE STANDARD TABLE,
          <fs_dyntable>,
          <fs_fldval>  TYPE ANY,
          <l_field>    TYPE ANY.
    *Variables
    DATA:
          l_fieldname  TYPE lvc_s_fcat-fieldname,
          l_tabname    TYPE lvc_s_fcat-tabname,
          l_fieldtext  TYPE lvc_s_fcat-seltext,
          l_index      TYPE char2.
    "Selection-screen
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-s11 .
    SELECT-OPTIONS:s_matnr FOR zjpack_base-matnr.
    SELECT-OPTIONS:s_charg FOR zjpack_base-charg.
    SELECT-OPTIONS:s_fdate FOR zjpack_base-fdate .
    SELECTION-SCREEN END OF BLOCK b1.
    PARAMETERS:
             p_colms   TYPE i.
    *& start-of-selection.
    START-OF-SELECTION.
      PERFORM select_data.
      PERFORM build_fieldcat.
      PERFORM create_dynamic_table.
    *  DO 20 TIMES.
    *    DO p_colms TIMES.
    *      l_index = sy-index.
    *      CONCATENATE 'FIELD' l_index INTO l_fieldname.
    *      ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
    *      <l_field> = sy-index.
    *    ENDDO.
    *    INSERT <fs_dyntable> INTO TABLE <gt_table>.
    *  ENDDO.
      LOOP AT it_itab.
        l_index = sy-tabix.
        CONCATENATE 'FIELD' l_index INTO l_fieldname.
        ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
        <l_field> = it_itab-matnr.
        INSERT <fs_dyntable> INTO TABLE <gt_table>.
      ENDLOOP.
      LOOP AT it_fcat INTO wa_fcat.
        PERFORM fieldcatalog1 USING: wa_fcat-fieldname
                                      wa_fcat-tabname
                                      wa_fcat-seltext.
      ENDLOOP.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program = 'ZTEST_NOTEPAD'
          it_fieldcat        = it_fcatalog
        TABLES
          t_outtab           = <gt_table>.
    *&      Form  BUILD_FIELDCAT
    FORM build_fieldcat .
    *  CLEAR: l_fieldname,
    *         l_tabname,
    *         l_fieldtext,
    *         l_index.
    *  DO  p_colms TIMES.
    *    CLEAR l_index.
    *    l_index = sy-index.
    *    CONCATENATE 'FIELD' l_index INTO l_fieldname.
    *    CONCATENATE 'Field' l_index INTO l_fieldtext.
    *    l_tabname = '<GT_TABLE>'.
    *    PERFORM fieldcatalog USING: l_fieldname
    *                                l_tabname
    *                                l_fieldtext.
    *  ENDDO.
    ENDFORM.                    " BUILD_FIELDCAT
    *&      Form  CREATE_DYNAMIC_TABLE
    FORM create_dynamic_table .
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = it_fcat
        IMPORTING
          ep_table        = it_dyn_tab.
      ASSIGN it_dyn_tab->* TO <gt_table>.
    * Create dynamic work area and assign to FS
      CREATE DATA wa_newline LIKE LINE OF <gt_table>.
      ASSIGN wa_newline->* TO <fs_dyntable>.
    ENDFORM.                    " CREATE_DYNAMIC_TABLE
    *&      Form  FIELDCATALOG
    FORM fieldcatalog USING field table f_txt.
      wa_fcat-fieldname = field.
      wa_fcat-tabname   = table.
      wa_fcat-seltext = f_txt.
      APPEND wa_fcat TO it_fcat.
      CLEAR  wa_fcat.
    ENDFORM.                    " FIELDCATALOG
    *&      Form  FIELDCATALOG1
    FORM fieldcatalog1 USING field table f_txt.
      wa_fcatalog-fieldname = field.
      wa_fcatalog-tabname   = table.
      wa_fcatalog-seltext_m = f_txt.
      APPEND wa_fcatalog TO it_fcatalog.
      CLEAR  wa_fcatalog.
    ENDFORM.                    " FIELDCATALOG1
    *&      Form  SELECT_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM select_data .
    *  DATA: v_srlno TYPE i.
      SELECT matnr charg blqty
      INTO CORRESPONDING FIELDS OF it_itab
      FROM zjpack_base
      WHERE matnr IN s_matnr
      AND   charg IN s_charg
      AND   fdate IN s_fdate.
        COLLECT it_itab.
      ENDSELECT.
    *  v_srlno.
    *  LOOP AT it_itab.
    *    v_srlno = v_srlno + 1.
    *  ENDLOOP.
      CLEAR: l_fieldname,
              l_tabname,
              l_fieldtext,
              l_index.
    * 1st Field
    *  l_index = sy-tabix.
      CONCATENATE 'FIELD' '1' INTO l_fieldname.
      l_fieldtext = 'MATNR'.
      l_tabname = '<GT_TABLE>'.
      PERFORM fieldcatalog USING: l_fieldname
                                  l_tabname
                                  l_fieldtext.
    * Other fields
      LOOP AT it_itab.
        CLEAR l_index.
        l_index = sy-tabix + 1.
        CONCATENATE 'FIELD' l_index INTO l_fieldname.
        CONCATENATE 'CHARG-' it_itab-charg INTO l_fieldtext.
        l_tabname = '<GT_TABLE>'.
        PERFORM fieldcatalog USING: l_fieldname
                                    l_tabname
                                    l_fieldtext.
      ENDLOOP.
    ENDFORM.                    " SELECT_DATA

  • Problem in print out of Dynamic ALV

    Hi ,
    I am using dynamic ALV to address a requirement. The ALV is working fine and the output is also coming corretly, even in spool.
    But if the width of dynamic table exceeds a limit, then nothing is coming in the print out.
    If anyone has faced similar problem or knows how to tackle this problem, please advise what can be done here.
    Thanks,
    Sonal

    Hi,
    Can you try to increase field with to maximun as per your requirement.
    Regards,
    Sai

  • Dynamic ALV Problem

    I am getting the following short dump error : Program " " not found".The fieldcat is successfully built but when Iam trying to call the method "create_dynamic_table" it is showing the error.
    I executed the following Dynamic ALV program without any error yesterday,I did slight modifications and it is started showing the error.See the below code :
    Data : t_fieldcat TYPE lvc_t_fcat,
           wa_fieldcat TYPE lvc_s_fcat.
    FIELD-SYMBOLS : <it_dyn> TYPE STANDARD TABLE,
                    <wa_dyn>.
    DATA : g_tdref TYPE REF TO data,
           g_wdref TYPE REF TO data,
           dats like vbbe-mbdat.
    SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : s_mbdat FOR dats.
    SELECTION-SCREEN : END OF BLOCK blk1.
    wa_fieldcat-tabname = 'MSKA'.
    wa_fieldcat-fieldname = 'WERKS'.
    wa_fieldcat-datatype = 'CHAR'.
    wa_fieldcat-intlen = '10'.
    APPEND wa_fieldcat TO t_fieldcat.
    CLEAR : wa_fieldcat.
    wa_fieldcat-tabname = 'MSKA'.
    wa_fieldcat-fieldname = 'MATNR'.
    wa_fieldcat-datatype = 'CHAR'.
    wa_fieldcat-seltext = 'Material Number'.
    wa_fieldcat-intlen = '18'.
    APPEND wa_fieldcat TO t_fieldcat.
    CLEAR : wa_fieldcat.
      wa_fieldcat-tabname = 'MAKT'.
      wa_fieldcat-fieldname = 'MAKTX'.
      wa_fieldcat-datatype = 'CHAR'.
      wa_fieldcat-intlen = '10'.
      APPEND wa_fieldcat TO t_fieldcat.
      CLEAR : wa_fieldcat.
    wa_fieldcat-tabname = 'VBBE'.
    wa_fieldcat-fieldname = 'MBDAT'.
    wa_fieldcat-datatype = 'CHAR'.
    wa_fieldcat-intlen = '10'.
    APPEND wa_fieldcat TO t_fieldcat.
    CLEAR : wa_fieldcat.
    DATA : d TYPE i,
           v(02) TYPE n VALUE '0',
           day(8) TYPE c.
    d = s_mbdat-high - s_mbdat-low.
    DO d TIMES.
      v = v + 1.
      CONCATENATE 'x Day' v INTO day.
      wa_fieldcat-tabname = 'VBBE'.
      wa_fieldcat-fieldname = day.
      wa_fieldcat-datatype = 'DATS'.
      wa_fieldcat-seltext = day.
      wa_fieldcat-intlen = '8'.
      APPEND wa_fieldcat TO t_fieldcat.
      CLEAR : wa_fieldcat.
    ENDDO.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = t_fieldcat
        IMPORTING
          ep_table        = g_tdref.
      ASSIGN g_tdref->* TO <it_dyn>.
      CREATE DATA g_wdref LIKE LINE OF <it_dyn>.
      ASSIGN g_wdref->* TO <wa_dyn>.
    What might be the problem?

    well...i executed exactly the same code as yours....and i got a table G_TDREF with four fields WERKS MATNR MAKTX and MBDAT successfully....
    I even debugged the create_dynamic_table method and found that LVC_TABLE_CREATE function module has the i_callback_program as an optional parameter...so it should not be a problem....
    could you please debug the create_dynamic_table method a bit to know exactly at what point the dump is occuring...
    looks to be a system issue to me.....check if everything is correct in the system....it works perfectly fine for me

  • Dynamic ALV and cl_abap_structdescr Create method

    Hi
    In the process of creation of Dynamic ALV, as I have char_name and char_descr fields, I have to use char_descr as column header of ALV because char_name which has entries something like DVS_******(that do not make any sense to user). I am facing 2 problems here using the scenario above.
    1. char_descr contains characters like '[', ']', ' /', '.', space which are invalid characters for method cl_abap_structdescr=>create(). How to handle scenario like this?
    2. assign (lv_value) to <value>.
            if sy-subrc = 0.
              <value> = ls_bapi_char_value-charvalue.
              if <value> is assigned.
                move ls_bapi_char_value-charvalue to <value>.
    where-> concatenate '<table_dyn_wa>-' ls_bapi_char-char_descr into lv_value
                   <value> type any
                  <table_dyn_wa>- is dynamic table with structure created with cl_abap_tabledescr=>create( p_line_type = stru_type )
    with above code for few fields data is being assigned and for few sy-subrc = 4. The table from where I am reading the field contains char_name associated with it and not char_descr. For the fields whose char_name and char_descr matches exactly, ALV displays data for it.
    How to resolve the issue so that I could get all the data?
    Let me know if further details are needed.
    Thanks, in advance
    Trupti
    Edited by: TRUPTI KALLURWAR on Jul 9, 2010 7:08 PM

    Hello Srikanth,
    CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE( ) uses the GENERATE SUBROUTINE POOL technique to create the dynamic internal tables.
    And as per the SAP documentation,
    In an internal mode, a maximum of 36 temporary subroutine pools may be created.
    Source: [http://help.sap.com/abapdocu_702/en/abapgenerate_subroutine_pool.htm]
    Btw why are you crating 36 dynamic internal table? That's way too far-fetched even for the RTTC classes
    BR,
    Suhas

  • Colors in Dynamic ALV table display

    Hello All,
    I have dynamic ALV table display in which i created the columns dynamically and finally binded that created node and diplayed the table ..
    Now what i want to do is depending on some condition i need to change the colors in the table display..
    I tried to set the color in this way inside the loop .
                     if lv_phase  = '3'.
                   lr_column->set_cell_design( CL_WD_TABLE_COLUMN=>E_CELL_DESIGN-badvalue_medium ).
                     else.
                    lr_column->set_cell_design( CL_WD_TABLE_COLUMN=>E_CELL_DESIGN-standard ).
                   endif.
    This piece of code either changes all the coloumns into one color only why it is not changing the color based upon the condition . I am unable to understand..
    Please help me in this...Do i need to some thing else..

    Solved by creating a new column called cell design ... and settign the set_cell_design_fieldname ...
    This solved my Problem ..

  • Create dynamic internal table with deep structure;cell coloring dynamic ALV

    Hi,
    My requirement is to do cell colouring for a dynamic ALV.
    So I am creating a dynamic internal table using the following method.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = i_fieldcatalog[]
        IMPORTING
          ep_table        = i_output.
    But how do I define field COLORS which should be again an internal table ?
    Is there any other way for cell colouring?
    Putting my problem in another way:
    How do I create a dynamic internal table with one field as another internal table.
    Quick replies are highly appreciated.
    Thanks,
    Nisha Vengal.

    halo Nisha
    Before building the display table . you can add the field in the feild catalog right . This display table gets generated from the field catalog right
    1 Create a global structute say ZEXTEND_FIELDCAT
    2 Have fields like STYLE type lvc_t_styl
                             COLOR type LVC_T_SCOL.
    3 Now you have to extend ur fieldcatalog
      l_fieldcat-fieldname = COLOR'.
      l_fieldcat-ref_field = 'COLOR'.
      l_fieldcat-ref_table = 'ZEXTEND_FIELDCAT'.
      APPEND l_fieldcat TO lt_field_catalog.
      CLEAR l_fieldcat.

  • Create structure in Dynamic ALV for color and editing cells

    Hi experts,
    I created dynamic ALV . in this i want coloring and editing of cells.
    this can be done by strucutture lvc_t_scol, lvc_t_styl.
    My problem is how to create structure in field catalogue of Dynamic ALV.
    Thanks

    Hello
    I am not sure if you have missed the following part of the coding:
    " Add table type (LVC_T_STYL) as field to structure ==> complex structure
      CLEAR: gs_comp.
      gs_comp-type ?= cl_abap_typedescr=>describe_by_data( celltab ).
      gs_comp-name  = 'CELLTAB'.
      APPEND gs_comp TO gt_components.
      go_sdescr  = cl_abap_structdescr=>create( gt_components ).
      go_tdescr  = cl_abap_tabledescr=>create( go_sdescr ).
      CREATE DATA gdo_handle TYPE HANDLE go_tdescr.
      ASSIGN gdo_handle->* TO <gt_itab>.
    This is exactly your requirement.
    Regards
      Uwe

  • Create deep structure to disable some cells in Dynamic ALV GRID

    Hi,
    I want to disable some cells in a Dynamic ALV Grid before calling "SET_tABLE_Display" Method.
    I check the BCALV_EDIT_02, where some cells are grayed out by assign the  CL_GUI_ALV_GRID-MC_STYLE_DISABLED  to the field name.
    But I want the same using Field symbol.
    I'm creating Dynamic table and dynamic structure based on the Dynamic field catalog.
    Example: <FT_TAB> TYPE STANDARD TABLE,
                    <FS_TAB> TYPE ANY,            
    DATA: INT_TAB  is my dynamic table values.
    For the INT_TAB internal table, I created dynamic Structure and dynamic field symbol table.
    LOOP AT INT_TAB.
    ASSIGN COMPONENT 'MATNR'  OF STRUCTURE <FS_TAB> TO <F_VALUE>
    <F_VALUE> = INT_TAB-MATNR.
    APPEND <FS_TAB> TO <FT_TAB>
    "Here is the problem occurs, I want to grayed out the MATNR value based on some condition.
    ENDLOOP.
    I would like to set the 'MATNR' value to be grayed out by passing the CL_GUI_ALV_GRID-MC_STYLE_DISABLED.
    and update into <FT_TAB>(       <FT_TAB> structure will have 2 structures)
    Finally the fieldsymbol should have two structure ( <F_TAB> = DYNAMIC STRUCTURE + LVC_S_STYLE )
    Display alv grid by passing <FT_TAB> to set_table_display method.
    Thanks in advance,
    Kumar.

    Hi,
    I am  not sure whether I really understand your request. Let me try to help.
    > Example: <FT_TAB> TYPE STANDARD TABLE,
    >                 <FS_TAB> TYPE ANY,            
    >
    > DATA: INT_TAB  is my dynamic table values.
    >
    >
    > LOOP AT INT_TAB.
    >  ASSIGN COMPONENT 'MATNR'  OF STRUCTURE <FS_TAB> TO <F_VALUE>
    > <F_VALUE> = INT_TAB-MATNR.
    >  APPEND <FS_TAB> TO <FT_TAB>
    Here <FT_TAB> must already be assigned to some internal table with a given (dynamic) structure. Did this happen before this piece of code?
    What I would do is to create a dynamic table (see documentation to CREATE DATA) with MATNR and the STYLE field (LVC_T_STYL). See the documentation for CREATE DATA - creation of internal tables. When collection the field descriptions for that internal table I would also build the field catalogue for the ALV.
    Then assign <FT_TAB> to that newly created internal table, <FS_TAB> to a newly created structure (same as a table line).
    Move the MATNR to component 1 (or component 'MATNR') of the table and fill the style table according to your needs. Then insert the <FS_TAB> into <FT_TAB>.
    Finally call the ALV SET_TABLE... method with your dynamic table and your field catalogue.
    Regards,
    Gerd Rother

  • Dynamic ALV Grid is not displaying !!

    Hi all,
      I am trying to create dynamic alv grids and upto five levels(five grids) out put is displaying fine without any problem. But when I try to display the 6th grid, the program is going into infinite loop and getting timed out. Even I tried to increse the height of the grid even though it is not displaying.
    Please correct me if any thing is wrong in below code.
    *1st Level grid
    IF <table1> IS ASSIGNED AND <table1> IS NOT INITIAL.
       CREATE OBJECT ob_split1
           EXPORTING
             parent      = ob_custom
             orientation = cl_gui_easy_splitter_container=>orientation_vertical.
        PERFORM set_split_height USING ob_split1  '20'.
        CREATE OBJECT ob_grid1
          EXPORTING
            i_parent = ob_split1->top_left_container.
    ELSE.
        CREATE OBJECT ob_split1
           EXPORTING
             parent      = ob_custom
             orientation = cl_gui_easy_splitter_container=>orientation_vertical.
        PERFORM set_split_height USING ob_split1  '0'.
    ENDIF.
    *2nd Level grid
    IF <table2> IS ASSIGNED AND <table2> IS NOT INITIAL.
       CREATE OBJECT ob_split2
           EXPORTING
             parent      = ob_split1->bottom_right_container
             orientation = cl_gui_easy_splitter_container=>orientation_vertical.
          PERFORM set_split_height USING ob_split2   '20'.
        CREATE OBJECT ob_grid2
          EXPORTING
            i_parent = ob_split2->top_left_container.
      ELSE.
         CREATE OBJECT ob_split2
            EXPORTING
              parent      = ob_split1->bottom_right_container
              orientation = cl_gui_easy_splitter_container=>orientation_vertical.
         PERFORM set_split_height USING ob_split2    '0'.
      ENDIF.
    (Created 3rd,4th,5th same like above).
    *6th Level grid
    IF <table6> IS ASSIGNED AND <table6> IS NOT INITIAL.
    CREATE OBJECT ob_split6
           EXPORTING
             parent      = ob_split5->bottom_right_container
             orientation = cl_gui_easy_splitter_container=>orientation_vertical.
         PERFORM set_split_height USING ob_split6  '20'.
         CREATE OBJECT ob_grid6
           EXPORTING
             i_parent = ob_split6->top_left_container.
      ELSE.
         CREATE OBJECT ob_split6
           EXPORTING
             parent      = ob_split5->bottom_right_container
             orientation = cl_gui_easy_splitter_container=>orientation_vertical.
         PERFORM set_split_height USING ob_split6  '0'.
      ENDIF.
    Appreciated your reply. Please let me know for additional info.
    Thanks,
    Ranjith.
    Edited by: Thomas Zloch on Dec 8, 2010 5:44 PM - please use code tags

    Hi romanch,
    defining the field catalog you must reference all currency fields to the respective currency key field (type CUKY).
    <alv_fieldcat>-cfieldname         = 'HWAER'.
    This is sample for alv output of a currency field. The alv structure has a field HWAER which carries the currency key, e.g. USD or so.
    Obviously you do not provide a cutrrency key for your values. If they are initial (zero), ALV will not display them as 0,00 but leave the field empty if the reference too currency key is not established.
    If you define a DDIC structure for the ALV output this refernce is enforced. You can pass the DDIC structure name to the ALV and don not have to create the field catalog manually.
    Regards,
    Clemens

  • How to generate a dynamic ALV

    give me some points on how  to generate the dynamic Alv using RTTS and why it is useful to generate this way

    Hi ,
    Please follow this link
    RTTS question
    problem with coloring cells in dynamic fieldcatalog
    Regards,
    Pravin

  • Cell colour in Dynamic ALV

    How to make cell coloring in dynamic ALV,I did it in normal internal tables.Any body can help me here?
    Or can anybody tell me how to convert a field symbol to an internal table? as I have created a dynamic IT.
    Thanks in advance.

    Thanks for u r quick replies,Now Iam not getting any error,the program getting executed without any error.But Iam not getting any colors,what might be the problem? Do I need to pass IS_layot to ALV_GRID FM ? I have not created any Layout though,here is my complete code :
    TABLES : vbbe.
    TYPE-POOLS : slis.
    *&                       Data Declarations                             *
    DATA : diff TYPE i VALUE 0,
           maktx LIKE makt-maktx,
           labst LIKE mard-labst.
    DATA : BEGIN OF it_data OCCURS 0,
           matnr LIKE vbbe-matnr,
           mbdat LIKE vbbe-mbdat,
           omeng LIKE vbbe-omeng,
           END OF it_data,
           wa_data LIKE LINE OF it_data.
    DATA : g_tdref TYPE REF TO data,
           g_wdref TYPE REF TO data.
    DATA : dats LIKE vbbe-mbdat,
           lvc_t_fieldcat TYPE lvc_t_fcat,
           lvc_s_fieldcat TYPE lvc_s_fcat,
           it_fldcat TYPE slis_t_fieldcat_alv,
           wa_fldcat TYPE slis_fieldcat_alv.
    FIELD-SYMBOLS : <it_dyn> TYPE STANDARD TABLE,
                    <wa_dyn>,
                    <dyn_field>.
    *&                          Selection-Screen                           *
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : s_mbdat FOR vbbe-mbdat OBLIGATORY.
    PARAMETER p_werks LIKE mard-werks OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK blk1.
    *&                          INITIALIZATION                             *
    INITIALIZATION.
      p_werks = '1200'.
    *&                       Start-Of-Selection                            *
    START-OF-SELECTION.
      PERFORM f_build_lvc_and_slis.
      PERFORM f_build_dynamic_it.
      PERFORM f_get_data.
      PERFORM f_get_fata_into_it.
      PERFORM f_display_alv.
    *&      Form  f_build_lvc
    FORM f_build_lvc_and_slis.
    *.................Build LVC Fieldcatalog...............................*
      lvc_s_fieldcat-tabname = 'MSKA'.
      lvc_s_fieldcat-col_pos = 1.
      lvc_s_fieldcat-fieldname = 'WERKS'.
      lvc_s_fieldcat-datatype = 'CHAR'.
      lvc_s_fieldcat-intlen = '10'.
      APPEND lvc_s_fieldcat TO lvc_t_fieldcat.
      CLEAR : lvc_s_fieldcat.
      lvc_s_fieldcat-tabname = 'MSKA'.
      lvc_s_fieldcat-col_pos = 2.
      lvc_s_fieldcat-fieldname = 'MATNR'.
      lvc_s_fieldcat-datatype = 'CHAR'.
      lvc_s_fieldcat-intlen = '18'.
      APPEND lvc_s_fieldcat TO lvc_t_fieldcat.
      CLEAR : lvc_s_fieldcat.
      lvc_s_fieldcat-tabname = 'MAKT'.
      lvc_s_fieldcat-col_pos = 3.
      lvc_s_fieldcat-fieldname = 'MAKTX'.
      lvc_s_fieldcat-datatype = 'CHAR'.
      lvc_s_fieldcat-intlen = '10'.
      APPEND lvc_s_fieldcat TO lvc_t_fieldcat.
      CLEAR : lvc_s_fieldcat.
      lvc_s_fieldcat-tabname = 'MARD'.
      lvc_s_fieldcat-col_pos = 4.
      lvc_s_fieldcat-fieldname = 'LABST'.
      lvc_s_fieldcat-datatype = 'QUAN'.
      lvc_s_fieldcat-intlen = '13'.
      APPEND lvc_s_fieldcat TO lvc_t_fieldcat.
      CLEAR : lvc_s_fieldcat.
      lvc_s_fieldcat-tech = 'X'.
      lvc_s_fieldcat-col_pos = 5.
      lvc_s_fieldcat-fieldname = 'TCOLOR'.
      lvc_s_fieldcat-ref_field = 'COLOR'.
      lvc_s_fieldcat-ref_table = 'ZLVC_COL'.
      lvc_s_fieldcat-scrtext_l = 'COLOR'.
      APPEND lvc_s_fieldcat TO lvc_t_fieldcat.
      CLEAR : lvc_s_fieldcat.
    *.................Build SLIS Fieldcatalog..............................*
      wa_fldcat-tabname = 'MSKA'.
      wa_fldcat-col_pos = 1.
      wa_fldcat-fieldname = 'WERKS'.
      wa_fldcat-datatype = 'CHAR'.
      wa_fldcat-seltext_m = wa_fldcat-seltext_l = wa_fldcat-seltext_s =
      'Plant'.
      wa_fldcat-intlen = '6'.
      APPEND wa_fldcat TO it_fldcat.
      CLEAR : wa_fldcat.
      wa_fldcat-tabname = 'MSKA'.
      wa_fldcat-outputlen = 15.
      wa_fldcat-col_pos = 2.
      wa_fldcat-fieldname = 'MATNR'.
      wa_fldcat-datatype = 'CHAR'.
      wa_fldcat-seltext_l = 'Material Number'.
      wa_fldcat-intlen = '16'.
      APPEND wa_fldcat TO it_fldcat.
      CLEAR : wa_fldcat.
      wa_fldcat-tabname = 'MAKT'.
      wa_fldcat-outputlen = 23.
      wa_fldcat-col_pos = 3.
      wa_fldcat-fieldname = 'MAKTX'.
      wa_fldcat-datatype = 'CHAR'.
      wa_fldcat-seltext_l = 'Material Description'.
      wa_fldcat-intlen = '20'.
      APPEND wa_fldcat TO it_fldcat.
      CLEAR : wa_fldcat.
      wa_fldcat-tabname = 'MARD'.
      wa_fldcat-col_pos = 4.
      wa_fldcat-fieldname = 'LABST'.
      wa_fldcat-datatype = 'QUAN'.
      wa_fldcat-intlen = '13'.
      wa_fldcat-seltext_m = wa_fldcat-seltext_l = wa_fldcat-seltext_s =
      'x Stock'.
      APPEND wa_fldcat TO it_fldcat.
      CLEAR : wa_fldcat.
      wa_fldcat-tech = 'X'.
      wa_fldcat-col_pos = 5.
      wa_fldcat-fieldname = 'TCOLOR'.
      wa_fldcat-ref_fieldname = 'COLOR'.
      wa_fldcat-ref_tabname = 'ZLVC_COL'.
      wa_fldcat-seltext_l = 'COLOR'.
      APPEND wa_fldcat TO it_fldcat.
      CLEAR : wa_fldcat.
    *.................Build Dynamic Fields for LVC and SLIS................*
      DATA : d TYPE i,
             col(6) TYPE n VALUE '0',
             date TYPE dats,
             day(8) TYPE c,
             number(2) TYPE n VALUE '0'.
      d = s_mbdat-high - s_mbdat-low + 1.
      date = s_mbdat-low - 1.
      DO d TIMES.
        number = number + 1.
        date = date + 1.
        col = col + 1.
        CONCATENATE 'x Day' number INTO day.
        lvc_s_fieldcat-tabname = 'VBBE'.
        lvc_s_fieldcat-col_pos = col + 5.
        lvc_s_fieldcat-fieldname = date.
        lvc_s_fieldcat-datatype = 'QUAN'.
        lvc_s_fieldcat-intlen = '15'.
        APPEND lvc_s_fieldcat TO lvc_t_fieldcat.
        CLEAR : lvc_s_fieldcat.
        wa_fldcat-tabname = 'VBBE'.
        wa_fldcat-col_pos = col + 5.
        wa_fldcat-fieldname = date.
        wa_fldcat-datatype = 'QUAN'.
        wa_fldcat-intlen = '15'.
        wa_fldcat-seltext_l = day.
        APPEND wa_fldcat TO it_fldcat.
        CLEAR : wa_fldcat.
      ENDDO.
    ENDFORM.                    " f_build_lvc
    *&      Form  f_build_dynamic_it
    FORM f_build_dynamic_it .
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = lvc_t_fieldcat
        IMPORTING
          ep_table        = g_tdref.
      ASSIGN g_tdref->* TO <it_dyn>.
      CREATE DATA g_wdref LIKE LINE OF <it_dyn>.
      ASSIGN g_wdref->* TO <wa_dyn>.
    ENDFORM.                    " f_build_dynamic_it
    *&      Form  f_get_data
    FORM f_get_data .
      SELECT matnr mbdat omeng FROM vbbe INTO CORRESPONDING FIELDS OF TABLE
      it_data WHERE mbdat IN s_mbdat AND
                              werks = p_werks.
      DELETE it_data WHERE omeng = 0 .
      SORT it_data BY matnr ASCENDING.
    ENDFORM.                    " f_get_data
    *&      Form  f_get_fata_into_it
    FORM f_get_fata_into_it .
      FIELD-SYMBOLS : <fs>,
      <ta_color> TYPE table.
      DATA : field(15) TYPE c,
             col TYPE lvc_s_scol.
      LOOP AT it_data INTO wa_data.
        SELECT SINGLE maktx FROM makt INTO maktx WHERE matnr =
        wa_data-matnr.
        SELECT SINGLE labst FROM mard INTO labst WHERE matnr =
        wa_data-matnr AND werks = p_werks.
        diff = wa_data-mbdat - s_mbdat-low + 6.
        ASSIGN COMPONENT 1 OF STRUCTURE <wa_dyn> TO <fs>.
        <fs> = p_werks.
        ASSIGN COMPONENT 2 OF STRUCTURE <wa_dyn> TO <fs>.
        <fs> = wa_data-matnr.
        ASSIGN COMPONENT 3 OF STRUCTURE <wa_dyn> TO <fs>.
        <fs> = maktx.
        ASSIGN COMPONENT 4 OF STRUCTURE <wa_dyn> TO <fs>.
        <fs> = labst.
        ASSIGN COMPONENT diff OF STRUCTURE <wa_dyn> TO <fs>.
        <fs> = wa_data-omeng.
        IF labst < wa_data-omeng.
          col-fname = wa_data-mbdat.
          col-color-col = '5' .
          col-color-int =  '1'.
        ELSE.
          col-fname = wa_data-mbdat.
          col-color-col = '5' .
          col-color-int = '0' .
        ENDIF.
        ASSIGN COMPONENT 'TCOLOR' OF STRUCTURE <wa_dyn> TO <ta_color>.
        APPEND col TO <ta_color> .
        APPEND <wa_dyn> TO <it_dyn>.
        CLEAR <wa_dyn>.
      ENDLOOP.
    ENDFORM.                    " f_get_fata_into_it
    *&      Form  f_display_alv
    FORM f_display_alv .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = sy-repid
    *   I_CALLBACK_PF_STATUS_SET          = ' '
    *   I_CALLBACK_USER_COMMAND           = ' '
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
    *   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *   I_CALLBACK_HTML_END_OF_LIST       = ' '
    *   I_STRUCTURE_NAME                  =
    *   I_BACKGROUND_ID                   = ' '
    *   I_GRID_TITLE                      =
    *   I_GRID_SETTINGS                   =
    *   IS_LAYOUT                         =
         it_fieldcat                       = it_fldcat
    *   IT_EXCLUDING                      =
    *   IT_SPECIAL_GROUPS                 =
    *   IT_SORT                           =
    *   IT_FILTER                         =
    *   IS_SEL_HIDE                       =
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
    *   IS_VARIANT                        =
    *   IT_EVENTS                         =
    *   IT_EVENT_EXIT                     =
    *   IS_PRINT                          =
    *   IS_REPREP_ID                      =
    *   I_SCREEN_START_COLUMN             = 0
    *   I_SCREEN_START_LINE               = 0
    *   I_SCREEN_END_COLUMN               = 0
    *   I_SCREEN_END_LINE                 = 0
    *   IT_ALV_GRAPHICS                   =
    *   IT_HYPERLINK                      =
    *   IT_ADD_FIELDCAT                   =
    *   IT_EXCEPT_QINFO                   =
    *   I_HTML_HEIGHT_TOP                 =
    *   I_HTML_HEIGHT_END                 =
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER           =
    *   ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = <it_dyn>
       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.                    " f_display_alv

  • Subtotal Text in Dynamic ALV

    I have faced the problem with Subtotal Text in Dynamic ALV.
    I don't know why it is not get into "FORM subtotal_text " .
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
         i_callback_program             = sy-repid
       IS_LAYOUT                        = gw_layout
         it_fieldcat                    = gi_fieldcat[]
         it_sort                        = gi_sort[]
         it_events                      = gi_events
        TABLES
          t_outtab                       = <gi_dyntable>
       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.
    and
    *&      Form  subtotal_text
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM subtotal_text USING  p_total type ref to data
                             p_subtottxt_info TYPE slis_subtot_text.
      break-point.
    ENDFORM.                    " alv_subtotal
    Thanks in advance

    I put the form name to gi_events
    *&      Form  event_build
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM event_build .
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = gi_events.
      READ TABLE gi_events WITH KEY name = 'SUBTOTAL_TEXT' INTO gw_events.
      IF sy-subrc = 0.
        MOVE 'SUBTOTAL_TEXT' TO gw_events-form.
        MODIFY gi_events FROM gw_events INDEX sy-tabix.
      ENDIF.
    ENDFORM.                    " event_build

  • Dynamic ALV Title

    Hello Experts,
    Please suggest how to generate dynamic ALV title for dynamic alv output.
    Scenario: My ALV output is dynamic based on custom table. We have maintained 10 fields in custom table. In selection screen one of the parameter is number.
    If i enter 2 or more than 2 accordingly my fieldcatlog will be prepared with same fields. But it will be mulitiple based on selection screen.
    I have achieved till this part, now i need to generate title for each set of 10 columns.
    Best example:
    ALV output:
             Title 1                     Title2                        Title3
    A B C D E F G H I J | A B C D E F G H I J | A B C D E F G H I J | 
    I hope you all understand my problem and i appreciate your answers....
    Thanks
    Cris

    Dear,
             Use the below report code to print your dynamic coloumn in alv grid.
    below just go through the use of variable w_bom for text,u will use single varible w_bom but clear it b4
    printing it again. on the conditional base header will come in w_bom and print in fieldcatalog.
    operate all operation b4 putting the text in fieldcatalog.
    jus go through the code and you may ask any clarificaiton regarading that.
      loop at i_fldcat into x_fldcat WHERE
      fieldname = 'IDNRK' or
      fieldname = 'MAKTX' or
      fieldname = 'MEINS' or
         FIELDNAME =  'MENGE1' OR
            FIELDNAME =  'MENGE2' OR
            FIELDNAME =  'MENGE3' OR
             FIELDNAME =  'MENGE4' OR
              FIELDNAME =  'MENGE5' OR
               FIELDNAME =  'MENGE6' OR
               FIELDNAME =  'MENGE7' OR
               FIELDNAME =  'MENGE8'.
        if stlal-low ne ''.
          if x_fldcat-fieldname = 'IDNRK'.
            x_fldcat-seltext_l = 'Component'.
            x_fldcat-outputlen = 25.
            x_fldcat-reptext_ddic = 'Component'.
            x_fldcat-inttype = c_c.
          endif.
          if x_fldcat-fieldname = 'MAKTX'.
            x_fldcat-seltext_l = 'Component Description'.
            x_fldcat-outputlen = 25.
            x_fldcat-reptext_ddic = 'Component Description'.
            x_fldcat-inttype = c_c.
          endif.
          if x_fldcat-fieldname = 'MEINS'.
            x_fldcat-seltext_l = 'UOM'.
            x_fldcat-reptext_ddic = 'UOM'.
            x_fldcat-ddictxt = c_l.
          endif.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE1'.
            read table t_stas1 with key stlal = '01'.
            if sy-subrc NE 0.
              x_fldcat-no_out = 'X'.
              X_FLDCAT-TECH = 'X'.
            ELSE.
              PERFORM VAR_BOM USING T_STAS1-STLAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            endif.
          ENDIF.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE2'.
            read table t_stas1 with key stlal = '02'.
            if sy-subrc NE 0.
              x_fldcat-no_out = 'X'.
            ELSE.
              PERFORM VAR_BOM USING T_STAS1-STLAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            endif.
          ENDIF.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE3'.
            read table t_stas1 with key stlal = '03'.
            if sy-subrc NE 0.
              x_fldcat-no_out = 'X'.
            ELSE.
              PERFORM VAR_BOM USING T_STAS1-STLAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            endif.
          ENDIF.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE4'.
            read table t_stas1 with key stlal = '04'.
            if sy-subrc NE 0.
              x_fldcat-no_out = 'X'.
            ELSE.
              PERFORM VAR_BOM USING T_STAS1-STLAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            endif.
          ENDIF.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE5'.
            read table t_stas1 with key stlal = '05'.
            if sy-subrc NE 0.
              x_fldcat-no_out = 'X'.
            ELSE.
              PERFORM VAR_BOM USING T_STAS1-STLAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            ENDIF.
          endif.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE6'.
            read table t_stas1 with key stlal = '06'.
            if sy-subrc NE 0.
              x_fldcat-no_out = 'X'.
            ELSE.
              PERFORM VAR_BOM USING 6.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            ENDIF.
          endif.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE7'.
            read table t_stas1 with key stlal = '07'.
            if sy-subrc NE 0.
              x_fldcat-no_out = 'X'.
            ELSE.
              PERFORM VAR_BOM USING 7.
              if sy-subrc = 0.
                CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
                IF T_BOM-STLST = '1'.
                  X_FLDCAT-EMPHASIZE = 'C511'.
                ENDIF.
                x_fldcat-seltext_l = W_BOM.
                x_fldcat-reptext_ddic = W_BOM.
                x_fldcat-ddictxt = c_l.
              ENDIF.
            endif.
          ENDIF.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE8'.
            read table t_stas1 with key stlal = '08'.
            if sy-subrc NE 0.
              x_fldcat-no_out = 'X'.
            ELSE.
              PERFORM VAR_BOM USING 8.
              if sy-subrc = 0.
                CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
                IF T_BOM-STLST = '1'.
                  X_FLDCAT-EMPHASIZE = 'C511'.
                ENDIF.
                x_fldcat-seltext_l = W_BOM.
                x_fldcat-reptext_ddic = W_BOM.
                x_fldcat-ddictxt = c_l.
              ENDIF.
            endif.
          ENDIF.
          modify i_fldcat from x_fldcat index T_INDEX.
          T_INDEX = T_INDEX + 1.
          CLEAR X_FLDCAT.
         ELSE.
          if x_fldcat-fieldname = 'IDNRK'.
            x_fldcat-seltext_l = 'Component'.
            x_fldcat-reptext_ddic = 'Component'.
            x_fldcat-inttype = c_c.
          endif.
          if x_fldcat-fieldname = 'MAKTX'.
            x_fldcat-seltext_l = 'Component Description'.
            x_fldcat-outputlen = 25.
            x_fldcat-reptext_ddic = 'Component Description'.
            x_fldcat-inttype = c_c.
          endif.
          if x_fldcat-fieldname = 'MEINS'.
            x_fldcat-seltext_l = 'UOM'.
            x_fldcat-reptext_ddic = 'UOM'.
            x_fldcat-ddictxt = c_l.
          endif.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE1'.
            PERFORM VAR_BOM USING 1.
            if T_BOM-STKTX IS NOT INITIAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            else.
              X_FLDCAT-NO_OUT = 'X'.
              X_FLDCAT-TECH = 'X'.
            endif.
          ENDIF.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE2'.
            PERFORM VAR_BOM USING 2.
            if T_BOM-STKTX IS NOT INITIAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            else.
              X_FLDCAT-NO_OUT = 'X'.
              X_FLDCAT-TECH = 'X'.
            endif.
          ENDIF.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE3'.
            PERFORM VAR_BOM USING 3.
            if T_BOM-STKTX IS NOT INITIAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            else.
              X_FLDCAT-NO_OUT = 'X'.
              X_FLDCAT-TECH = 'X'.
            endif.
          ENDIF.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE4'.
            PERFORM VAR_BOM USING 4.
            if T_BOM-STKTX IS NOT INITIAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            else.
              X_FLDCAT-NO_OUT = 'X'.
              X_FLDCAT-TECH = 'X'.
            endif.
          ENDIF.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE5'.
            PERFORM VAR_BOM USING 5.
            if T_BOM-STKTX IS NOT INITIAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            else.
              X_FLDCAT-NO_OUT = 'X'.
              X_FLDCAT-TECH = 'X'.
            ENDIF.
          endif.
          CLEAR T_BOM-STLST.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE6'.
            PERFORM VAR_BOM USING 6.
            if T_BOM-STKTX IS NOT INITIAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            else.
              X_FLDCAT-NO_OUT = 'X'.
              X_FLDCAT-TECH = 'X'.
            endif.
          endif.
          CLEAR T_BOM-STLST.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE7'.
            PERFORM VAR_BOM USING 7.
            if T_BOM-STKTX IS NOT INITIAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            else.
              X_FLDCAT-NO_OUT = 'X'.
              X_FLDCAT-TECH = 'X'.
            endif.
          endif.
          clear t_bom-STLST.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE8'.
            PERFORM VAR_BOM USING 8.
            if T_BOM-STKTX IS NOT INITIAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            else.
              X_FLDCAT-NO_OUT = 'X'.
              X_FLDCAT-TECH = 'X'.
            endif.
          endif.
          modify i_fldcat from x_fldcat index sy-tabix.
          CLEAR X_FLDCAT.
        endif.
      endloop.
    endform. " build_field_catalog
    FORM VAR_BOM USING P_CNT.
      if NOT stlal-low = ''.
        LOOP AT T_BOM where stlal = t_stas1-stlal .
          READ TABLE T_BOM with key stlal = t_stas1-stlal.
          IF SY-SUBRC <> 0.
            T_BOM-STKTX = ''.
            clear t_bom.
            exit.
          ENDIF.
        ENDLOOP.
      ELSE.
        LOOP AT T_BOM .
          READ TABLE T_BOM INDEX P_CNT.
          IF SY-SUBRC <> 0.
            T_BOM-STKTX = ''.
            clear t_bom.
            exit.
          ENDIF.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    "VAR_BOM
    form call_list_viewer.
      delete T_FINAL where IDNRK eq  ''.
      data : T1_MAST like T_MAST occurs 0 with header line.
      data : t_stas like STAS occurs 0 with header line.
       data : t_stko like stko occurs 0 with header line.
      clear : t_stas[],t_stas,t1_STPO,t1_STPO[],t_stko,t_stko[],t1_mast,
      t1_mast[].
      SELECT MATNR WERKS STLAN STLNR STLAL ANDAT
             INTO CORRESPONDING FIELDS OF TABLE T1_MAST
             FROM MAST WHERE MATNR = MATNR AND WERKS = WERKS
             AND STLAN = STLAN AND STLAL IN STLAL.
      if not T1_MAST[] is initial.
        read table T1_MAST index 1.
        select * from stas into table t_stas
                 where stlnr = T1_MAST-STLNR
                 and stlal in stlal
                 and STLTY NE 'D'.
      endif.
      IF NOT T1_MAST[] IS INITIAL.
        SELECT STLTY STLNR STLKN STPOZ ANDAT IDNRK POSTP POSNR
        MEINS MENGE FMENG POTX1 OBJTY STVKN
        INTO  CORRESPONDING FIELDS OF TABLE T1_STPO
        FROM STPO
        FOR ALL ENTRIES IN T1_MAST
        WHERE STLNR = T1_MAST-STLNR
        AND FMENG = 'X'.
      ENDIF.
      sort t_stas by STLAL STVKN.
      sort t_stas by STLNR STLAL.
      loop at T1_MAST.
        loop at t_stas where STLNR = T1_MAST-STLNR
                          and STLAL =  T1_MAST-STLAL.
          LOOP AT T1_STPO where STLKN = t_stas-STLKN.
            IF T1_MAST-STLAL = 01.
              T_FINAL-MAKTX = T1_STPO-POTX1.
              T_FINAL-MEINS = T1_STPO-MEINS.
              T_FINAL-MENGE1 = T1_STPO-MENGE.
            ELSEIF T1_MAST-STLAL = 02.
              T_FINAL-MAKTX = T1_STPO-POTX1.
              T_FINAL-MEINS = T1_STPO-MEINS.
              T_FINAL-MENGE2 = T1_STPO-MENGE.
            ELSEIF T1_MAST-STLAL = 03.
              T_FINAL-MAKTX = T1_STPO-POTX1.
              T_FINAL-MEINS = T1_STPO-MEINS.
              T_FINAL-MENGE3 = T1_STPO-MENGE.
            ELSEIF T1_MAST-STLAL = 04.
              T_FINAL-MAKTX = T1_STPO-POTX1.
              T_FINAL-MEINS = T1_STPO-MEINS.
              T_FINAL-MENGE4 = T1_STPO-MENGE.
            ELSEIF T1_MAST-STLAL = 05.
              T_FINAL-MAKTX = T1_STPO-POTX1.
              T_FINAL-MEINS = T1_STPO-MEINS.
              T_FINAL-MENGE5 = T1_STPO-MENGE.
            ELSEIF T1_MAST-STLAL = 06.
              T_FINAL-MAKTX = T1_STPO-POTX1.
              T_FINAL-MEINS = T1_STPO-MEINS.
              T_FINAL-MENGE6 = T1_STPO-MENGE.
            ELSEIF T1_MAST-STLAL = 07.
              T_FINAL-MAKTX = T1_STPO-POTX1.
              T_FINAL-MEINS = T1_STPO-MEINS.
              T_FINAL-MENGE7 = T1_STPO-MENGE.
            ELSEIF T1_MAST-STLAL = 08.
              T_FINAL-MAKTX = T1_STPO-POTX1.
              T_FINAL-MEINS = T1_STPO-MEINS.
              T_FINAL-MENGE8 = T1_STPO-MENGE.
            ENDIF.
            read table T_FINAL with key MAKTX = T1_STPO-POTX1.
            if sy-subrc ne 0.
              APPEND  T_FINAL.
              clear T_FINAL.
                     elseif T1_MAST-STLAL = 08.
                T_FINAL-MAKTX = T1_STPO-POTX1.
                T_FINAL-MEINS = T1_STPO-MEINS.
                T_FINAL-MENGE8 = T1_STPO-MENGE.
                MODIFY T_FINAL FROM T_FINAL TRANSPORTING MENGE8
                                          WHERE MAKTX = T1_STPO-POTX1.
                clear T_FINAL.
              endif.
            endif.
          endloop.
        endloop.
        clear : T_FINAL.
      endloop.
      sort T_FINAL by IDNRK descending.
    *end  09.07.2007
    *endded
    Thanks and regards
    vijay dwivedi

Maybe you are looking for

  • IPod Touch will not turn on unattached, Restore error 1604/1611

    Up through yesterday my iPod touch was working fine. However, after disconnecting it from syncing yesterday, it would not turn on. I have tried the manual reboot without success. The iPod will not turn on by just using the external power buttons. It

  • HP LaserJet 1000 Windows 7 (32/64 bit)?!

    Hi! How long company (HP) will ignore HP LaserJet 1000 users? We need drivers that working on Windows 7!!! Don't try to ask me buy another - new model of HP printer, because mine is work very well!!! HP printers working very well, but in case with dr

  • Final Cut Express as Offline - Final Cut Studio 2 as Online?

    Is it possible to use FInal Cut Express for offline editing and then replace the media with HD versions for online editing in Final Cut Pro? Example of our proposed Workflow: 1. Capture HDCam footage from CineAlta Camera into Final Cut Studio 2 at DV

  • Diplay results which span across multiple pages

    hello friends i want to display my search results which span across multiple pages with next and previos buttons. example google search .ie if u search for a topic it gives severl pages with next and previos buttons. thanks in advance R.G.SHARMA

  • Error in Export To Excel

    File error: data may have been lost When, I do property display cell to Hyperlink.