Dynamic ALV in Webdynpro

Hi Experts,
I need to display ALV report whose rows and columns needs to be generated dynamically.
for e.g:
               status 1        status2       ......  status n
Priority1
Priority 2
Priority n
In above report format: priority and status are not fixed and provided dynamically.
So, How I should approach to create such ALV?
Thank you.
Depesh Kumar.

Hi,
One way i can think is..... create a dynamic node and its attribute depending on the number of columns... thn create an internal table of type that node...... now add values in rows of internal table depending on number of rows thn..... bind this internal table with node again.. now node will have data... now map this node with alv node to display output.....
regards
Pranav
Content removed by Moderator
Edited by: Thomas Jung on Jan 22, 2009 10:35 AM

Similar Messages

  • Dynamic Alv for Dynamic Internal Table

    Hi All,
    I am new for abap dynpro.
    How can i create a dynamic alv table in abap dynpro withoud ddic structure??
    My requirement is as follows:
    I have a table having some field e.g MATNR WERKS NETWR.
    I want to pivot data werks and to display in webdynpro alv.
    Thnx:
    N. N. Tiwari

    You can use the RTTI to build up a dynamic structure in memory:
    Something like this - where both the data and its structure and meta data all come from an external source (which happens to be MDM in this case):
    ****ALV
          data:
             rootnode_info type ref to if_wd_context_node_info,
             dyn_node type ref to if_wd_context_node,
             dyn_node_info type ref to if_wd_context_node_info,
             tabname_node type ref to if_wd_context_node,
             current_tablename type string,
             tablename type string,
             struct_type type ref to cl_abap_structdescr,
              table_type  type ref to cl_abap_tabledescr,
              comp_tab    type cl_abap_structdescr=>component_table,
              comp        like line of comp_tab,
              my_table    type ref to data,
              my_row      type ref to data.
          field-symbols: <table> type table,
                         <row> type data,
                         <f>   type any,
                         <wa_string>     type string,
                         <wa_date_time>  type mdm_cdt_date_time,
                         <wa_integer>    type mdm_gdt_integervalue.
          rootnode_info = wd_context->get_node_info( ).
    * create subnode_info
          try.
              rootnode_info->remove_child_node( 'MDM_DATA' ).
            catch cx_wd_context.
          endtry.
          field-symbols <wa_detail> like line of field_details.
          field-symbols <wa_result> like line of result_set.
          field-symbols <wa_pair>   type mdm_name_value_pair.
          read table result_set assigning <wa_result> index 1.
          loop at field_details assigning <wa_detail>.
    * build a structure description from the list of single fields
            if strlen( <wa_detail>-field_code ) > 30.
              comp-name = <wa_detail>-field_code+0(30).
            else.
              comp-name = <wa_detail>-field_code.
            endif.
            if <wa_result> is assigned.
              read table <wa_result>-name_value_pairs assigning <wa_pair>
                            with key code = <wa_detail>-field_code.
              if sy-subrc = 0.
                case <wa_pair>-type.
                  when `MDM_CDT_DATE_TIME`.
                    comp-type ?= cl_abap_datadescr=>describe_by_name( 'TZNTSTMPL' ).
                  when `MDM_GDT_INTEGERVALUE`.
                    if <wa_detail>-field_lookup_table is not initial.
                      comp-type ?= cl_abap_datadescr=>describe_by_name( 'STRING' ).
                    else.
                      comp-type ?= cl_abap_datadescr=>describe_by_name( 'INT4' ).
                    endif.
                  when others.
                    comp-type ?= cl_abap_datadescr=>describe_by_name( <wa_pair>-type ).
                endcase.
              else.
                comp-type ?= cl_abap_datadescr=>describe_by_name( 'STRING' ).
              endif.
            else.
              comp-type ?= cl_abap_datadescr=>describe_by_name( 'STRING' ).
            endif.
            append comp to comp_tab.
          endloop.
          struct_type = cl_abap_structdescr=>create( comp_tab ).
          dyn_node_info = rootnode_info->add_new_child_node(
             name                   = 'MDM_DATA'
             is_mandatory           = abap_false
             is_mandatory_selection = abap_false
             static_element_rtti    = struct_type
             is_multiple            = abap_true
             is_static              = abap_false ).
    *  get instance of new node
          dyn_node = wd_context->get_child_node( name = 'MDM_DATA' ).
    ****Process Table Data
          data content_string type string.
          data l_tabix type sytabix.
          table_type = cl_abap_tabledescr=>create( p_line_type = struct_type ).
          create data my_table type handle table_type.
          assign my_table->* to <table>.
          loop at result_set assigning <wa_result>.
            create data my_row type handle struct_type.
            assign my_row->* to <row>.
            loop at field_details assigning <wa_detail>.
              l_tabix = sy-tabix.
              read table <wa_result>-name_value_pairs assigning <wa_pair>
                                      with key code = <wa_detail>-field_code.
    *        loop at <wa_result>-name_value_pairs assigning <wa_pair>.
              if sy-subrc = 0 and <wa_pair>-value is not initial.
                assign component l_tabix of structure <row> to <f>.
    *            READ TABLE field_details ASSIGNING <wa_detail> INDEX sy-tabix.
                case <wa_pair>-type.
                  when 'STRING'.
                    assign <wa_pair>-value->* to <wa_string>.
                    if <wa_string> is assigned.
    *                DATA: int TYPE i VALUE 258.
    *                DATA: buffer TYPE xstring,
    *                      text_buffer TYPE string,
    *                      conv TYPE REF TO cl_abap_conv_out_ce.
    *                conv = cl_abap_conv_out_ce=>create(
    *                         encoding = 'UTF-8'
    *                         endian = 'L' ).
    *                CALL METHOD conv->write( data = <wa_string> ).
    *                buffer = conv->get_buffer( ).
    *                DATA: convin  TYPE REF TO cl_abap_conv_in_ce.
    *                CALL METHOD cl_abap_conv_in_ce=>create
    *                  EXPORTING
    *                    input = buffer
    *                  RECEIVING
    *                    conv  = convin.
    *                CALL METHOD convin->read
    *                  IMPORTING
    *                    data = text_buffer.
    *                MOVE text_buffer TO <f>.
                      move <wa_string> to <f>.
                    endif.
                  when 'MDM_CDT_DATE_TIME'.
                    assign <wa_pair>-value->* to <wa_date_time>.
                    if <wa_date_time> is assigned.
                      move <wa_date_time>-content to <f>.
                    endif.
                  when 'MDM_GDT_INTEGERVALUE'.
                    assign <wa_pair>-value->* to <wa_integer>.
                    if <wa_integer> is assigned.
                      if <wa_detail>-field_lookup_table is not initial.
                        content_string = wd_assist->perform_value_lookup(
                            i_lookup_table = <wa_detail>-field_lookup_table
                            i_lookup_key   = <wa_integer> ).
                        move content_string to <f>.
                      else.
                        move <wa_integer> to <f>.
                      endif.
                    endif.
                endcase.
              endif.
            endloop.
            append <row> to <table>.
          endloop.
          dyn_node->bind_table( <table> ).
    * Connect to the component Usage of the ALV
          data: l_ref_cmp_usage type ref to if_wd_component_usage.
          l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ).
          if l_ref_cmp_usage->has_active_component( ) is initial.
            l_ref_cmp_usage->create_component( ).
          endif.
    * Through the interface controller of the ALV Component set the DATA node dynamically
          data: l_ref_interfacecontroller type ref to iwci_salv_wd_table .
          l_ref_interfacecontroller =   wd_this->wd_cpifc_alv( ).
          l_ref_interfacecontroller->set_data(
            r_node_data = dyn_node  ).
          data alv_model type ref to cl_salv_wd_config_table.
          alv_model = l_ref_interfacecontroller->get_model( ).
          data columns type salv_wd_t_column_ref.
          field-symbols <wa_column> like line of columns.
          columns = alv_model->if_salv_wd_column_settings~get_columns( ).
          data column_id type string.
          data header type ref to cl_salv_wd_column_header.
          data l_text type string.
          loop at field_details assigning <wa_detail>.
    * build a structure description from the list of single fields
            if strlen( <wa_detail>-field_code ) > 30.
              column_id = <wa_detail>-field_code+0(30).
            else.
              column_id = <wa_detail>-field_code.
            endif.
            translate column_id to upper case.
            read table columns assigning <wa_column> with table key id = column_id.
            if sy-subrc = 0.
              header = <wa_column>-r_column->get_header( ).
              header->set_ddic_binding_field( if_salv_wd_c_column_settings=>ddic_bind_none ).
    *      if <wa_detail>-field_lookup_table is initial.
              header->set_text( <wa_detail>-field_name1 ).
    *      else.
    *        l_text = wd_assist->read_table_desc_for_lookup( <wa_detail>-field_lookup_table ).
    *        header->set_text( l_text ).
    *      endif.
            endif.
          endloop.
        catch cx_root into o_except.
          data: l_current_controller type ref to if_wd_controller,
                l_message_manager    type ref to if_wd_message_manager.
          l_current_controller ?= wd_this->wd_get_api( ).
          l_message_manager = l_current_controller->get_message_manager( ).
          l_message_manager->report_exception(
              message_object           = o_except ).
      endtry.

  • 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

  • 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

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

  • How to make cell editable alv in WebDynpro for ABAP?

    I make Column editable ALV.(See under source code)
    But I can't make Cell editable ALV.
    How to make Cell editable ALV in WebDynpro for ABAP?
    and..how to get changed data?
    DATA: l_value TYPE REF TO cl_salv_wd_config_table.
      l_value = l_ref_interfacecontroller->get_model( ).
    * { EDITABLE
      DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
            lr_input_field     TYPE REF TO cl_salv_wd_uie_input_field,
            lr_column          TYPE REF TO cl_salv_wd_column.
      lr_column_settings ?= l_value.
      lr_column = lr_column_settings->get_column( 'TOTAL_COUNT' ).
      CREATE OBJECT lr_input_field
        EXPORTING
          value_fieldname = 'TOTAL_COUNT'.
      lr_column->set_cell_editor( lr_input_field ).
      DATA: lr_table_settings TYPE REF TO if_salv_wd_table_settings.
      lr_table_settings ?= l_value.
      lr_table_settings->set_read_only( abap_false ).

    the code seems to be correct....but where are you writing it?
    put the code in the wddoinit method and it should work.
    have a look at this article..
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1

  • How to restrict the no of rows to be displayes in ALV in webdynpro

    Hi All,
    Can any one suggest how to restrict the no of records to be displayed in the portal in the ALV through webdynpro ABAP.
    Thanks & Regards,
    Sreelatha Gullapalli.

    HI,
    If you want to change the Source (Design time) then you can do that via the alv configuration.
    Something like this in the component SALV_WD_COLUMNS_UI
    lr_available_model->if_salv_wd_table_settings~set_visible_row_count( lc_row_count ).

  • DIfference Between OOPS ALV and WEBDYNPRO FOR ABAP ALV?

    Hi to All,
    i want some information that What is main difference when we develop ALV Report in OOPS and WEBDYNPRO For ABAP.which is good n in what way it is good?
    In the Same way I m also want know that WHICH IS BETTER AMONG WEBDYNPRO FOR JAVA/ABAP.In which way?
    Regards,
    Ravi K

    Thanku for ur valuble Information.
    could u give me information regarding OOPS ALV and WEBDYNPRO FOR ABAP ALV?which is better?is there differences?
    Edited by: ravi k on Mar 26, 2008 12:23 PM

  • How to use traffic lights concept in alv in webdynpro abap

    Hai ,
              How to use traffic lights concept for alv in webdynpro abap. If possible give me some code.

    Hi Ravi,
    You can create ICON  to get traffic light.
    Go through this step by step.. in this example
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/1190424a-0801-0010-84b5-ef03fd2d33d9?quicklink=index&overridelayout=true
    Please go through this...
    Re: Display ICON in the ALV table column
    Re: Image in ALV
    cheers,
    Kris.

  • Color Cell in Dynamic ALV

    Hi all
    i try to put color in the dynamic alv, but i become a dump message
    Runtime Errors         OBJECTS_MOVE_NOT_SUPPORTED
    Date and Time          28.10.2010 08:46:49
    Short text
         Conversion of type "h" to type "g" not supported.
    What happened?
         Error in the ABAP Application Program
         The current ABAP program "SAPLSLVC" had to be terminated because it has
         come across a statement that unfortunately cannot be executed.
    Error analysis
         You attempted to move one data object to another.
         This is not possible here because the conversion of a data object
         of type "h" to type "g" is not supported.
    my code implementation looks like
      method validate_order_deli.
        data ls_scol        type lvc_s_scol.
        data ls_colo        type lvc_s_colo.
        data ls_aoc_percent type zsd_aoc_percent.
        data lf_deliv       type lifmg.
        data lf_db_percent  type f.
        data lf_calc_perc   type f.
        refresh et_color.
        select single *
          from zsd_aoc_percent
          into corresponding fields of ls_aoc_percent
          where acin = 'X'.
        if sy-subrc <> 0.
          exit.
        endif.
        lf_db_percent = ls_aoc_percent-percent.
    *    ls_scol-fname = if_fieldname.
        ls_scol-fname = 'MATNR'.
        if if_deliv <> 0.
          me->calc_amour_unit(
            exporting
              if_matnr  = if_matnr
              if_amount = if_deliv
              if_input  = if_deliv_unit
              if_output = if_order_unit
            importing
              ef_amount = lf_deliv
          lf_calc_perc = ( lf_deliv * 100 ) / if_order.
          if lf_calc_perc < lf_db_percent.
            ls_colo-col = cl_gui_resources=>list_col_positive.
          else.
            ls_colo-col = cl_gui_resources=>list_col_negative.
          endif.
          ls_scol-color = ls_colo.
          append ls_scol to et_color.
        else.
          exit.
        endif.
      endmethod.                    "validate_order_deli
      method add_color_field.
        data ls_fcat type lvc_s_fcat.
        ls_fcat-fieldname = 'COLOR'.
        ls_fcat-ref_field = 'COLTAB'.
        ls_fcat-ref_table = 'CALENDAR_TYPE'.
        append ls_fcat to ct_fcat.
      endmethod.                    "add_color_field
          ls_lvc_s_layo-cwidth_opt = 'X'.
          ls_lvc_s_layo-ctab_fname  = 'COLOR'.
    i don't no, what's wrong...
    thx for help

    *&      Form  generate_alv
    *       text
    form generate_alv.
      field-symbols <lt_any_table> type any table.
      if lrf_gui_custom_container is initial.
        create object lrf_gui_custom_container
          exporting
            container_name = lf_container.
        create object lrf_gui_alvgrid
          exporting
            i_parent = lrf_gui_custom_container.
        ls_lvc_s_layo-cwidth_opt = 'X'.
        ls_lvc_s_layo-ctab_fname  = 'COLOR'.
        check sy-subrc = 0.
        call method lrf_gui_alvgrid->set_table_for_first_display
             exporting
    *             i_buffer_active               =
    *             i_bypassing_buffer            =
    *             i_consistency_check           =
    *             i_structure_name              = 'ZAM_CELL_COLOR'
    *             is_variant                    = ls_disvariant
    *             i_save                        = 'A'
    *             i_default                     = 'X'
               is_layout                     = ls_lvc_s_layo
    *             is_print                      =
    *             it_special_groups             =
    *             it_toolbar_excluding          =
    *             it_hyperlink                  =
    *             it_alv_graphics               =
    *             it_except_qinfo               =
    *             ir_salv_adapter               =
              changing
                it_outtab                     = <gt_table>
                it_fieldcatalog               = gt_dyn_fcat
    *             it_filter                     =
             exceptions
               invalid_parameter_combination = 1
               program_error                 = 2
               too_many_lines                = 3
               others                        = 4.
        if sy-subrc <> 0.
          message id sy-msgid type sy-msgty number sy-msgno
                     with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        endif.
      endif.
    endform.                    "generate_alv
    *&      Module  STATUS_0100  OUTPUT
    *       text
    module status_0100 output.
      set pf-status 'ZAM_CELL_STATUS'.
      set titlebar 'ZAM_CELL_TIT'.
      perform generate_alv.
    endmodule.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    module user_command_0100 input.
      data lf_okcode type syucomm.
      call method cl_gui_cfw=>dispatch.
      lf_okcode = ok_code.
      case lf_okcode.
        when 'EXIT'.
          set screen 0.
          leave screen.
        when 'CANCEL'.
          leave program.
        when 'BACK'.
          set screen 0.
          leave screen..
      endcase.
    endmodule.                 " USER_COMMAND_0100  INPUT

  • Subtotal in Dynamic ALV

    Hi,
    Please tell how to perform Subtotal in dynamic ALV Report.
    Normal Subtotal functionality(the one which is used for static ALV report ) is not working for that.
    Thanks.

    Hi,
    Please tell how to perform Subtotal in dynamic ALV Report.
    Normal Subtotal functionality(the one which is used for static ALV report ) is not working for that.
    Thanks.

  • I want  to create dynamic ALV report

    Hi great abapers,
    I want  to create dynamic ALV report.Please help me.
    Regards,
    Billa

    Hi,
    Please check the code below:
    REPORT YMMR_PALLET_OVERVIEW MESSAGE-ID Y_MESSAGE_0001.
    Short description:
    To Display and sum up the Quantity of scanned materials on pallet for*
    each Shipment number for the Packaging Materials. *
    TYPE-POOLS : SLIS.
    TABLES: YYLE0003. " Scanned SSCC No.
    --Structure Declaration--
    Structure for Shipment No. and Date.
    TYPES : BEGIN OF T_VTTK_TAB ,
    TKNUM LIKE VTTK-TKNUM, " Shipment number
    ERDAT LIKE VTTK-ERDAT, " created Date
    END OF T_VTTK_TAB .
    Structure for Shipment No., Packaging Materials and Date.
    TYPES: BEGIN OF T_ITAB2,
    TKNUM LIKE YYLE0003-TKNUM, " Shipment number
    VHILM LIKE YYLE0003-VHILM, " Packaging Materials
    QUANTITY TYPE P,
    ERDAT LIKE YYLE0003-ERDAT, " created Date
    COUNT TYPE I,
    END OF T_ITAB2.
    Structure for Shipment No. and Packaging Materials.
    TYPES: BEGIN OF T_ITAB3,
    TKNUM LIKE YYLE0003-TKNUM, " Shipment number
    VHILM LIKE YYLE0003-VHILM, " Packaging Materials
    QUANTITY TYPE P, " Quantity
    END OF T_ITAB3.
    --Internal table Declaration--
    *Internal tables for the above Declared structures
    DATA: G_VTTK_TAB TYPE TABLE OF T_VTTK_TAB,
    G_ITAB5_TAB TYPE TABLE OF T_ITAB2,
    G_ITAB4_TAB TYPE TABLE OF T_ITAB3,
    G_ITAB3_TAB TYPE TABLE OF T_ITAB2. "#EC NEEDED
    *Internal table Holding Shipment No.and quantity
    DATA: BEGIN OF G_TOTAL_TAB OCCURS 0 ,
    TKNUM TYPE YYLE0003-TKNUM, " Shipment number
    QUANTITY TYPE P,
    COUNT TYPE I,
    END OF G_TOTAL_TAB .
    *Internal table for selection screen data
    DATA: BEGIN OF G_SCANDATA_TAB OCCURS 0,
    VHILM LIKE YYLE0003-VHILM, " Packaging Materials
    EXIDV TYPE EXIDV, " External Handling Unit
    TKNUM LIKE YYLE0003-TKNUM, " Shipment number
    QUANTITY LIKE YYLE0003-QUANTITY, " Quantity
    END OF G_SCANDATA_TAB.
    DATA: BEGIN OF ST_SCANDATA_TAB,
    VHILM LIKE YYLE0003-VHILM, " Packaging Materials
    EXIDV TYPE EXIDV, " External Handling Unit
    TKNUM LIKE YYLE0003-TKNUM, " Shipment number
    QUANTITY LIKE YYLE0003-QUANTITY, " Quantity
    END OF ST_SCANDATA_TAB.
    DATA: BEGIN OF G_SCANDATA_COUNT_TAB OCCURS 0,
    VHILM LIKE YYLE0003-VHILM, " Packaging Materials
    TKNUM LIKE YYLE0003-TKNUM, " Shipment number
    QUANTITY LIKE YYLE0003-QUANTITY, " Quantity
    COUNT TYPE I,
    END OF G_SCANDATA_COUNT_TAB.
    DATA: L_COUNT TYPE I.
    *Internal table for Packaging Materials and quantity
    DATA: BEGIN OF G_ITAB6_TAB OCCURS 0,
    VHILM LIKE YYLE0003-VHILM, " Packaging Materials
    QUANTITY TYPE P, " Quantity
    END OF G_ITAB6_TAB.
    *- Field catalog
    DATA: L_ALV_CAT1_TAB TYPE TABLE OF LVC_S_FCAT.
    --Work area Declaration--
    DATA: WA_VTTK TYPE T_VTTK_TAB,
    WA_ITAB3 TYPE T_ITAB2,
    WA_ITAB5 TYPE T_ITAB2,
    WA_ITAB4 TYPE T_ITAB3,
    WA_ITAB1 LIKE G_SCANDATA_TAB,
    WA_ALV_CAT1 LIKE LINE OF L_ALV_CAT1_TAB.
    ----Variable Defnition -
    DATA: G_CUSTOM_CONTAINER_0100 TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
    G_ALV_GRID_0100 TYPE REF TO CL_GUI_ALV_GRID,
    G_CONTAINER_0100 TYPE SCRFNAME VALUE 'LIST',
    G_MYLAYOUT TYPE LVC_S_LAYO, "#EC NEEDED
    G_WA TYPE REF TO DATA.
    DATA: G_VAR TYPE I, " No of records
    G_VAR1 TYPE CHAR20. " Variable
    --field symbols Declaration--
    FIELD-SYMBOLS : <F_FS> TYPE TABLE,
    <F_FS3> TYPE ANY,
    <F_FS4> TYPE ANY,
    <F_FS5> TYPE ANY,
    <F_WA> TYPE ANY,
    <F_FS15> TYPE ANY,
    <F_FS16> TYPE SY-DATUM,
    <F_FS2> TYPE T_ITAB2,
    <F_FS6> TYPE ANY,
    <F_FS7> TYPE ANY,
    <F_FS12> TYPE ANY,
    <F_FS13> TYPE ANY.
    --Selection Parameters--
    SELECTION-SCREEN: BEGIN OF BLOCK BLCK01 WITH FRAME TITLE TEXT-000.
    "Select options
    SELECT-OPTIONS :
    S_TKNUM FOR YYLE0003-TKNUM , " Shipment number
    S_YYREF FOR YYLE0003-YY_REFERENCE, " Packing reference
    S_YYREFT FOR YYLE0003-YY_REFTP, " Reference type
    S_EXIDV FOR YYLE0003-EXIDV, " External HU
    S_MATNR FOR YYLE0003-MATNR, " Material number
    S_VBELN FOR YYLE0003-VBELN, " SD number
    S_POSNR FOR YYLE0003-POSNR, " Item number
    S_LGTOR FOR YYLE0003-LGTOR, " Door for Wr Hs No
    S_VHILM FOR YYLE0003-VHILM, " Packaging Mat
    S_YYMEIN FOR YYLE0003-YY_MEINH, " Indicator for UOM
    S_QUANTI FOR YYLE0003-QUANTITY, " Quantity
    S_YCHECK FOR YYLE0003-YYCHECKED, " Destination_door
    S_STATUS FOR YYLE0003-STATUS, " Packing status
    S_STASHI FOR YYLE0003-STATUSSHIPTO, " Status on ship-to
    S_LOADTR FOR YYLE0003-LOADTRUCK, " Load truck
    S_ERDAT FOR YYLE0003-ERDAT , " Date
    S_ERZET FOR YYLE0003-ERZET, " Entry time
    S_AEDAT FOR YYLE0003-AEDAT, " Last changed on
    S_ERNAM FOR YYLE0003-ERNAM, " Name of Person
    S_AEZET FOR YYLE0003-AEZET, " Time last change
    S_AENAM FOR YYLE0003-AENAM. " Name of person
    SELECTION-SCREEN: END OF BLOCK BLCK01.
    --INITIALIZATION--
    INITIALIZATION.
    Clear the variables and workarea
    CLEAR :G_VAR,
    G_VAR1,
    WA_VTTK,
    WA_ITAB3,
    WA_ITAB5,
    WA_ITAB4,
    WA_ITAB1,
    WA_VTTK,
    WA_ITAB3,
    WA_ITAB5,
    WA_ITAB4,
    WA_ITAB1.
    --AT SELECTION-SCREEN--
    AT SELECTION-SCREEN.
    To validate the data entered in selection screen
    PERFORM SUB_VALIDATE.
    --START-OF-SELECTION--
    START-OF-SELECTION.
    *To fetch the data from table yyle0003
    PERFORM GET_INPUT_DATA.
    *To create the Dynamic Field Catalog
    PERFORM GET_FIELDCAT.
    To populate the data to final table
    PERFORM GET_FINAL_DATA.
    MODULE status_0100 OUTPUT *
    MODULE STATUS_0100 OUTPUT.
    *set title bar and PF status.
    SET PF-STATUS 'ZVKS'.
    SET TITLEBAR 'ZVKS'.
    CHECK SY-UCOMM IS INITIAL.
    SORT G_SCANDATA_TAB BY TKNUM VHILM.
    *Create object for Custom container
    CREATE OBJECT G_CUSTOM_CONTAINER_0100
    EXPORTING
    CONTAINER_NAME = G_CONTAINER_0100
    EXCEPTIONS
    CNTL_ERROR = 1
    CNTL_SYSTEM_ERROR = 2
    CREATE_ERROR = 3
    LIFETIME_ERROR = 4
    LIFETIME_DYNPRO_DYNPRO_LINK = 5.
    *Create object for ALV grid
    CREATE OBJECT G_ALV_GRID_0100
    EXPORTING I_PARENT = G_CUSTOM_CONTAINER_0100.
    G_MYLAYOUT-GRID_TITLE = 'Display Scanning data'.
    *Call method for table Display
    CALL METHOD G_ALV_GRID_0100->SET_TABLE_FOR_FIRST_DISPLAY
    CHANGING
    IT_OUTTAB = <F_FS>
    IT_FIELDCATALOG = L_ALV_CAT1_TAB
    EXCEPTIONS
    INVALID_PARAMETER_COMBINATION = 1
    PROGRAM_ERROR = 2
    TOO_MANY_LINES = 3
    OTHERS = 4.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDMODULE. " STATUS_0100 OUTPUT
    *& Module USER_COMMAND_0100 INPUT
    User Interaction
    MODULE USER_COMMAND_0100 INPUT.
    CALL METHOD CL_GUI_CFW=>DISPATCH.
    *To exit , back or cancel
    CASE SY-UCOMM.
    WHEN 'EXIT'.
    LEAVE TO SCREEN 0.
    WHEN 'BACK'.
    LEAVE TO SCREEN 0.
    WHEN 'CANCEL'.
    LEAVE PROGRAM.
    WHEN OTHERS.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    *& Form get_input_data
    This sub routine will get the data from yyle0003 table.
    FORM GET_INPUT_DATA.
    CONSTANTS: C_DOT TYPE C VALUE '.',
    C_CHAR TYPE C VALUE 'D'.
    CLEAR G_SCANDATA_TAB.
    Get the data from yyle0003
    SELECT VHILM " Packaging Materials
    EXIDV " External Handling Unit
    TKNUM " Shipment number
    QUANTITY " Quantity
    FROM YYLE0003
    INTO TABLE G_SCANDATA_TAB
    WHERE TKNUM IN S_TKNUM " Shipment number
    AND YY_REFERENCE IN S_YYREF " Packing reference
    AND YY_REFTP IN S_YYREFT " Reference type
    AND EXIDV IN S_EXIDV " External Handling Unit
    AND MATNR IN S_MATNR " Material number
    AND VBELN IN S_VBELN " SD number
    AND POSNR IN S_POSNR " Item number
    AND LGTOR IN S_LGTOR " Door for warehouse No
    AND VHILM IN S_VHILM " Packaging Materials
    AND YY_MEINH IN S_YYMEIN " Indicator for UOM
    AND QUANTITY IN S_QUANTI " Quantity
    AND YYCHECKED IN S_YCHECK " Destination_door
    AND STATUS IN S_STATUS " Packing status
    AND STATUSSHIPTO IN S_STASHI " Status on ship-to
    AND LOADTRUCK IN S_LOADTR " Load truck
    AND ERDAT IN S_ERDAT " Date
    AND ERZET IN S_ERZET " Entry time
    AND AEDAT IN S_AEDAT " Last changed on
    AND ERNAM IN S_ERNAM " Name of Person
    AND AEZET IN S_AEZET " Time last change
    AND AENAM IN S_AENAM. " Name of person
    If VHILM contains any Decimal '.', replace it with D
    LOOP AT G_SCANDATA_TAB.
    REPLACE C_DOT WITH C_CHAR INTO G_SCANDATA_TAB-VHILM.
    IF SY-SUBRC = 0.
    MODIFY G_SCANDATA_TAB TRANSPORTING VHILM.
    ENDIF.
    CLEAR G_SCANDATA_TAB.
    ENDLOOP.
    *To get the Shipment No Creation date from VTTK.
    SELECT TKNUM
    ERDAT
    FROM VTTK
    INTO TABLE G_VTTK_TAB
    WHERE TKNUM IN S_TKNUM.
    SORT G_SCANDATA_TAB BY VHILM EXIDV. "TKNUM VHILM.
    *To get the repeatition of Pacakaging material for each Shipment.
    *--- to find the count of packaging materials under each shipment
    LOOP AT G_SCANDATA_TAB.
    READ TABLE G_SCANDATA_TAB INTO ST_SCANDATA_TAB INDEX SY-TABIX.
    AT END OF EXIDV.
    L_COUNT = L_COUNT + 1.
    MOVE-CORRESPONDING ST_SCANDATA_TAB TO G_SCANDATA_COUNT_TAB.
    G_SCANDATA_COUNT_TAB-COUNT = L_COUNT.
    CLEAR: ST_SCANDATA_TAB, L_COUNT.
    COLLECT G_SCANDATA_COUNT_TAB.
    ENDAT.
    CLEAR : G_SCANDATA_TAB.
    ENDLOOP.
    ENDFORM. " get_input_data
    *& Form sub_validate
    *This subroutine will validate the data eneterd in the selection screen
    FORM SUB_VALIDATE.
    *Varaiable declaration for Shipment number
    DATA: L_TKNUM TYPE YYLE0003-TKNUM."#EC NEEDED " Shipment number
    *- Condition will not qualify all primary key (IDENT)
    SELECT TKNUM FROM YYLE0003 UP TO 1 ROWS
    INTO L_TKNUM "wa_scandata
    WHERE TKNUM IN S_TKNUM " Shipment number
    AND YY_REFERENCE IN S_YYREF " Packing reference
    AND YY_REFTP IN S_YYREFT " Reference type
    AND EXIDV IN S_EXIDV " External Handling Unit
    AND MATNR IN S_MATNR " Material number
    AND VBELN IN S_VBELN " SD number
    AND POSNR IN S_POSNR " Item number
    AND LGTOR IN S_LGTOR " Door for warehouse No
    AND VHILM IN S_VHILM " Packaging Materials
    AND YY_MEINH IN S_YYMEIN " Indicator for UOM
    AND QUANTITY IN S_QUANTI " Quantity
    AND YYCHECKED IN S_YCHECK " Destination_door
    AND STATUS IN S_STATUS " Packing status
    AND STATUSSHIPTO IN S_STASHI " Status on ship-to
    AND LOADTRUCK IN S_LOADTR " Load truck
    AND ERDAT IN S_ERDAT " Date
    AND ERZET IN S_ERZET " Entry time
    AND AEDAT IN S_AEDAT " Last changed on
    AND ERNAM IN S_ERNAM " Name of Person
    AND AEZET IN S_AEZET " Time last change
    AND AENAM IN S_AENAM. " Name of person
    ENDSELECT.
    IF SY-SUBRC <> 0.
    MESSAGE E987 . " No data found for these selection criterias
    ENDIF.
    ENDFORM. " sub_validate
    *& Form get_fieldcat
    Preparing Field catalog
    FORM GET_FIELDCAT.
    DATA: L_REF TYPE REF TO DATA,
    L_I TYPE I. " Variable
    CONSTANTS: C_CENTER TYPE C VALUE 'C'. " Center Justified
    LOOP AT G_SCANDATA_TAB INTO WA_ITAB1.
    MOVE-CORRESPONDING WA_ITAB1 TO WA_ITAB3.
    APPEND WA_ITAB3 TO G_ITAB3_TAB.
    MOVE-CORRESPONDING WA_ITAB1 TO WA_ITAB4.
    COLLECT WA_ITAB4 INTO G_ITAB4_TAB.
    *To sum up the qunatity field for each TKNUM.
    AT END OF TKNUM.
    SUM.
    MOVE WA_ITAB1-TKNUM TO G_TOTAL_TAB-TKNUM.
    MOVE WA_ITAB1-QUANTITY TO G_TOTAL_TAB-QUANTITY .
    APPEND G_TOTAL_TAB.
    CLEAR G_TOTAL_TAB.
    ENDAT.
    CLEAR : WA_ITAB1,
    WA_ITAB3,
    WA_ITAB4.
    ENDLOOP.
    *--- Begin of change - SKR.EXT - EBDK986377
    SORT G_ITAB4_TAB BY TKNUM.
    *--- End of change - SKR.EXT - EBDK986377
    LOOP AT G_ITAB4_TAB INTO WA_ITAB4.
    MOVE-CORRESPONDING WA_ITAB4 TO WA_ITAB5.
    MOVE-CORRESPONDING WA_ITAB4 TO G_ITAB6_TAB.
    *---- to get the count
    READ TABLE G_SCANDATA_COUNT_TAB WITH KEY TKNUM = WA_ITAB5-TKNUM
    VHILM = WA_ITAB5-VHILM.
    IF SY-SUBRC EQ 0.
    WA_ITAB5-COUNT = G_SCANDATA_COUNT_TAB-COUNT.
    ENDIF.
    APPEND WA_ITAB5 TO G_ITAB5_TAB.
    COLLECT G_ITAB6_TAB.
    ENDLOOP.
    CLEAR : WA_ITAB3.
    SORT G_ITAB4_TAB BY TKNUM VHILM.
    DELETE ADJACENT DUPLICATES FROM G_ITAB4_TAB COMPARING VHILM.
    *To get the Number of fields to be displayed
    DESCRIBE TABLE G_ITAB4_TAB LINES G_VAR.
    L_I = '3'.
    *Field catalog
    WA_ALV_CAT1-FIELDNAME = 'TKNUM'(002).
    WA_ALV_CAT1-COL_POS = 1.
    WA_ALV_CAT1-COLTEXT ='ShipmentNo.'.
    APPEND WA_ALV_CAT1 TO L_ALV_CAT1_TAB.
    CLEAR : WA_ALV_CAT1.
    WA_ALV_CAT1-FIELDNAME = 'ERDAT'(003).
    WA_ALV_CAT1-COL_POS = 2.
    WA_ALV_CAT1-COLTEXT ='Creation_Date.'(005).
    APPEND WA_ALV_CAT1 TO L_ALV_CAT1_TAB.
    CLEAR : WA_ALV_CAT1.
    Create field catalog for each of VHILM
    LOOP AT G_ITAB4_TAB INTO WA_ITAB4.
    IF G_VAR >= 1.
    CONDENSE WA_ITAB4-VHILM NO-GAPS.
    WA_ALV_CAT1-FIELDNAME = WA_ITAB4-VHILM. "l_fieldname.
    WA_ALV_CAT1-COL_POS = L_I.
    WA_ALV_CAT1-COLTEXT = WA_ITAB4-VHILM.
    WA_ALV_CAT1-JUST = C_CENTER. "'C'.
    APPEND WA_ALV_CAT1 TO L_ALV_CAT1_TAB.
    CLEAR WA_ALV_CAT1.
    L_I = L_I + 1.
    ENDIF.
    *TOTAL-last column in the field catalog
    AT LAST.
    WA_ALV_CAT1-FIELDNAME = 'TOTAL'(004).
    WA_ALV_CAT1-COL_POS = L_I.
    WA_ALV_CAT1-COLTEXT = 'TOTAL'(004).
    WA_ALV_CAT1-JUST = C_CENTER. " 'C'.
    APPEND WA_ALV_CAT1 TO L_ALV_CAT1_TAB.
    CLEAR WA_ALV_CAT1.
    ENDAT.
    SORT L_ALV_CAT1_TAB BY FIELDNAME.
    *Non of the field name should not get repeated
    DELETE ADJACENT DUPLICATES FROM L_ALV_CAT1_TAB.
    ENDLOOP.
    SORT L_ALV_CAT1_TAB BY COL_POS.
    *Creating Dynamic Internal table
    CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
    EXPORTING
    IT_FIELDCATALOG = L_ALV_CAT1_TAB
    IMPORTING
    EP_TABLE = L_REF.
    Assigning the Dynamic field Catalog to field symbol.
    ASSIGN L_REF->* TO <F_FS>.
    CREATE DATA G_WA LIKE LINE OF <F_FS>.
    ASSIGN G_WA->* TO <F_WA>.
    DELETE ADJACENT DUPLICATES FROM <F_FS> COMPARING ALL FIELDS.
    ENDFORM. " get_fieldcat
    *& Form display_data
    FORM GET_FINAL_DATA.
    *variable declaration
    DATA: L_TOTAL TYPE I, " Row wise total
    L_FILL TYPE I, " Count
    L_TOT TYPE I. " Grand total
    *To get the TOTAL qunatity in the last line of out put.
    LOOP AT G_ITAB6_TAB.
    CLEAR WA_ITAB5.
    WA_ITAB5-TKNUM = 'TOTAL'(004).
    WA_ITAB5-ERDAT = SPACE.
    MOVE-CORRESPONDING G_ITAB6_TAB TO WA_ITAB5 .
    LOOP AT G_SCANDATA_COUNT_TAB WHERE VHILM = G_ITAB6_TAB-VHILM.
    WA_ITAB5-COUNT = WA_ITAB5-COUNT + G_SCANDATA_COUNT_TAB-COUNT.
    ENDLOOP.
    APPEND WA_ITAB5 TO G_ITAB5_TAB.
    CLEAR WA_ITAB5.
    ENDLOOP.
    DESCRIBE TABLE G_ITAB5_TAB LINES L_TOT.
    *>>>>>>>>
    ****To get total qunatity of all TKNUM
    LOOP AT G_TOTAL_TAB .
    L_TOTAL = L_TOTAL + G_TOTAL_TAB-QUANTITY.
    ENDLOOP.
    *>>>>>>>>
    *To assign ERDAT to g_itab5_tab
    LOOP AT G_ITAB5_TAB INTO WA_ITAB5 .
    READ TABLE G_VTTK_TAB INTO WA_VTTK WITH KEY TKNUM = WA_ITAB5-TKNUM.
    IF SY-SUBRC = 0.
    WA_ITAB5-ERDAT = WA_VTTK-ERDAT.
    MODIFY G_ITAB5_TAB FROM WA_ITAB5 TRANSPORTING ERDAT.
    ENDIF.
    ENDLOOP.
    *Assigning value in each field to respective Field symbols.
    LOOP AT G_ITAB5_TAB ASSIGNING <F_FS2>.
    CLEAR G_TOTAL_TAB-QUANTITY.
    ASSIGN COMPONENT 'TKNUM' OF STRUCTURE <F_FS2> TO <F_FS6>.
    ASSIGN COMPONENT 'TKNUM' OF STRUCTURE <F_WA> TO <F_FS7>.
    <F_FS7> = <F_FS6>.
    CONDENSE <F_FS2>-VHILM NO-GAPS.
    ASSIGN COMPONENT 'VHILM' OF STRUCTURE <F_FS2> TO <F_FS3>.
    ASSIGN COMPONENT 5 OF STRUCTURE <F_FS2> TO <F_FS4>.
    MOVE <F_FS3> TO G_VAR1.
    ASSIGN COMPONENT G_VAR1 OF STRUCTURE <F_WA> TO <F_FS5>.
    <F_FS5> = <F_FS4>.
    ASSIGN COMPONENT 'ERDAT' OF STRUCTURE <F_FS2> TO <F_FS16>.
    ASSIGN COMPONENT 'ERDAT' OF STRUCTURE <F_WA> TO <F_FS15>.
    WRITE <F_FS16> TO <F_FS15> .
    Inorder not to display the date '00/00/000',
    if there is no DATE .
    IF ( <F_FS15> CP '00/*' )
    OR ( <F_FS15> CP '00.*' )
    OR ( <F_FS15> CP '00-*' ).
    <F_FS15> = SPACE.
    ELSEIF ( <F_FS15> CO ' / /' )
    OR ( <F_FS15> CO ' . .' )
    OR ( <F_FS15> CO ' - -' ) .
    <F_FS15> = SPACE.
    ENDIF.
    READ TABLE G_TOTAL_TAB WITH KEY TKNUM = <F_FS6>.
    IF SY-SUBRC = 0.
    ASSIGN G_TOTAL_TAB-QUANTITY TO <F_FS12>.
    ASSIGN COMPONENT 'COUNT' OF STRUCTURE <F_FS2> TO <F_FS12>.
    ASSIGN COMPONENT 'TOTAL' OF STRUCTURE <F_WA> TO <F_FS13>.
    <F_FS13> = <F_FS13> + <F_FS12>.
    L_TOTAL = L_TOTAL + <F_FS12>.
    ENDIF.
    L_FILL = L_FILL + 1.
    IF L_FILL = L_TOT.
    ASSIGN L_TOTAL TO <F_FS12>.
    ASSIGN COMPONENT 'TOTAL' OF STRUCTURE <F_WA> TO <F_FS13>.
    <F_FS13> = <F_FS12>.
    ENDIF.
    AT END OF <F_FS2>-TKNUM.
    APPEND <F_WA> TO <F_FS>.
    CLEAR <F_WA>.
    ENDAT.
    ENDLOOP.
    CLEAR: <F_FS6>,
    <F_FS7>,
    <F_WA>.
    *Call the screen where Custom container is defined
    CALL SCREEN 0100.
    ENDFORM. " display_data
    Regards
    Kannaiah

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

Maybe you are looking for

  • Thunderbolt/firewire 800 adapter

    Does the thunderbolt to firewire adapter really works? Have you noticed any change in speed? I'm reading a lot of negative reviews, and I need one!!!!!

  • Don't understand error message from HTML parser?

    I've written a simple test program to parse a simple html file. Everything works fine accept for the <img src="test.gif"> tag. It understands the img tag and the handleSimpleTag gets called. I can even pick out the src attribute. But I get a very str

  • Internal Order Tolerances inn 11.5.9

    Internal order shipments between Site A and Site B. Say Site A ships 99 out of 100 items on an internal order line. It appears that the internal order line is closing-yet the internal requisition will remain open looking for 1 more piece of supply. A

  • How to Create simple WCF/REST (JOSN,get and post) and deploy to Sharepoint 2013 Server.

    HI All,    I wan to create a simple WCF/REST service and deployed to SharePoint server , i have created some sample svc file and put in to _vti_bin folder using SharePoint solution using vs 2013 but its not accessible from IIS its always asking the W

  • Navigation with a target

    Hi all masters, I have a Question..... I'm working with two frames  ( FR1 and FR2 ) with a tableView in FR1 I'm getting somethings events, (rowselect), and with the data of that row, i need show in the frame FR2 the content of it.. I try with, naviga