Lvc_t_styl in dynamic catalog

hi
i created a programm with dynamic table and dynamic catalog
how can i put in field catalog the table lvc_t_styl ?
  DATA : it_content  TYPE REF TO data. 
  FIELD-SYMBOLS : <itab> TYPE STANDARD TABLE. 
  DATA : ls_fieldcat TYPE lvc_s_fcat. 
celltab          TYPE lvc_t_styl.
  DATA : ls_fieldcat TYPE lvc_s_fcat. 
    ls_fieldcat-fieldname = 'WERKS'. 
    ls_fieldcat-datatype = 'CHAR4'. 
    ls_fieldcat-coltext   = 'Site'. 
    ls_fieldcat-outputlen = 4. 
    ls_fieldcat-edit = ''. 
    APPEND ls_fieldcat TO it_fcat. 
    CLEAR ls_fieldcat. 
    ls_fieldcat-fieldname = 'RAYON'. 
    ls_fieldcat-datatype = 'CHAR6'. 
    ls_fieldcat-coltext   = 'Rayon'. 
    ls_fieldcat-outputlen = 6. 
    ls_fieldcat-edit = ''. 
    APPEND ls_fieldcat TO it_fcat. 
    CLEAR ls_fieldcat. 
ls_fieldcat-fieldname = 'GRPFA'. 
    ls_fieldcat-datatype = 'CHAR7'. 
    ls_fieldcat-coltext   = 'Famille'. 
    ls_fieldcat-outputlen = 7. 
    ls_fieldcat-edit = ''. 
    APPEND ls_fieldcat TO it_fcat. 
    CLEAR ls_fieldcat. 
X  day (it_fcat) 
    CLEAR datetemp. 
    number = 1. 
    datetemp = datedeb. 
    WHILE datetemp <= datefin. 
      CLEAR column. 
      CONCATENATE 'C' number INTO colonne. 
      ls_fieldcat-fieldname = column 
      ls_fieldcat-datatype = 'CHAR4'. 
      ls_fieldcat-coltext   = ''. 
      ls_fieldcat-outputlen = 4. 
      ls_fieldcat-edit = 'X'. 
      APPEND ls_fieldcat TO it_fcat. 
      CLEAR ls_fieldcat. 
     datetemp = datetemp + 1. 
      number = number + 1. 
    ENDWHILE. 
    CALL METHOD cl_alv_table_create=>create_dynamic_table 
      EXPORTING 
        it_fieldcatalog = it_fcat 
      IMPORTING 
        ep_table        = it_content. 
    IF sy-subrc = 0. 
      ASSIGN it_content->* TO <itab>. 
    ELSE. 
      WRITE: 'Error creating internal table'. 
      STOP. 
   ENDIF.

hi james
thanks for your program.It gives me an idea how to do.
So it's possible to create with a field symbol table
CALL FUNCTION 'WEEK_GET_FIRST_DAY'
EXPORTING
week               = p_datab
IMPORTING
date               = datedeb
* EXCEPTIONS
*   WEEK_INVALID       = 1
*   OTHERS             = 2
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'WEEK_GET_FIRST_DAY'
EXPORTING
week               = p_datbi
IMPORTING
date               = datefin
* EXCEPTIONS
*   WEEK_INVALID       = 1
*   OTHERS             = 2
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
datefin = datefin + 6.
REFRESH it_fcat.
FIELD-SYMBOLS: <fcat> TYPE lvc_s_fcat.
* column site (it_fcat)
ls_fieldcat-fieldname = 'WERKS'.
ls_fieldcat-datatype = 'CHAR4'.
ls_fieldcat-coltext   = 'Site'.
ls_fieldcat-outputlen = 4.
ls_fieldcat-edit = ''.
APPEND ls_fieldcat TO it_fcat.
CLEAR ls_fieldcat.
* column rayon (it_fcat)
ls_fieldcat-fieldname = 'RAYON'.
ls_fieldcat-datatype = 'CHAR6'.
ls_fieldcat-coltext   = 'Rayon'.
ls_fieldcat-outputlen = 6.
ls_fieldcat-edit = ''.
APPEND ls_fieldcat TO it_fcat.
CLEAR ls_fieldcat.
* column famille (it_fcat)
ls_fieldcat-fieldname = 'GRPFA'.
ls_fieldcat-datatype = 'CHAR7'.
ls_fieldcat-coltext   = 'Famille'.
ls_fieldcat-outputlen = 7.
ls_fieldcat-edit = ''.
APPEND ls_fieldcat TO it_fcat.
CLEAR ls_fieldcat.
* X day column jour (it_fcat)
CLEAR datetemp.
number = 1.
datetemp = datedeb.
WHILE datetemp <= datefin.
CLEAR colonne.
CONCATENATE 'C' number INTO colonne.
ls_fieldcat-fieldname = colonne.
ls_fieldcat-datatype = 'CHAR4'.
ls_fieldcat-coltext   = ''.
ls_fieldcat-outputlen = 4.
ls_fieldcat-edit = 'X'.
APPEND ls_fieldcat TO it_fcat.
CLEAR ls_fieldcat.
datetemp = datetemp + 1.
number = number + 1.
ENDWHILE.
*    ls_fieldcat-fieldname = 'T_CELLCOLORS'.
*  ls_fieldcat-ref_field = 'COLTAB'.
*  ls_fieldcat-ref_table =  'CALENDAR_TYPE'.
*    APPEND ls_fieldcat TO it_fcat.
*    CLEAR ls_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'T_CELLEDIT'.
ls_fieldcat-ref_field = 'CELSTAT'.
ls_fieldcat-ref_table =  'BCSS_IBOT'.
APPEND ls_fieldcat TO it_fcat.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fcat
IMPORTING
ep_table        = it_content.
IF sy-subrc = 0.
ASSIGN it_content->* TO <itab>.
ELSE.
WRITE: 'Error creating internal table'.
STOP.
ENDIF.
after i make my treatment to put if i make something with the color or edit the cell
i create my container with a new ls_fieldcat without the table 'T_CELLEDIT' or other table LVS

Similar Messages

  • SRM-MDM Dynamic catalog call structure and implicit search criteria

    Hi experts,
    We need to define the catalog call criteria for the SRM-MDM.
    Our client requires content visualitzation restrictions but there is not any logic indentified to determine the records that must be viewed for every user.
    Now, in their Non-SAP catalog, they are using users lists to which they assign the catalog records.
    There are more than 150 users lists and is posible too to assign some catalog records to only 1 or 2 users, by user id.
    We want to reproduce this scenario in SRM-MDM.
    We are analysing two alternatives:
    First alternative: badi BBP_CAT_CALL_ENRICH implementation for mask dynamic determination and custom z.
    We've though in creating one mask for every user list.
    Then, in SRM create a custom table with the userid and the user list id (mask equivalent). A user can belong to more than one user list.
    Finally implement the BBP_CAT_CALL_ENRICH, searching in the z table the users id and obtaining the specific masks for this users and pass these masks as catalog call parameters dynamicly.
    Is posible to use the BBP_CAT_CALL_ENRICH badi to pass dynamic parameters?
    (in this case, maybe we could use a new org.est. attibute to assign user id and mask, instead of the custom table).
    Second aternative: implicit search criteria based on a new org. est. atribute for mask
    Is posible to create new implicit search criteria for org. est. atributes?
    We could assign to every user the masks in the org. est. and then, create a new parameter which could look for the mask value in the org.est.
    Thanks in advance

    Hi Silvia,
    I am not sure of the answer to the second part of the query but as for the usage of the BBP_CAT_CALL_ENRICH catalog in combination with various masks for the users to access catalog subsets, this should work quite well, best to try it out in a DEV environment and see how it goes.
    Regards,
    Jason

  • How to get checkboxes in dynamic ALV list generation

    hi ,
    below is the code in which two lists we wll be displayed in one layout dynamically(i.e after entering the table name two lists wll be displayed in one layout) from two different clients(i.e. source and target).
    TYPE-POOLS *
    TYPE-POOLS: slis.
    *-- Tables Declaration
    TABLES:  dd02l, t000.
    *-- Constants Declaration
    CONSTANTS: lc_z   TYPE char1  VALUE 'Z',
               lc_y   TYPE char1  VALUE 'Y'.
    DATA: ok_code TYPE sy-ucomm.
    *--Internal table and Work Area Declaration
    DATA: lines LIKE sy-dbcnt VALUE 0.
    DATA: icursor TYPE cursor.
    *DATA: icursor1 TYPE cursor.
    DATA: lv_count TYPE i.
    DATA: lv_table_var1  TYPE char1.
    DATA: lv_ans TYPE char1.
    DATA : gd_tabname  TYPE tabname.
    *for check boxes
    DATA:l_pos TYPE i VALUE 1.
    *field catalog for source client
    DATA: c_cont1 TYPE REF TO cl_gui_custom_container,
    c_alv1 TYPE REF TO cl_gui_alv_grid,
    it_fieldcat1 TYPE lvc_t_fcat ,
    ty_fieldcat1 TYPE lvc_s_fcat ,
    struc_desc1   TYPE REF TO cl_abap_structdescr,
    ls_fieldcatalogue1 TYPE slis_fieldcat_alv,
    lt_fieldcatalogue1 TYPE slis_t_fieldcat_alv,
    l_structure1   TYPE REF TO data,
    l_table1    TYPE REF TO data.
    for check boxes for source client
    DATA: ls_edit TYPE lvc_s_styl,
    lt_edit TYPE lvc_t_styl.
    *field catalog for target client
    DATA: c_cont2 TYPE REF TO cl_gui_custom_container,
    c_alv2 TYPE REF TO cl_gui_alv_grid,
    it_fieldcat2 TYPE lvc_t_fcat ,
    ty_fieldcat2 TYPE lvc_s_fcat ,
    struc_desc2   TYPE REF TO cl_abap_structdescr,
    ls_fieldcatalogue2 TYPE slis_fieldcat_alv,
    lt_fieldcatalogue2 TYPE slis_t_fieldcat_alv,
    l_structure2   TYPE REF TO data,
    l_table2    TYPE REF TO data.
    *for source client
    TYPES: BEGIN OF itab,
            t_name TYPE tabname,
            t_ref TYPE REF TO data,
    *for checkboxes.
            check(1),
    style TYPE lvc_t_styl,
    END OF itab.
    *for target client
    TYPES: BEGIN OF itab1,
             t_name1 TYPE tabname,
             t_ref1 TYPE REF TO data,
    END OF itab1.
    *-- Field Symbol declaration for Dynamic Internal Table for source client
    FIELD-SYMBOLS: <tab> TYPE table.
    FIELD-SYMBOLS: <tab1> TYPE ANY.
    FIELD-SYMBOLS: <l_mandt>.
    FIELD-SYMBOLS: <str_comp1> TYPE abap_compdescr,
                   <dyn_str1> TYPE ANY.
    *--Field Symbol declaration for Dynamic Internal Table for target client
    FIELD-SYMBOLS <tab2> TYPE table.
    FIELD-SYMBOLS <tab3> TYPE ANY.
    FIELD-SYMBOLS: <l_mandt1>.
    FIELD-SYMBOLS: <str_comp2> TYPE abap_compdescr,
                   <dyn_str2> TYPE ANY.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    PARAMETERS: p_table    LIKE dd02l-tabname,
                p_mdt_fm LIKE t000-mandt DEFAULT sy-mandt,
                p_mdt_to LIKE t000-mandt DEFAULT '910'.
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN ON p_table.
      lv_table_var1  = p_table+0(1).
    *-- Validation for Standard tables
      IF ( lv_table_var1 NE lc_z ) AND ( lv_table_var1 NE lc_y ).
        MESSAGE e001(00)  WITH text-002.
      ENDIF.
    *-- Start of Selection
    START-OF-SELECTION.
    --for source client--
      DATA itab2 TYPE itab.
      DATA t_ref1 TYPE REF TO data.
      itab2-t_name = p_table.
    --for target client--
      DATA itab3 TYPE itab1.
      DATA t_ref2 TYPE REF TO data.
      itab3-t_name1 = p_table.
    *-- Create Dynamic Internal table for source client
      CREATE DATA itab2-t_ref TYPE TABLE OF (itab2-t_name) .
      ASSIGN itab2-t_ref->* TO <tab>.
      CREATE DATA t_ref1 LIKE LINE OF <tab>.
      ASSIGN t_ref1->* TO <tab1>.
    *-- Create Dynamic Internal table for target client
      CREATE DATA itab3-t_ref1 TYPE TABLE OF (itab3-t_name1) .
      ASSIGN itab3-t_ref1->* TO <tab2>.
      CREATE DATA t_ref2 LIKE LINE OF <tab2>.
      ASSIGN t_ref2->* TO <tab3>.
    *-- get the number of entries in table
      SELECT COUNT(*) FROM dd03l INTO lv_count
                                WHERE tabname   =  p_table
                                  AND fieldname = 'MANDT'.
    Check MANDT field the the table, if not exists through an error message
      IF lv_count = 0.
        MESSAGE i000(8i) WITH text-001 space space.
        EXIT.
      ELSE.
    *-- Delete the Table Entries in the target system
        DELETE FROM (p_table) CLIENT SPECIFIED
              WHERE mandt = p_mdt_to.
        COMMIT WORK.
    *-- Open cursor
        OPEN CURSOR WITH HOLD icursor FOR
          SELECT * FROM (p_table) CLIENT SPECIFIED
                  WHERE mandt = p_mdt_fm.
        IF sy-subrc <> 0.
          MESSAGE e000(8i) WITH text-001.
        ENDIF.
        DO.
          FETCH NEXT CURSOR icursor INTO TABLE <tab> PACKAGE SIZE 1000.
          IF sy-subrc <> 0.
            CLOSE CURSOR icursor.
            EXIT.
          ENDIF.
    *-- Modify Field 'MANDT' with the Target Client no.
          LOOP AT <tab> ASSIGNING <tab1>.
            ASSIGN COMPONENT: 'MANDT'  OF STRUCTURE <tab1> TO <l_mandt>.
            <l_mandt> = p_mdt_to.
            MODIFY <tab> FROM <tab1>.
            lines = lines + 1.
          ENDLOOP.
    *-- Insert records into target table
          INSERT (p_table) CLIENT SPECIFIED FROM TABLE <tab>.
    *-- Close the cursor
          CALL FUNCTION 'DB_COMMIT'.
        ENDDO.
    ENDIF.
    for target client
    *-- Open cursor
        OPEN CURSOR WITH HOLD icursor FOR
          SELECT * FROM (p_table) CLIENT SPECIFIED
                  WHERE mandt = p_mdt_to.
        IF sy-subrc <> 0.
          MESSAGE e000(8i) WITH text-001.
        ENDIF.
        DO.
          FETCH NEXT CURSOR icursor INTO TABLE <tab2> PACKAGE SIZE 1000.
          IF sy-subrc <> 0.
            CLOSE CURSOR icursor.
            EXIT.
          ENDIF.
    *-- Close the cursor
          CALL FUNCTION 'DB_COMMIT'.
        ENDDO.
      ENDIF.
      CALL SCREEN 3000.
    *&      Module  STATUS_3000  OUTPUT
          text
    MODULE status_3000 OUTPUT.
      SET PF-STATUS 'ZTESTMENU'.
    SET TITLEBAR 'xxx'.
    For Source client
      IF c_alv1 IS INITIAL.
        CREATE OBJECT c_cont1
          EXPORTING
            container_name = 'CONTAINER_SOURCE'.
        IF sy-subrc = 0.
          CREATE OBJECT c_alv1
            EXPORTING
              i_parent = c_cont1.
        ENDIF.
        IF sy-subrc EQ 0.
          PERFORM field_cat1.
        ENDIF.
        CALL METHOD c_alv1->set_table_for_first_display
         EXPORTING
    i_buffer_active               =
    i_bypassing_buffer            =
    i_consistency_check           =
    i_structure_name              =
    is_variant                    =
    i_save                        =
    i_default                     = 'x'
    is_layout                     =
    is_print                      =
    it_special_groups             =
    it_toolbar_excluding          =
    it_hyperlink                  =
    it_alv_graphics               =
    it_except_qinfo               =
    ir_salv_adapter               =
    CHANGING
    it_outtab           = <tab>
    it_fieldcatalog     = it_fieldcat1
    it_sort                       =
    it_filter                     =
    EXCEPTIONS
    valid_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.
    For Target client
      IF c_alv2 IS INITIAL.
        CREATE OBJECT c_cont2
          EXPORTING
            container_name              = 'CONTAINER_TARGET'.
        IF sy-subrc = 0.
          CREATE OBJECT c_alv2
            EXPORTING
              i_parent          = c_cont2.
        ENDIF.
        IF sy-subrc EQ 0.
          PERFORM field_cat2.
        ENDIF.
        CALL METHOD c_alv2->set_table_for_first_display
    EXPORTING
       i_buffer_active               =
       i_bypassing_buffer            =
       i_consistency_check           =
       i_structure_name              =
       is_variant                    =
       i_save                        =
       i_default                     = 'x'
       is_layout                     =
       is_print                      =
       it_special_groups             =
       it_toolbar_excluding          =
       it_hyperlink                  =
       it_alv_graphics               =
       it_except_qinfo               =
       ir_salv_adapter               =
          CHANGING
            it_outtab                     = <tab2>
            it_fieldcatalog               = it_fieldcat2
       it_sort                       =
       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.
    ENDMODULE.                 " STATUS_3000  OUTPUT
    *&      Module  USER_COMMAND_3000  INPUT
          text
    MODULE user_command_3000 INPUT.
      CASE ok_code.
        WHEN 'BACK'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_3000  INPUT
    *&      Form  field_cat1
          text
    -->  p1        text
    <--  p2        text
    FORM field_cat1 .
    Dynamic creation of a structure
      CREATE DATA l_structure1 TYPE (p_table).
      ASSIGN l_structure1->* TO <dyn_str1>.
    Fields Structure
      struc_desc1 ?= cl_abap_typedescr=>describe_by_data( <dyn_str1> ).
      LOOP AT struc_desc1->components ASSIGNING <str_comp1>.
      Build Fieldcatalog
        ty_fieldcat1-fieldname = <str_comp1>-name.
        ty_fieldcat1-ref_table = p_table.
       CLEAR: l_pos.
    *l_pos = l_pos + 1.
    *ty_fieldcat1-seltext = 'CHECK'.
    *ty_fieldcat1-fieldname = 'CHECK'.
    *ty_fieldcat1-tabname = 'ITAB'.
    *ty_fieldcat1-col_pos = l_pos.
    *ty_fieldcat1-checkbox = 'X'.
    *ty_fieldcat1-edit = 'X'.
    *ty_fieldcat1-outputlen = '5'.
    APPEND ty_fieldcat1 TO it_fieldcat1.
      Build Fieldcatalog
        ls_fieldcatalogue1-fieldname = <str_comp1>-name.
        ls_fieldcatalogue1-ref_tabname = p_table.
        APPEND ls_fieldcatalogue1 TO lt_fieldcatalogue1.
      ENDLOOP.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
       i_style_table             =
          it_fieldcatalog           = it_fieldcat1
       i_length_in_byte          =
        IMPORTING
          ep_table                  = l_table1
       e_style_fname             =
    EXCEPTIONS
       generate_subpool_dir_full = 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.
      ASSIGN l_table1->* TO <tab>.
    Read data from the table selected.
      SELECT * FROM (p_table)
         CLIENT SPECIFIED
         INTO CORRESPONDING FIELDS OF TABLE <tab>
                   WHERE mandt = p_mdt_fm.
    ENDFORM.                    " field_cat1
    *&      Form  field_cat2
          text
    -->  p1        text
    <--  p2        text
    FORM field_cat2 .
      CREATE DATA l_structure2 TYPE (p_table).
      ASSIGN l_structure2->* TO <dyn_str2>.
    Fields Structure
      struc_desc2 ?= cl_abap_typedescr=>describe_by_data( <dyn_str2> ).
      LOOP AT struc_desc2->components ASSIGNING <str_comp2>.
      Build Fieldcatalog
        ty_fieldcat2-fieldname = <str_comp2>-name.
        ty_fieldcat2-ref_table = p_table.
        APPEND ty_fieldcat2 TO it_fieldcat2.
      Build Fieldcatalog
        ls_fieldcatalogue2-fieldname = <str_comp2>-name.
        ls_fieldcatalogue2-ref_tabname = p_table.
        APPEND ls_fieldcatalogue2 TO lt_fieldcatalogue2.
      ENDLOOP.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
       i_style_table             =
          it_fieldcatalog           = it_fieldcat2
       i_length_in_byte          =
        IMPORTING
          ep_table                  = l_table2
       e_style_fname             =
    EXCEPTIONS
       generate_subpool_dir_full = 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.
      ASSIGN l_table2->* TO <tab2>.
    Read data from the table selected.
      SELECT * FROM (p_table) CLIENT SPECIFIED
         INTO CORRESPONDING FIELDS OF TABLE <tab2>
                   WHERE mandt =  p_mdt_to.
    ENDFORM.                    " field_cat2
    *FOR THE ABOVE CODE I NEED CHECKBOXES IN THE FIRST LIST AND I HAVE TRIED MANY WAYS BUT I HAVENT GOT THE SOLUTION. SO, PLZ CAN U EXPLAIN BY MENTIONING THE PIECE OF CODE IN ABOVE CODE.
    PLZ DO THE NEED FUL.
    thanks in advance.

    hi ,
    below is the code in which two lists we wll be displayed in one layout dynamically(i.e after entering the table name two lists wll be displayed in one layout) from two different clients(i.e. source and target).
    TYPE-POOLS *
    TYPE-POOLS: slis.
    *-- Tables Declaration
    TABLES:  dd02l, t000.
    *-- Constants Declaration
    CONSTANTS: lc_z   TYPE char1  VALUE 'Z',
               lc_y   TYPE char1  VALUE 'Y'.
    DATA: ok_code TYPE sy-ucomm.
    *--Internal table and Work Area Declaration
    DATA: lines LIKE sy-dbcnt VALUE 0.
    DATA: icursor TYPE cursor.
    *DATA: icursor1 TYPE cursor.
    DATA: lv_count TYPE i.
    DATA: lv_table_var1  TYPE char1.
    DATA: lv_ans TYPE char1.
    DATA : gd_tabname  TYPE tabname.
    *for check boxes
    DATA:l_pos TYPE i VALUE 1.
    *field catalog for source client
    DATA: c_cont1 TYPE REF TO cl_gui_custom_container,
    c_alv1 TYPE REF TO cl_gui_alv_grid,
    it_fieldcat1 TYPE lvc_t_fcat ,
    ty_fieldcat1 TYPE lvc_s_fcat ,
    struc_desc1   TYPE REF TO cl_abap_structdescr,
    ls_fieldcatalogue1 TYPE slis_fieldcat_alv,
    lt_fieldcatalogue1 TYPE slis_t_fieldcat_alv,
    l_structure1   TYPE REF TO data,
    l_table1    TYPE REF TO data.
    for check boxes for source client
    DATA: ls_edit TYPE lvc_s_styl,
    lt_edit TYPE lvc_t_styl.
    *field catalog for target client
    DATA: c_cont2 TYPE REF TO cl_gui_custom_container,
    c_alv2 TYPE REF TO cl_gui_alv_grid,
    it_fieldcat2 TYPE lvc_t_fcat ,
    ty_fieldcat2 TYPE lvc_s_fcat ,
    struc_desc2   TYPE REF TO cl_abap_structdescr,
    ls_fieldcatalogue2 TYPE slis_fieldcat_alv,
    lt_fieldcatalogue2 TYPE slis_t_fieldcat_alv,
    l_structure2   TYPE REF TO data,
    l_table2    TYPE REF TO data.
    *for source client
    TYPES: BEGIN OF itab,
            t_name TYPE tabname,
            t_ref TYPE REF TO data,
    *for checkboxes.
            check(1),
    style TYPE lvc_t_styl,
    END OF itab.
    *for target client
    TYPES: BEGIN OF itab1,
             t_name1 TYPE tabname,
             t_ref1 TYPE REF TO data,
    END OF itab1.
    *-- Field Symbol declaration for Dynamic Internal Table for source client
    FIELD-SYMBOLS: <tab> TYPE table.
    FIELD-SYMBOLS: <tab1> TYPE ANY.
    FIELD-SYMBOLS: <l_mandt>.
    FIELD-SYMBOLS: <str_comp1> TYPE abap_compdescr,
                   <dyn_str1> TYPE ANY.
    *--Field Symbol declaration for Dynamic Internal Table for target client
    FIELD-SYMBOLS <tab2> TYPE table.
    FIELD-SYMBOLS <tab3> TYPE ANY.
    FIELD-SYMBOLS: <l_mandt1>.
    FIELD-SYMBOLS: <str_comp2> TYPE abap_compdescr,
                   <dyn_str2> TYPE ANY.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    PARAMETERS: p_table    LIKE dd02l-tabname,
                p_mdt_fm LIKE t000-mandt DEFAULT sy-mandt,
                p_mdt_to LIKE t000-mandt DEFAULT '910'.
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN ON p_table.
      lv_table_var1  = p_table+0(1).
    *-- Validation for Standard tables
      IF ( lv_table_var1 NE lc_z ) AND ( lv_table_var1 NE lc_y ).
        MESSAGE e001(00)  WITH text-002.
      ENDIF.
    *-- Start of Selection
    START-OF-SELECTION.
    --for source client--
      DATA itab2 TYPE itab.
      DATA t_ref1 TYPE REF TO data.
      itab2-t_name = p_table.
    --for target client--
      DATA itab3 TYPE itab1.
      DATA t_ref2 TYPE REF TO data.
      itab3-t_name1 = p_table.
    *-- Create Dynamic Internal table for source client
      CREATE DATA itab2-t_ref TYPE TABLE OF (itab2-t_name) .
      ASSIGN itab2-t_ref->* TO <tab>.
      CREATE DATA t_ref1 LIKE LINE OF <tab>.
      ASSIGN t_ref1->* TO <tab1>.
    *-- Create Dynamic Internal table for target client
      CREATE DATA itab3-t_ref1 TYPE TABLE OF (itab3-t_name1) .
      ASSIGN itab3-t_ref1->* TO <tab2>.
      CREATE DATA t_ref2 LIKE LINE OF <tab2>.
      ASSIGN t_ref2->* TO <tab3>.
    *-- get the number of entries in table
      SELECT COUNT(*) FROM dd03l INTO lv_count
                                WHERE tabname   =  p_table
                                  AND fieldname = 'MANDT'.
    Check MANDT field the the table, if not exists through an error message
      IF lv_count = 0.
        MESSAGE i000(8i) WITH text-001 space space.
        EXIT.
      ELSE.
    *-- Delete the Table Entries in the target system
        DELETE FROM (p_table) CLIENT SPECIFIED
              WHERE mandt = p_mdt_to.
        COMMIT WORK.
    *-- Open cursor
        OPEN CURSOR WITH HOLD icursor FOR
          SELECT * FROM (p_table) CLIENT SPECIFIED
                  WHERE mandt = p_mdt_fm.
        IF sy-subrc <> 0.
          MESSAGE e000(8i) WITH text-001.
        ENDIF.
        DO.
          FETCH NEXT CURSOR icursor INTO TABLE <tab> PACKAGE SIZE 1000.
          IF sy-subrc <> 0.
            CLOSE CURSOR icursor.
            EXIT.
          ENDIF.
    *-- Modify Field 'MANDT' with the Target Client no.
          LOOP AT <tab> ASSIGNING <tab1>.
            ASSIGN COMPONENT: 'MANDT'  OF STRUCTURE <tab1> TO <l_mandt>.
            <l_mandt> = p_mdt_to.
            MODIFY <tab> FROM <tab1>.
            lines = lines + 1.
          ENDLOOP.
    *-- Insert records into target table
          INSERT (p_table) CLIENT SPECIFIED FROM TABLE <tab>.
    *-- Close the cursor
          CALL FUNCTION 'DB_COMMIT'.
        ENDDO.
    ENDIF.
    for target client
    *-- Open cursor
        OPEN CURSOR WITH HOLD icursor FOR
          SELECT * FROM (p_table) CLIENT SPECIFIED
                  WHERE mandt = p_mdt_to.
        IF sy-subrc <> 0.
          MESSAGE e000(8i) WITH text-001.
        ENDIF.
        DO.
          FETCH NEXT CURSOR icursor INTO TABLE <tab2> PACKAGE SIZE 1000.
          IF sy-subrc <> 0.
            CLOSE CURSOR icursor.
            EXIT.
          ENDIF.
    *-- Close the cursor
          CALL FUNCTION 'DB_COMMIT'.
        ENDDO.
      ENDIF.
      CALL SCREEN 3000.
    *&      Module  STATUS_3000  OUTPUT
          text
    MODULE status_3000 OUTPUT.
      SET PF-STATUS 'ZTESTMENU'.
    SET TITLEBAR 'xxx'.
    For Source client
      IF c_alv1 IS INITIAL.
        CREATE OBJECT c_cont1
          EXPORTING
            container_name = 'CONTAINER_SOURCE'.
        IF sy-subrc = 0.
          CREATE OBJECT c_alv1
            EXPORTING
              i_parent = c_cont1.
        ENDIF.
        IF sy-subrc EQ 0.
          PERFORM field_cat1.
        ENDIF.
        CALL METHOD c_alv1->set_table_for_first_display
         EXPORTING
    i_buffer_active               =
    i_bypassing_buffer            =
    i_consistency_check           =
    i_structure_name              =
    is_variant                    =
    i_save                        =
    i_default                     = 'x'
    is_layout                     =
    is_print                      =
    it_special_groups             =
    it_toolbar_excluding          =
    it_hyperlink                  =
    it_alv_graphics               =
    it_except_qinfo               =
    ir_salv_adapter               =
    CHANGING
    it_outtab           = <tab>
    it_fieldcatalog     = it_fieldcat1
    it_sort                       =
    it_filter                     =
    EXCEPTIONS
    valid_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.
    For Target client
      IF c_alv2 IS INITIAL.
        CREATE OBJECT c_cont2
          EXPORTING
            container_name              = 'CONTAINER_TARGET'.
        IF sy-subrc = 0.
          CREATE OBJECT c_alv2
            EXPORTING
              i_parent          = c_cont2.
        ENDIF.
        IF sy-subrc EQ 0.
          PERFORM field_cat2.
        ENDIF.
        CALL METHOD c_alv2->set_table_for_first_display
    EXPORTING
       i_buffer_active               =
       i_bypassing_buffer            =
       i_consistency_check           =
       i_structure_name              =
       is_variant                    =
       i_save                        =
       i_default                     = 'x'
       is_layout                     =
       is_print                      =
       it_special_groups             =
       it_toolbar_excluding          =
       it_hyperlink                  =
       it_alv_graphics               =
       it_except_qinfo               =
       ir_salv_adapter               =
          CHANGING
            it_outtab                     = <tab2>
            it_fieldcatalog               = it_fieldcat2
       it_sort                       =
       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.
    ENDMODULE.                 " STATUS_3000  OUTPUT
    *&      Module  USER_COMMAND_3000  INPUT
          text
    MODULE user_command_3000 INPUT.
      CASE ok_code.
        WHEN 'BACK'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_3000  INPUT
    *&      Form  field_cat1
          text
    -->  p1        text
    <--  p2        text
    FORM field_cat1 .
    Dynamic creation of a structure
      CREATE DATA l_structure1 TYPE (p_table).
      ASSIGN l_structure1->* TO <dyn_str1>.
    Fields Structure
      struc_desc1 ?= cl_abap_typedescr=>describe_by_data( <dyn_str1> ).
      LOOP AT struc_desc1->components ASSIGNING <str_comp1>.
      Build Fieldcatalog
        ty_fieldcat1-fieldname = <str_comp1>-name.
        ty_fieldcat1-ref_table = p_table.
       CLEAR: l_pos.
    *l_pos = l_pos + 1.
    *ty_fieldcat1-seltext = 'CHECK'.
    *ty_fieldcat1-fieldname = 'CHECK'.
    *ty_fieldcat1-tabname = 'ITAB'.
    *ty_fieldcat1-col_pos = l_pos.
    *ty_fieldcat1-checkbox = 'X'.
    *ty_fieldcat1-edit = 'X'.
    *ty_fieldcat1-outputlen = '5'.
    APPEND ty_fieldcat1 TO it_fieldcat1.
      Build Fieldcatalog
        ls_fieldcatalogue1-fieldname = <str_comp1>-name.
        ls_fieldcatalogue1-ref_tabname = p_table.
        APPEND ls_fieldcatalogue1 TO lt_fieldcatalogue1.
      ENDLOOP.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
       i_style_table             =
          it_fieldcatalog           = it_fieldcat1
       i_length_in_byte          =
        IMPORTING
          ep_table                  = l_table1
       e_style_fname             =
    EXCEPTIONS
       generate_subpool_dir_full = 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.
      ASSIGN l_table1->* TO <tab>.
    Read data from the table selected.
      SELECT * FROM (p_table)
         CLIENT SPECIFIED
         INTO CORRESPONDING FIELDS OF TABLE <tab>
                   WHERE mandt = p_mdt_fm.
    ENDFORM.                    " field_cat1
    *&      Form  field_cat2
          text
    -->  p1        text
    <--  p2        text
    FORM field_cat2 .
      CREATE DATA l_structure2 TYPE (p_table).
      ASSIGN l_structure2->* TO <dyn_str2>.
    Fields Structure
      struc_desc2 ?= cl_abap_typedescr=>describe_by_data( <dyn_str2> ).
      LOOP AT struc_desc2->components ASSIGNING <str_comp2>.
      Build Fieldcatalog
        ty_fieldcat2-fieldname = <str_comp2>-name.
        ty_fieldcat2-ref_table = p_table.
        APPEND ty_fieldcat2 TO it_fieldcat2.
      Build Fieldcatalog
        ls_fieldcatalogue2-fieldname = <str_comp2>-name.
        ls_fieldcatalogue2-ref_tabname = p_table.
        APPEND ls_fieldcatalogue2 TO lt_fieldcatalogue2.
      ENDLOOP.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
       i_style_table             =
          it_fieldcatalog           = it_fieldcat2
       i_length_in_byte          =
        IMPORTING
          ep_table                  = l_table2
       e_style_fname             =
    EXCEPTIONS
       generate_subpool_dir_full = 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.
      ASSIGN l_table2->* TO <tab2>.
    Read data from the table selected.
      SELECT * FROM (p_table) CLIENT SPECIFIED
         INTO CORRESPONDING FIELDS OF TABLE <tab2>
                   WHERE mandt =  p_mdt_to.
    ENDFORM.                    " field_cat2
    *FOR THE ABOVE CODE I NEED CHECKBOXES IN THE FIRST LIST AND I HAVE TRIED MANY WAYS BUT I HAVENT GOT THE SOLUTION. SO, PLZ CAN U EXPLAIN BY MENTIONING THE PIECE OF CODE IN ABOVE CODE.
    PLZ DO THE NEED FUL.
    thanks in advance.

  • Strategy for product display in multi -multi categories??

    Hi guys,
    My client wants many many variations of product catalogs... too many to do effectively by creating catalogs for each one. I'm trying to figure out the best way of doing this and I realize there is a potential problem with keywords and tags.  As I understand it, I have keywords and have created "tags" in Custom (column) 1 .    I realize you can create a featured list by calling a tag, but here's the problem...   All Cartier  watches are tagged with watch, but not all watches are Cartier.   To give you the idea of the complexity of this layout, here's a sample of some of the current catalogs I'm moving over to BC:
    Watches (36)
    All (36)
    Breguet Ladies (1)
    Breitling (1)
    Cartier Ladies (5)
    Cartier Mens(5)
    Omega (1)
    Panerai (1)
    Patek Phillipe(1)
    Rolex Watches Ladies (5)
    Rolex Watches Modern (11)
    Rolex Watches Vintage (5)
    Cartier Jewelry (4)
    All (4)
    Bracelets (1)
    Earrings (1)
    Rings (2)
    Watches (10)
    Now multiply this by several brands, like Tiffany and the like, and you get many many crossovers.
    So I have a couple of questions:   what is the safest way to enter tags and keywords for a featured list, e.g.: with or without commas???
    Rather than create a separate catalog for each of these many options,  is there a way to create a display catalog from keywords or tags?  I started creating a featured list, but IF I use Rings, for example, it calls up all rings and not just rings that are Cartier rings or Tiffany rings.
    In addition, he has an entirely separate catalog that is of archived items for custom jewelry already sold as examples and not for sale, and they too have rings, bracelets, etc...
    If I could call up featured items in ONLY a single catalog  and exclude all rings from other catalogs, it might work... But I'm kind of stumped as how to best do this..
    TIA,
    Jeff
    PS... this was so much easier in php creating dynamic catalogs I could control...

    Have you got all the RH7 patches installed? There was a problem fixed in 7.0.1 that sounds similar to what you are experiencing. If you haven't patched your version yet, I'd recommend getting all of the patches.
    See snippet 14 on Peter Grainge's site for the blank topic issue, and snippets 23, 31 and 34 for what's in the patches.
    http://www.grainge.org/pages/authoring/rh7/using_rh7.htm
    Also note issue #20 in the 7.0.1 patch notes - if you are affected by this, I believe you'll have to fix it manually, unless you can afford to go back to a pre-upgraded version of your project and upgrade once you've installed all the patches. If you can't go back, which is likely if you've all been working on the project, I think it should just be a case of find and replace across your HTML files - you should be able to do a search on the forums for it, or maybe Peter or Rick will chime in with additional information if it is a problem for you.
    HTH,
    Amber

  • Declaring a field lenght dinamically.

    Hi people, I'm from Brazil... and I have a simple problem.
    How can I declare a field lenght dinamically.
    For example:
    In the code below I have the field "Company". This field have 10 characteres of lengh, but in determinated part of the code this value can or not to increase to send it to a TXT file. If will need to increase this value, how can I do this dinamically ?
    The code is:
    Data: begin of Itab_test occurs 0,
                Company(10)   type C.
    Data: End of Itab_test.
    Excuse me for my english...
    tks,

    Define Dynamic Internal table whose fields can be determined dynamically.
    FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
                   <dyn_wa>,
                   <dyn_field>.
    create dynamic internal table and assign to fs
    IFC is your dynamic catalog for fields.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = ifc
        IMPORTING
          ep_table        = dy_table.
      ASSIGN dy_table->* TO <dyn_table>.
    create dynamic work area and assign to fs
      CREATE DATA dy_line LIKE LINE OF <dyn_table>.
      ASSIGN dy_line->* TO <dyn_wa>.
    Hope this helps...
    <REMOVED BY MODERATOR - REQUEST OR OFFER POINTS ARE FORBIDDEN>
    Kartavya
    Edited by: Alvaro Tejada Galindo on Aug 21, 2008 3:22 PM

  • How to update csv file dynamically  from Catalog manager

    HI - In OBIEE we used to generate report statistics into csv files from Catalog manager.But this task should be automatic or dynamic process.So it means that each and every when catalog get changes that information will be captured into CSV file by dynamic way. To achieve this process we should have one script or batch etc.............
    Your help is highly appreciated.

    Yes we can achieve this by enabling Usage Tracking.
    Create a report with all the columns you need and schedule the report using Agents with some time frame say like EOD everyday.There we can see what all the changes as done to the catalog.
    Do let me know if you need any help to achieve this.
    Mark if helps,
    Thanks,

  • Reg: Dynamic Field catalog in ALV

    Hi ,
    Can any one guide me to build a dynamic field catalog in ALV report?
    Below is the format which i expect..........
    Material    |     Plant1    |    Plant2    |    Plant3    | ....................|    Plant 20      |
    Qty
    Val
    Qty
    Val
    Qty
    Val
    Qty
    Val
    The plant 1 to 20 has to be brought dynamically as headings from T001W table. (Horizontally populate)
    Below each plant i need sub-headings "QTY" and "VAL".                                  (Horizontally populate)
    List of Materials should be brought vertically from MARA table.                          (Vertically populate)
    Can anyone suggest how to bring out this format for populating data accordingly into the o/p format?
    Ur help will be appreciated.
    Thanks,
    K.S.Kannan

    your part of the code is present in routine
    perform dynamic_table.
    *& Report ZCS_NAC_MAT_CHARACTERISTICS
    2/ Description ...: Business requirement is to get all materials
    without any characteristic values maintained in SAP
    which are given in the selection screen.
    REPORT znac_material_char.
    TYPE-POOLS : abap,
    slis.
    TABLES : kssk,
    klah,
    mara,
    makt,
    cabn,
    t134,
    t023.
    DATA : i_fieldcat TYPE slis_t_fieldcat_alv ,
    wa_fieldcat TYPE slis_fieldcat_alv.
    DATA : w_layout TYPE slis_layout_alv.
    DATA : st_layout TYPE slis_layout_alv.
    DATA : t_header TYPE slis_t_listheader,
    w_header TYPE slis_listheader.
    TYPES : BEGIN OF ty_cabn,
    atinn TYPE cabn-atinn,
    atnam TYPE cabn-atnam,
    END OF ty_cabn.
    DATA : i_cabn TYPE STANDARD TABLE OF ty_cabn WITH HEADER LINE.
    DATA : w_cabn LIKE i_cabn.
    TYPES : BEGIN OF ty_ausp,
    objek TYPE ausp-objek,
    atinn TYPE ausp-atinn,
    klart TYPE ausp-klart,
    END OF ty_ausp.
    DATA : i_ausp TYPE STANDARD TABLE OF ty_ausp WITH HEADER LINE.
    DATA : w_ausp LIKE i_ausp.
    TYPES : BEGIN OF ty_mara,
    matnr TYPE mara-matnr,
    mtart TYPE mara-mtart,
    matkl TYPE mara-matkl,
    prdha TYPE mara-prdha,
    mstae TYPE mara-mstae,
    mstde TYPE mara-mstde,
    END OF ty_mara.
    DATA : i_mara TYPE STANDARD TABLE OF ty_mara WITH HEADER LINE.
    DATA : w_mara LIKE i_mara.
    DATA : i_mara_temp TYPE STANDARD TABLE OF ty_mara WITH HEADER LINE.
    DATA : w_mara_temp LIKE i_mara_temp.
    TYPES :BEGIN OF ty_data,
    atnam TYPE cabn-atnam,
    atinn TYPE cabn-atinn,
    objek TYPE ausp-objek,
    klart TYPE ausp-klart,
    matnr TYPE mara-matnr,
    maktx TYPE makt-maktx,
    mtart TYPE mara-mtart,
    matkl TYPE mara-matkl,
    prdha TYPE mara-prdha,
    mstae TYPE mara-mstae,
    mstde TYPE mara-mstde,
    END OF ty_data.
    DATA : i_data TYPE STANDARD TABLE OF ty_data WITH HEADER LINE.
    DATA : w_data LIKE i_data.
    DATA : i_class TYPE STANDARD TABLE OF sclass WITH HEADER LINE.
    DATA : w_class LIKE i_class.
    DATA : i_class_temp TYPE STANDARD TABLE OF sclass WITH HEADER LINE.
    DATA : w_class_temp LIKE i_class_temp.
    DATA : i_objdata TYPE STANDARD TABLE OF clobjdat WITH HEADER LINE.
    DATA : w_objdata LIKE i_objdata.
    TYPES : BEGIN OF ty_objdata_temp.
    TYPES: matnr TYPE mara-matnr.
    TYPES: maktx TYPE makt-maktx.
    INCLUDE STRUCTURE clobjdat.
    TYPES : prdha TYPE mara-prdha.
    TYPES : mstde TYPE mara-mstde.
    TYPES : END OF ty_objdata_temp.
    DATA : i_objdata_temp TYPE STANDARD TABLE OF ty_objdata_temp WITH HEADER LINE.
    DATA : w_objdata_temp LIKE i_objdata_temp.
    FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE,
    <fs_dyntable>,
    <fs_fldval> TYPE ANY.
    DATA: t_newtable TYPE REF TO data,
    t_newline TYPE REF TO data,
    fs_fldcat TYPE slis_t_fieldcat_alv,
    t_fldcat1 TYPE lvc_t_fcat,
    wa_it_fldcat TYPE lvc_s_fcat,
    wa_colno(2) TYPE n,
    wa_flname(30) TYPE c.
    DATA: fieldname(20) TYPE c.
    DATA: fieldvalue(40) TYPE c.
    DATA: index(3) TYPE c,
    v_time(60) TYPE c.
    DATA: wa_cat LIKE LINE OF fs_fldcat.
    CONSTANTS : c_nac TYPE klah-class VALUE 'NAC',
    c_klart TYPE ausp-klart VALUE '001',
    c_check TYPE c VALUE 'X' .
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT (28) text-001 .
    SELECT-OPTIONS: s_atnam FOR cabn-atnam NO INTERVALS OBLIGATORY. " Characteristic name
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK b1 .
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    SELECT-OPTIONS: s_matnr FOR mara-matnr. " material Number
    SELECT-OPTIONS: s_mtart FOR mara-mtart. " material type
    SELECT-OPTIONS: s_matkl FOR mara-matkl. " material type
    SELECT-OPTIONS: s_mstae FOR mara-mstae. " X-Plant material status
    PARAMETERS : s_date LIKE sy-datum OBLIGATORY DEFAULT sy-datum . " date
    SELECTION-SCREEN END OF BLOCK b2 .
    AT SELECTION-SCREEN ON s_atnam.
    SELECT SINGLE * FROM cabn WHERE atnam IN s_atnam.
    IF sy-subrc 0.
    MESSAGE text-003 TYPE 'E'.
    ENDIF.
    AT SELECTION-SCREEN ON s_matnr.
    SELECT SINGLE * FROM mara WHERE matnr IN s_matnr.
    IF sy-subrc 0.
    MESSAGE text-004 TYPE 'E'.
    ENDIF.
    AT SELECTION-SCREEN ON s_mtart.
    SELECT SINGLE * FROM t134 WHERE mtart IN s_mtart.
    IF sy-subrc 0.
    MESSAGE text-005 TYPE 'E'.
    ENDIF.
    AT SELECTION-SCREEN ON s_matkl.
    SELECT SINGLE * FROM t023 WHERE matkl IN s_matkl.
    IF sy-subrc 0.
    MESSAGE text-006 TYPE 'E'.
    ENDIF.
    START-OF-SELECTION.
    PERFORM get_data.
    PERFORM get_data_keydate.
    PERFORM material_all_charname.
    PERFORM get_classification.
    PERFORM dynamic_table.
    *& Form dynamic_table
    text
    --> p1 text
    <-- p2 text
    FORM dynamic_table.
    PERFORM fieldcatalog.
    PERFORM dynamic_table_create.
    PERFORM final_data.
    PERFORM final_fieldcatalog.
    PERFORM layout_build.
    PERFORM grid_display.
    ENDFORM. " fieldcat
    *& Form layout_build
    text
    FORM layout_build .
    st_layout-zebra = c_check.
    st_layout-no_vline = ''.
    st_layout-colwidth_optimize = c_check.
    st_layout-detail_popup = c_check.
    st_layout-detail_initial_lines = c_check.
    st_layout-detail_titlebar = text-021.
    ENDFORM. " layout_build
    *& Form alv_top_of_page
    text
    FORM alv_top_of_page.
    REFRESH t_header.
    CLEAR t_header.
    w_header-typ = 'H'. "H=Header, S=Selection, A=Action
    w_header-key = ' '.
    w_header-info = text-019.
    APPEND w_header TO t_header.
    CONCATENATE sy-datum4(2) '-' sy-datum6(2) '-' sy-datum0(4) ' / ' sy-uzeit0(2) ':' sy-uzeit2(2) ':' sy-uzeit4(2) INTO v_time.
    w_header-typ = 'S'. "H=Header, S=Selection, A=Action
    w_header-key = text-020.
    w_header-info = v_time.
    APPEND w_header TO t_header.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = t_header.
    ENDFORM. "alv_top_of_page
    *& Form grid_display
    text
    --> p1 text
    <-- p2 text
    FORM grid_display .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    i_callback_top_of_page = 'ALV_TOP_OF_PAGE'
    it_fieldcat = fs_fldcat
    is_layout = st_layout
    i_default = c_check
    i_save = 'A'
    it_events = v_events[]
    TABLES
    t_outtab = <t_dyntable>.
    ENDFORM. " grid_display
    *& Form FINAL_FIELDCATALOG
    text
    --> p1 text
    <-- p2 text
    FORM final_fieldcatalog .
    wa_cat-fieldname = text-009.
    wa_cat-seltext_m = text-015.
    wa_cat-outputlen = 18.
    APPEND wa_cat TO fs_fldcat.
    wa_cat-fieldname = text-011.
    wa_cat-seltext_m = text-016.
    wa_cat-outputlen = 40.
    APPEND wa_cat TO fs_fldcat.
    LOOP AT s_atnam.
    CLEAR wa_cat.
    wa_cat-fieldname = s_atnam-low.
    wa_cat-seltext_m = s_atnam-low.
    wa_cat-outputlen = '15'.
    APPEND wa_cat TO fs_fldcat.
    ENDLOOP.
    wa_cat-fieldname = text-012.
    wa_cat-seltext_m = text-017.
    wa_cat-outputlen = 18.
    APPEND wa_cat TO fs_fldcat.
    wa_cat-fieldname = text-013.
    wa_cat-seltext_m = text-018.
    wa_cat-outputlen = 8.
    APPEND wa_cat TO fs_fldcat.
    ENDFORM. " FINAL_FIELDCATALOG
    *& Form FIELDCATALOG
    text
    --> p1 text
    <-- p2 text
    FORM fieldcatalog .
    wa_it_fldcat-fieldname = text-009.
    wa_it_fldcat-datatype = text-010.
    wa_it_fldcat-intlen = 18.
    APPEND wa_it_fldcat TO t_fldcat1.
    wa_it_fldcat-fieldname = text-011.
    wa_it_fldcat-datatype = text-010.
    wa_it_fldcat-intlen = 40.
    APPEND wa_it_fldcat TO t_fldcat1.
    LOOP AT s_atnam.
    CLEAR wa_it_fldcat.
    wa_it_fldcat-fieldname = s_atnam-low.
    wa_it_fldcat-datatype = text-010.
    wa_it_fldcat-intlen = 30.
    APPEND wa_it_fldcat TO t_fldcat1.
    ENDLOOP.
    wa_it_fldcat-fieldname = text-012.
    wa_it_fldcat-datatype = text-010.
    wa_it_fldcat-intlen = 18.
    APPEND wa_it_fldcat TO t_fldcat1.
    wa_it_fldcat-fieldname = text-013.
    wa_it_fldcat-datatype = text-014.
    wa_it_fldcat-intlen = 8.
    APPEND wa_it_fldcat TO t_fldcat1.
    ENDFORM. " FIELDCATALOG
    *& Form DYNAMIC_TABLE_CREATE
    text
    --> p1 text
    <-- p2 text
    FORM dynamic_table_create .
    Create dynamic internal table and assign to FS
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = t_fldcat1
    IMPORTING
    ep_table = t_newtable.
    ASSIGN t_newtable->* TO <t_dyntable>.
    Create dynamic work area and assign to FS
    CREATE DATA t_newline LIKE LINE OF <t_dyntable>.
    ASSIGN t_newline->* TO <fs_dyntable>.
    ENDFORM. " DYNAMIC_TABLE_CREATE
    *& Form FINAL_DATA
    text
    --> p1 text
    <-- p2 text
    FORM final_data .
    LOOP AT i_objdata_temp INTO w_objdata_temp.
    *assign w_objdata_temp-matnr to <fs_dyntable>.
    AT NEW matnr.
    wa_flname = text-009.
    fieldvalue = w_objdata_temp-matnr.
    CONDENSE fieldvalue NO-GAPS.
    ASSIGN COMPONENT wa_flname
    OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
    <fs_fldval> = fieldvalue.
    ENDAT.
    wa_flname = text-011.
    fieldvalue = w_objdata_temp-maktx.
    CONDENSE fieldvalue NO-GAPS.
    ASSIGN COMPONENT wa_flname
    OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
    <fs_fldval> = fieldvalue.
    wa_flname = w_objdata_temp-atnam.
    fieldvalue = w_objdata_temp-ausp1.
    CONDENSE fieldvalue NO-GAPS.
    ASSIGN COMPONENT wa_flname
    OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
    <fs_fldval> = fieldvalue.
    wa_flname = text-012.
    fieldvalue = w_objdata_temp-prdha.
    CONDENSE fieldvalue NO-GAPS.
    ASSIGN COMPONENT wa_flname
    OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
    <fs_fldval> = fieldvalue.
    wa_flname = text-013.
    fieldvalue = w_objdata_temp-mstde.
    CONDENSE fieldvalue NO-GAPS.
    ASSIGN COMPONENT wa_flname
    OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
    <fs_fldval> = fieldvalue.
    AT END OF matnr.
    APPEND <fs_dyntable> TO <t_dyntable>.
    ENDAT.
    ENDLOOP.
    ENDFORM. " FINAL_DATA
    *& Form GET_CLASSIFICATION
    text
    --> p1 text
    <-- p2 text
    FORM get_classification .
    LOOP AT i_data INTO w_data.
    SELECT SINGLE * FROM klah WHERE class = c_nac.
    IF sy-subrc = 0.
    IF w_data-mstde >= klah-vondt.
    CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
    EXPORTING
    class = c_nac
    classtext = c_check
    classtype = c_klart
    clint = 0
    features = c_check
    language = sy-langu
    object = w_data-objek
    TABLES
    t_class = i_class
    t_objectdata = i_objdata
    EXCEPTIONS
    no_classification = 1
    no_classtypes = 2
    invalid_class_type = 3
    OTHERS = 4.
    LOOP AT i_class INTO w_class.
    MOVE w_class TO w_class_temp.
    APPEND w_class_temp TO i_class_temp.
    ENDLOOP .
    LOOP AT s_atnam.
    READ TABLE i_objdata INTO w_objdata WITH KEY atnam = s_atnam-low.
    IF sy-subrc = 0.
    MOVE w_data-matnr TO w_objdata_temp-matnr.
    MOVE w_data-maktx TO w_objdata_temp-maktx.
    MOVE-CORRESPONDING w_objdata TO w_objdata_temp.
    MOVE w_data-prdha TO w_objdata_temp-prdha.
    MOVE w_data-mstde TO w_objdata_temp-mstde.
    APPEND w_objdata_temp TO i_objdata_temp.
    ENDIF.
    ENDLOOP.
    ENDIF.
    ENDIF.
    ENDLOOP.
    ENDFORM. " GET_CLASSIFICATION

  • Problem in filling field catalog as table is dynamic

    Hi All,
        I have to populate the data using the below function module and i am passing dynamic internal table <f_list> in place of list.
       i have to populate the field catalog fc_hier which is getting field by standard program but i have to add additional fields which are coming from dynamic internal table .
    fc_hier-fieldname   = l_fld_name.
      fc_hier-tabname     = <f_list>.
      fc_hier-seltext_s  = wa_char-name_char.
    append fc_hier  .                                                    >>>> but it is not allowing  this fc_hier-tabname     = <f_list> statement..*
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
          i_interface_check        = g_interface_check          "n777869
          i_callback_program       = alv_repid
          i_callback_pf_status_set = 'SET_STATUS'
          i_callback_user_command  = 'USER_COMMAND'
          is_layout                = alv_layout
          is_print                 = alv_pri
          it_fieldcat              = fc_hier[]
          i_default                = 'X'
          i_save                   = 'A'
          is_variant               = alv_variant
          it_events                = gt_events[]                "n777869
          i_tabname_header         = 'HEADER'
          i_tabname_item           = 'LIST'
          is_keyinfo               = alv_keyinfo
        TABLES
          t_outtab_header          = header[]
          t_outtab_item            = <f_list>
         t_outtab_item            = list[]
        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.
    How can i assign  table name to fc_hier-tabname    as it is not taking <f_list> as input.
    Thanks in advance......
    Ankur

    >
    ankur garg wrote:
    >  fc_hier-fieldname   = l_fld_name.
    >   fc_hier-tabname     = <f_list>.
    >   fc_hier-seltext_s  = wa_char-name_char.
    > append fc_hier  .                                                    >>>> but it is not allowing  this fc_hier-tabname     = <f_list> statement..*
    >
    > How can i assign  table name to fc_hier-tabname    as it is not taking <f_list> as input.
    TABNAME is the name of the table & not the body of the table (TYPE slis_tabname CHAR30). You have to pass the name of the table & not the table contents !!
    Something like this :
    fc_hier-fieldname = l_fld_name.
    fc_hier-tabname = '<F_LIST>'.
    fc_hier-seltext_s = wa_char-name_char.
    append fc_hier.
    Anyways personally if i have dynamic tables to be used in ALV i prefer SALV which doesn't need a fieldcat
    BR,
    Suhas

  • Dynamic internal table and dynamic field catalog

    hi
    i need to decide the number of fields of the internal table at runtime
    and then need to pass value to this internal table.
    then i need to create the field catalog for this internal table (so here
    field catalog is also dynamic) to display in alv.
    how to achieve this dynamic internal table creation and dyanmic field catalog generation

    Hi Ajay,
      U can use the below code to create a dynamic internal table.
    *adding the field names only once for the dynamic table     .
          MOVE 'PRCTR' TO gw_component-name.
          gw_component-type ?= cl_abap_elemdescr=>get_string( ).
          INSERT gw_component INTO TABLE gt_components.
          MOVE 'RCNTR' TO gw_component-name.
          gw_component-type ?= cl_abap_elemdescr=>get_string( ).
          INSERT gw_component INTO TABLE gt_components.
          MOVE 'RACCT' TO gw_component-name.
          gw_component-type ?= cl_abap_elemdescr=>get_string( ).
          INSERT gw_component INTO TABLE gt_components.
          MOVE 'RYEAR' TO gw_component-name.
          gw_component-type ?= cl_abap_elemdescr=>get_string( ).
          INSERT gw_component INTO TABLE gt_components.
          MOVE 'YTDBAL' TO gw_component-name.
          gw_component-type ?= cl_abap_elemdescr=>get_string( ).
          INSERT gw_component INTO TABLE gt_components.
          MOVE 'OBAL' TO gw_component-name.
          gw_component-type ?= cl_abap_elemdescr=>get_string( ).
          INSERT gw_component INTO TABLE gt_components.
    *get structure descriptor -> GR_STRUCTDESCR
              gr_structdescr ?= cl_abap_structdescr=>create( gt_components ).
    create work area of structure GR_STRUCTDESCR -> GR_WA
              CREATE DATA gr_wa TYPE HANDLE gr_structdescr.
              ASSIGN gr_wa->* TO <gw_wa>.
    determine key components -> GT_KEYS
              MOVE lv_value1 TO gw_key-name.
              INSERT gw_key INTO TABLE gt_keys.
    create descriptor for internal table -> GR_TABLEDESCR
              gr_tabledescr ?= cl_abap_tabledescr=>create( p_line_type  = gr_structdescr
                                                           p_table_kind = cl_abap_tabledescr=>tablekind_hashed
                                                           p_unique     = abap_true
                                                           p_key        = gt_keys
                                                           p_key_kind   = cl_abap_tabledescr=>keydefkind_user ).
    create internal table -> GR_ITAB
              CREATE DATA gr_itab TYPE HANDLE gr_tabledescr.
              ASSIGN gr_itab->* TO <gt_itab>.
              CREATE DATA gr_itab LIKE STANDARD TABLE OF <gw_wa>.
              ASSIGN gr_itab->* TO <gt_sttab>.
    Now u r internal table named <gt_sttab> has been created with fields like RCNTR, PRCTR,RACCT, RYEAR etc whatever the field u need u can go ahead and create dynamically.
    then by using the table <gt_sttab> u can create u r field catalog.
    Regards,
    Rose.

  • ALV display using dynamic field catalog and dynamic internal table

    hi ,
    please guide me for ALV display using dynamic field catalog and dynamic internal table.
    Thank you.

    Hi Rahul,
    maybe thread dynamic program for alv is helpful for you. More information about the [SAP List Viewer (ALV)|http://help.sap.com/saphelp_nw70/helpdata/EN/5e/88d440e14f8431e10000000a1550b0/frameset.htm]. Also have a look into the example programs SALV_DEMO_TABLE*.
    Regards Rudi

  • Build field catalog for dynamic data objects

    Hi
    Could you please tell me how to build a field catalog (ooops alv)  for an internal table which is a dynamic data object.
      TYPES: BEGIN OF t_addsubty,
             subty TYPE subty,
             pernr TYPE persno,
             END OF t_addsubty.
      TYPES: ty_addsubty type t_addsubty occurs 1.
    i have data object using these
            CREATE DATA dref3 TYPE (g_type1).
            ASSIGN dref3->* TO <fs_dp>.
    where g_type1 refers a data type which i defined in the program. g_type1 = ty_addsubty. 
    now <fs_dp> refers to an internal table.
    now i want to build a field catalog for this internal table.
    In my program <fs_dp> structure is not always the same. i.e now it is ty_addsubty but for some other conditions the structure is different.
    please help me out.
    regards
    badri

    Here some piece of code, which shows how it works:
    <SNIP>
    type-pools:
         abap.
    DATA:
      lr_tabledescr          TYPE REF TO cl_abap_tabledescr,
      lr_structdescr     TYPE REF TO cl_abap_structdescr.
    field-symbols:
      <lw_component>     type abap_compdescr_tab.
    TYPES:
         BEGIN OF t_addsubty,
              subty TYPE subty,
              pernr TYPE persno,
         END OF t_addsubty.
    TYPES:
         ty_addsubty type t_addsubty occurs 1.
    CREATE DATA dref3 TYPE (g_type1).
    ASSIGN dref3->* TO <fs_dp>.
    lr_tabledescr ?= cl_abap_tabledescr=>describe_by_data( <fs_dp> ).
    assert condition lr_tabledescr is bound.
    lr_structdescr ?= lr_tabledescr->get_table_line_type( ).
    loop at lr_structdescr->components assigning <lw_component>.
    *     do whatever you want with the information about
    *     the components of the structure
    endloop.
    </SNIP>
    Do not forget to reward points...

  • Building Field-Catalog for dynamic internal tables

    Hi All,
    I  created a dynamic internal table(<fs_final>,<fs_final_line>)  and populated data into it.Now I want to provide field catalog to these dynamic internal table.
    Can anyone suggest me the how to create a field catalog for existing dynamic internal table.Thanks in advance.
    Regards,
    Chakradhar.
    Moderator message - Please use proper subject line in future.
    Message was edited by: Suhas Saha

    Use this code to get all components of internal table.
    Then build fieldcatlog.
    DATA: tab_return type abap_compdescr_tab,
              components like line of tab_return.
    perform get_int_table_fields using    <fs_it> changing  tab_return.
    loop at tab_return into components.
      wa_fldcat-fieldname  = components-name.               "Field Name
      wa_fldcat-scrtext_m  = components-name.              "Column Heading
      wa_fldcat-inttype    = components-type_kind.     "Data Type
      wa_fldcat-intlen      = components-length.          "Data Lenght
      wa_fldcat-decimals = components-decimals.     "Data Decimal Places
    append wa_fldcat to it_fldcat.
    endloop.
    form get_int_table_fields  using    t_data type any table
                                changing t_return type abap_compdescr_tab.
       data:
       oref_table type ref to cl_abap_tabledescr,
       oref_struc type ref to cl_abap_structdescr,
       oref_error type ref to cx_root,
       text type string.
    *Get the description of data object type
       try.
           oref_table ?=
           cl_abap_tabledescr=>describe_by_data( t_data ).
         catch cx_root into oref_error.
           text = oref_error->get_text( ).
           write: / text.
           exit.
       endtry.
    *Get the line type
       try.
           oref_struc ?= oref_table->get_table_line_type( ).
         catch cx_root into oref_error.
           text = oref_error->get_text( ).
           write: / text.
           exit.
       endtry.
       append lines of oref_struc->components to t_return.
    endform.
    Regards
    Sreekanth

  • Changing ISA Product Catalog VIEW ITEMS Dynamically - Read COMM_PCAT_VITM

    Hi,
    I need to change the ISA Product Catalog Items Dynamically. Depending on certain criteria, after the user logs into the ISA, the items in a User VIEW needs to be filtered.
    I found that the View Items are stored in table COMM_PCAT_VITM. Also after Debugging ISA, I found that the following FUnction Module is used to read the View details : COM_PCAT_VIEW_GETDETAIL_O
    However I did not find which FM is used to read the VIew ITEMS .. that is Table COMM_PCAT_VITM.
    If I can find the FM, I can enhance this FM to filter the Items Dynamically...
    Second Question is ...whats the GUID field in the Table COMM_PCAT_VITM ?
    Thanks

    Hello WDA Portal,
    In the ISA, the catalog search and display list are done through RFC calls to TREX directly. Only the attribute names and product detail are read from theCRM system. So, if you are trying to manipulate the Catalog search and results, you have to do it in the Java layer only.
    You have to extend / modify the web flow and work with the following classes.
    <li>Catalog Business Object,
    <li>WebCatInfo,
    <li>CatalogFilterFactory,
    <li>IFilter,
    <li>WebCatItemList,
    <li>IQueryStatement,
    <li>IQuery
    <br>
    The enhancement is not for the faint hearted. You must have a development environment setup and you must have good developers with you to do this type of stuff.
    Easwar Ram
    http://www.parxlns.com

  • Fixed and dynamic field headings in field catalog

    i have to develop an ALV Report where certain column headings are fixed and other column heading will be changing from time to time.
    is there any method to do so.
    that is i have to show the report for 3 months and the names of months will be changing in due course.
    Waiting for a reply.
    A.Reshma

    hi,
    you have 4 texts
    SELTEXT_L
    SELTEXT_M
    SELTEXT_S
    and   DDIC_TEXT  (not sure about spelling)
    change this text dynamicly with month of your choice.
    Rgds

  • Dynamic Field Catalogs in ALV

    Hi ,
    I have a requirement in which the selection screen of the report contains a field called period .
    Suppose the report is run on say the month of December and the period value they entered in selection screen is 4 .
    The ALV should show the values for 4 months prior to december ie Aug,Nov,Sept,Oct,Nov,and Dec.
    How to dynamically modify the fieldcatalog in ALV in that case
    Thanks in advance
    Arshad.A

    Hello Arshad
    Assuming that the user cannot go back further than the current year the maximum value for period will be 11 (e.g. current month is December then show range January - December).
    Simply prepare your fieldcatalog contain 12 columns (1 for each month). Lets assume the columns are named: MONTH_01, MONTH_02, ..., MONTH_12.
    Let's take your example (December + 4 periods).
    * Get number for current month
      ld_current_month = syst-datum+4(2).
      ld_month_from     = ld_current_month - p_periods. " (= 12 - 4 = 8 = August)
      LOOP at gt_fcat INTO ls_fcat
                              WHERE ( fieldname CS 'MONTH' ).
        If ( ls_fcat-fieldname+6(2) BETWEEN ld_month_from AND ld_current_month ).
    *     keep
        ELSE.
          ls_fcat-tech = 'X'.  " no output on ALV list
       ENDIF.
         MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
      ENDLOOP.
    The restriction to the current year can be overcome the same way yet the coding will get somewhat more complex.
    Regards
      Uwe

Maybe you are looking for