Dynamic Structure and Components Issue

Hi,
I have a requirement of creating an inbound idoc program and populating dynamic structures. The program for the dynamic structure creation is as follows: ( I have been referencing Heilmans Blog ): The part for the inbound idoc creation works fine. The data will come in a flat file with Table name and 15 characterstcis. The table name is known at runtime. I need to create the dynamic table, find out the components and then populate the custom table with the dynamically created structures.
Custom table: 4 components
Internal table from file: 15 components with value.
There could be more than one table in the flat file and not all components or char in the flat file is mapped to the table.
I have been able to code the part where the components in the structure and the file components are in the same order. The problem is if the components in the structure and the file components are not in the same order. I would appreciate some inputs in this issue.
The part that has to be worked out is:
IF NOT L_TABNAME IS INITIAL.
    perform get_structure.
    perform create_dynamic_itab.
    perform get_data.
  ENDIF.
*& Report  /FACTGLB/GTDMI_VARTAB_IDOCS02                               *
PROGRAM DESCRIPTION: Variant Table and Content Upload Interface.
          DEVELOPER: Aveek Ghose
      CREATION DATE: 2008-07-02
         RDD NUMBER: DCDD027
TRANSPORT NUMBER(S): RD2K902769
*-- REVISION HISTORY -
          DEVELOPER:
       DATE APPLIED: YYYY-MM-DD
         SCR NUMBER: <Scope Change Request ID>
         RDD NUMBER: <Toolset Object ID>
TRANSPORT NUMBER(S):
        DESCRIPTION:
REPORT  ZGTDMI_VARTAB_IDOCS_DYNAMIC
        NO STANDARD PAGE HEADING
        LINE-SIZE   150
        LINE-COUNT  55
        MESSAGE-ID  zfactglb.
**Include for Global Data Declaration
*INCLUDE /FACTGLB/GTDMI_VARTAB_TOP02.
**Include for Selection Screen
*INCLUDE /FACTGLB/GTDMI_VARTAB_SEL02.
**Include for Sub Routines
*INCLUDE /FACTGLB/GTDMI_VARTAB_FORMS02.
*&  Include           /FACTGLB/GTDMI_VARTAB_TOP02                      *
*&  Include           /FACTGLB/GTDMI_VARTAB_TOP02                      *
*&  Include           /FACTGLB/GTDMI_VARTAB_TOP
*&  Include           /FACTGLB/GTDMI_VARTAB_TOP
PROGRAM DESCRIPTION: Variant Table and Content Upload Interface.
          DEVELOPER: Aveek Ghose
      CREATION DATE: 2008-07-02
         RDD NUMBER: DCDD027
TRANSPORT NUMBER(S): RD2K902769
*-- REVISION HISTORY -
          DEVELOPER:
       DATE APPLIED: YYYY-MM-DD
         SCR NUMBER: <Scope Change Request ID>
         RDD NUMBER: <Toolset Object ID>
TRANSPORT NUMBER(S):
        DESCRIPTION:
TYPE POOLS
*Type declaration for ALV display
TYPE-POOLS : slis.
Include .
type-pools: col,                                            "#EC *
            icon,                                           "#EC *
            sym,                                            "#EC *
            abap.                                           "#EC *
Target structure definitions
tables:
  E1CUVTM,                                                  "#EC *
  E1DATEM,                                                  "#EC *
  E1CUV1M,                                                  "#EC *
  edp21,                                                    "#EC *
  edi_dc40,                                                 "#EC *
  edi_dd40,                                                 "#EC *
  edi_ds40.                                                 "#EC *
GLOBAL TYPES
TYPES : BEGIN OF ty_vartab.
        include structure E1CUVTM.
TYPES:  END OF ty_vartab.
TYPES : BEGIN OF ty_vartabdate.
        INCLUDE STRUCTURE E1DATEM.
TYPES : END OF ty_vartabdate.
*Structure for data retreived
TYPES : BEGIN OF ty_vardetails.
        INCLUDE STRUCTURE E1CUV1M.
TYPES : END OF ty_vardetails.
*Structure for data retreived from table tabinput.
TYPES : BEGIN OF ty_tabinput,
          lines type string,
        END OF ty_tabinput.
*Structure for data retreived from Table dsn_input.
TYPES : BEGIN OF ty_dsninput,                               "#EC *
          LINE(101) type c,
        END OF ty_dsninput.
*Structure for data retreived from Table dsn_input.
TYPES : BEGIN OF ty_newinput,                               "#EC *
          LINE(101) type c,
          flag(1) type c,
        END OF ty_newinput.
*Structure for keeping the values of all the custom tables
TYPES : BEGIN OF ty_custom_tabs,
          matnr   TYPE matnr,    "Material Number
          werks   TYPE werks_d,  "Plant
          lgort   TYPE lgort_d,  "Storage Location
          qunty   TYPE P DECIMALS 2, "Standard Order Quantity
          det_loc TYPE CHAR6, "Detail Location
          class   TYPE CHAR2,   "Class
          rate    TYPE P DECIMALS 2,    "Rate
        END OF ty_custom_tabs.
*Type declared for the internal table and work area which will store
*fields for error log
TYPES : BEGIN OF ty_error_log,
          matnr TYPE matnr,       "Material Number
          mtart TYPE mtart,       "Material Type
          sel_data TYPE char10,   "No of selectyed data
        END OF ty_error_log.
*Structure for keeping the output data
TYPES : BEGIN OF ty_final,
          VTNAM(018) type C,
          CHAR1(030) type C,
          CHAR2(030) type C,
          CHAR3(030) type C,
          CHAR4(030) type C,
          CHAR5(030) type C,
          CHAR6(030) type C,
          CHAR7(030) type C,
          CHAR8(030) type C,
          CHAR9(030) type C,
          CHAR10(030) type C,
          CHAR11(030) type C,
          CHAR12(030) type C,
          CHAR13(030) type C,
          CHAR14(030) type C,
          CHAR15(030) type C,
          FLAG(001) type C,
        END OF ty_final.
TYPES: begin of TY_CONTENTHD,
          VTNAM(018) type C,
          FLAG(001) type C,
  end of TY_CONTENTHD.
TYPES: begin of TY_CONTENT,
          VTNAM(018) type C,
          CHAR1(030) type C,
          CHAR2(030) type C,
          CHAR3(030) type C,
          CHAR4(030) type C,
          CHAR5(030) type C,
          CHAR6(030) type C,
          CHAR7(030) type C,
          CHAR8(030) type C,
          CHAR9(030) type C,
          CHAR10(030) type C,
          CHAR11(030) type C,
          CHAR12(030) type C,
          CHAR13(030) type C,
          CHAR14(030) type C,
          CHAR15(030) type C,
          FLAG(001) type C,
          Z_VARCOND TYPE VARCOND.
TYPES: end of TY_CONTENT.
TYPES: begin of TY_CONTENTTAB,
          VTNAM(018) type C,
          COMP1(30) TYPE C,
          CHAR1(030) type C,
          COMP2(30) TYPE C,
          CHAR2(030) type C,
          COMP3(30) TYPE C,
          CHAR3(030) type C,
          COMP4(30) TYPE C,
          CHAR4(030) type C,
          COMP5(30) TYPE C,
          CHAR5(030) type C,
          COMP6(30) TYPE C,
          CHAR6(030) type C,
          COMP7(30) TYPE C,
          CHAR7(030) type C,
          COMP8(30) TYPE C,
          CHAR8(030) type C,
          COMP9(30) TYPE C,
          CHAR9(030) type C,
          COMP10(30) TYPE C,
          CHAR10(030) type C,
          COMP11(30) TYPE C,
          CHAR11(030) type C,
          COMP12(30) TYPE C,
          CHAR12(030) type C,
          COMP13(30) TYPE C,
          CHAR13(030) type C,
          COMP14(30) TYPE C,
          CHAR14(030) type C,
          COMP15(30) TYPE C,
          CHAR15(030) type C,
          FLAG(001) type C.
TYPES: end of TY_CONTENTTAB.
TYPES: BEGIN OF TY_E1CUVTM,
          MSGFN       TYPE MSGFN,
          VAR_TAB       TYPE APITABL,
          STATUS       TYPE RCUTBST,
          VTGROUP       TYPE RCUTBGR,
          AUTHSTRUC       TYPE RCUTBBE,
          AUTHENTRY       TYPE RCUFNBI,
          FLDELETE       TYPE FLLKENZ,
          DBTABNAME       TYPE TABNAME16,
          DBCONACTIVE TYPE DBCON_ACTI,
          PRESDEC       TYPE VTDCT,
       END OF TY_E1CUVTM.
TYPES: BEGIN OF TY_E1CUV1M,
          MSGFN     TYPE MSGFN,
          VTLINENO     TYPE VTLINENO,
          VTCHARACT     TYPE ATNAM,
          ATWRT     TYPE ATWRT,
          ATFLV     TYPE ATFLV,
          ATAWE     TYPE MSEHI,
          ATFLB     TYPE ATFLB,
          ATAW1     TYPE MSEHI,
          ATCOD     TYPE ATCOD,
          ATTLV     TYPE ATTLV,
          ATTLB     TYPE ATTLB,
          ATPRZ     TYPE ATPRZ,
          ATINC     TYPE ATINC,
          VTLINENO5     TYPE VTLINENO5,
       END OF TY_E1CUV1M.
TYPES: BEGIN OF TY_E1DATEM,
          MSGFN       TYPE MSGFN,
          KEY_DATE       TYPE SYDATUM,
          AENNR       TYPE AENNR,
          EFFECTIVITY TYPE      CC_MTEFF,
       END OF TY_E1DATEM.
TYPES: BEGIN OF ty_vtnam,
         vtint TYPE vtint,  " Internal number of variant table
         vtnam TYPE vtnam,  " Name of variant table
         dbtab_name type tabname16, "Custom table Name
         error  TYPE char1,  " Indicates error in data format
         reas   TYPE char50, " Reason for failure
       END OF ty_vtnam.
Get data type for characteristic
TYPES: BEGIN OF ty_cabn,
        atinn  TYPE atinn,       "Internal characteristic
        atnam  TYPE atnam,       "Characteristic Name
        atfor  TYPE atfor,       "Data type of characteristic
        atson  TYPE atson,       "Indicator: Additional Values
        atprt  TYPE atprt,       "Check table
        atprr  TYPE atprr,       "Name of Check Report Program
        atprf  TYPE atprf,       "Function Module for Checking Values
        anzdz  TYPE anzdz,       "Number of Decimal Places
        check  TYPE char1,       "Indicates check required or not
       END OF ty_cabn.
Get field names of variant table
TYPES: BEGIN OF ty_cuvtab_fld,
         vtint TYPE vtint,   " Internal number of variant table
         atinn TYPE atinn,   " Internal characteristic
         vtpos TYPE vtpos,   " Item number of characteristic in variant
*mod-012
        DBFLD type NAME_FELD,
*mod-012
         exist TYPE char1,   " X Indictaes characteristic is part of fil
       END OF ty_cuvtab_fld.
Store all data in internal table
TYPES: BEGIN OF ty_file,
          vtnam TYPE vtnam,
          char1 TYPE atwrt,
          char2 TYPE atwrt,
          char3 TYPE atwrt,
          char4 TYPE atwrt,
          char5 TYPE atwrt,
          char6 TYPE atwrt,
          char7 TYPE atwrt,
          char8 TYPE atwrt,
          char9 TYPE atwrt,
          char10 TYPE atwrt,
          char11 TYPE atwrt,
          char12 TYPE atwrt,
          char13 TYPE atwrt,
          char14 TYPE atwrt,
          char15 TYPE atwrt,
          flag   TYPE char1,
          error  TYPE char50,
       END OF ty_file.
To check for duplicates
TYPES: BEGIN OF ty_dupl,
          vtnam TYPE vtnam,
          char1 TYPE atwrt,
          char2 TYPE atwrt,
          char3 TYPE atwrt,
          char4 TYPE atwrt,
          char5 TYPE atwrt,
          char6 TYPE atwrt,
          char7 TYPE atwrt,
          char8 TYPE atwrt,
          char9 TYPE atwrt,
          char10 TYPE atwrt,
          char11 TYPE atwrt,
          char12 TYPE atwrt,
          char13 TYPE atwrt,
          char14 TYPE atwrt,
          char15 TYPE atwrt,
          slnid  TYPE  slnid,
        END OF ty_dupl.
Get previously loaded characteristic values for internal table (CHAR)
TYPES: BEGIN OF ty_cuvtab_valc,
        vtint  TYPE  vtint,   " Internal number of variant table
        slnid  TYPE  slnid,   " Key for value combination in variant tab
        atinn  TYPE  atinn,   " Internal characteristic
        valc   TYPE  atwrt,   " Characteristic Value
      END OF ty_cuvtab_valc.
Get previously loaded characteristic values for internal table (NUM)
TYPES: BEGIN OF ty_cuvtab_valn,
        vtint  TYPE  vtint,      " Internal number of variant table
        slnid  TYPE  slnid,      " Key for value combination in variant tab
        atinn  TYPE  atinn,      " Internal characteristic
        val_from  TYPE  atflv,   " Internal floating point from
       END OF ty_cuvtab_valn.
Store column positions of characteristics
TYPES: BEGIN OF ty_col_pos,
         vtint  TYPE vtint,   " Internal number of variant table
         vtnam  TYPE vtnam,   " Variant table name
         atinn  TYPE atinn,   "Internal characteristic
         atnam  TYPE atnam,   "Characteristic Name
         field  TYPE fieldname,   "Field name
         req    TYPE char1,       " Required or not
         vtpos  TYPE vtpos,       " Item number of characteristics
         DBFLD type NAME_FELD,    " Field Name of Custom table.
       END OF ty_col_pos.
Store valid values for characteristics
TYPES: BEGIN OF ty_cawn,
          atinn TYPE atinn,   " Internal characteristic
          atzhl TYPE atzhl,   " Int counter
          atwrt TYPE atwrt,   " Characteristic Value
          atflv TYPE atflv,   " Internal floating point from
          lkenz TYPE lkenz,   " Deletion indicator
      END OF ty_cawn.
Store error messages for individual lines
TYPES: BEGIN OF ty_error,
         vtnam  TYPE vtnam,       " Variant table name
         fname  TYPE fieldname,   " Fieldname
         atnam  TYPE atnam,       " Characteristic name
         atwrt  TYPE atwrt,       " Characteristic value
         row    TYPE char5,       " Row id
      END OF ty_error.
Begin TPR# 4618
To store unique number for variant
TYPES: BEGIN OF ty_vnt_ma,
        vtnam     TYPE vtnam,
        unique_no TYPE ZGTDM_UNQN,
        no_chr    TYPE ZGTDM_NO_CHR,
      END OF ty_vnt_ma.
TYPES: BEGIN OF ty_dbtab,
        vtint     TYPE vtint,
        vtnam     TYPE vtnam,
        DBTAB_NAME TYPE TABNAME16,
      END OF ty_dbtab.
To find out concatenated number for
TYPES: BEGIN OF ty_split,
        f1 TYPE char6,
      END OF ty_split.
TYPES: BEGIN OF ty_charval,
        char TYPE char30,
      END OF ty_charval.
TYPES: BEGIN OF TY_DATA,
       name TYPE string,
       value(15) type c,
      END OF TY_DATA.
DATA: I_DATATAB TYPE STANDARD TABLE OF TY_DATA.
TYPES:
  TUMLS_MESSTYPE type /SAPDMC/LS_MESSTYPE,
  TUMLS_MESSTYPETXT type EDI_TEXT60,
  TUMLS_MESSCODE type EDIPMESCOD.
TYPES:
  TUMLS_TABNAME TYPE TABNAME,                               "#EC *
  TUMLS_SEGMENT TYPE TABNAME.                               "#EC *
TYPES:
  TUMLS_PATHFILE TYPE /SAPDMC/LS_FILENAME,
  TUMLS_FILENAME TYPE /SAPDMC/LS_FILENAME,
  TUMLS_FILETEXT TYPE /SAPDMC/LS_FILETEXT.
TYPES:
  BEGIN OF type_errorline,
     msgty type SYMSGTY,
     id type SYMSGID,
     msgno type symsgno,
     par1 type symsgv,
     par2 type symsgv,
     par3 type symsgv,
     par4 type symsgv,
  END OF type_errorline.
TYPES:
  type_errortab TYPE SORTED TABLE
                OF type_errorline
                WITH NON-UNIQUE KEY id msgno par1 par2 par3 par4.
DATA:
    LV_INDEX TYPE SY-INDEX,
    LV_INDEX2 TYPE SYINDEX,
    LV_TABLE1 TYPE REF TO DATA,
    LV_TABLE2 TYPE REF TO DATA,
    LV_TABLE3 TYPE REF TO DATA,
    LV_TABLE4 TYPE REF TO DATA,
    LV_LINE1  TYPE REF TO DATA,
    LV_LINE2  TYPE REF TO DATA,
    LV_LINE3  TYPE REF TO DATA,
    LV_LINE4  TYPE REF TO DATA,
    LV_OFFSET1 TYPE SYTABIX,
    ST_IS_LAYOUT_ALV TYPE SLIS_LAYOUT_ALV,
    L_IT_FCATLOG_ALV TYPE SLIS_T_FIELDCAT_ALV,
    L_IT_FLDCAT TYPE LVC_T_FCAT.
GLOBAL INTERNAL TABLES
DATA : i_newinput TYPE STANDARD TABLE OF ty_newinput INITIAL SIZE 0."#EC *
DATA : i_contentheader1 TYPE STANDARD TABLE OF ty_contenthd INITIAL SIZE 0."#EC *
DATA : i_contenttab1 TYPE STANDARD TABLE OF ty_content INITIAL SIZE 0."#EC *
DATA : i_contenttab2 TYPE STANDARD TABLE OF ty_content INITIAL SIZE 0."#EC *
DATA : i_contenttab3 TYPE STANDARD TABLE OF ty_content INITIAL SIZE 0."#EC *
DATA : i_contenttab4 TYPE STANDARD TABLE OF ty_content INITIAL SIZE 0."#EC *
DATA : i_contenttab5 TYPE STANDARD TABLE OF ty_contenttab INITIAL SIZE 0."#EC *
DATA : i_E1CUV1M TYPE STANDARD TABLE OF E1CUV1M INITIAL SIZE 0."#EC *
DATA : i_errortab TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0."#EC *
GLOBAL WORK AREAS
**Internal Table for the structure TY_T001L
DATA : wa_vartab TYPE ty_vartab.                            "#EC *
DATA : wa_vartabdate TYPE ty_vartabdate.                    "#EC *
DATA : wa_vardetails TYPE ty_vardetails.                    "#EC *
DATA : wa_tabinput TYPE ty_tabinput.                        "#EC *
DATA : wa_dsninput TYPE ty_dsninput.                        "#EC *
DATA : wa_newinput TYPE ty_newinput.                        "#EC *
DATA : wa_gnewinput TYPE ty_newinput.                       "#EC *
DATA : wa_ginput_data TYPE ty_newinput.                     "#EC *
DATA : wa_final TYPE ty_final.                              "#EC *
DATA : wa_content TYPE ty_content.                          "#EC *
DATA : wa_contenthd TYPE ty_contenthd.                      "#EC *
DATA : wa_contentheader type ty_contenthd.                  "#EC *
DATA : wa_contenttab TYPE ty_content.                       "#EC *
DATA : wa_content1 TYPE ty_content.                         "#EC *
DATA : wa_contenthd1 TYPE ty_contenthd.                     "#EC *
DATA : wa_contentheader1 type ty_contenthd.                 "#EC *
DATA : wa_contenttab1 TYPE ty_content.                      "#EC *
DATA : wa_contenttab2 TYPE ty_content.                      "#EC *'
DATA : wa_contenttab3 TYPE ty_content.                      "#EC *
DATA : wa_contenttab4 TYPE ty_content.                      "#EC *
DATA : wa_contenttab5 TYPE ty_contentTAB.                   "#EC *
DATA : wa_E1CUVTM TYPE E1CUVTM.                             "#EC *
DATA : wa_E1CUV1M TYPE E1CUV1M.                             "#EC *
DATA : wa_E1DATEM TYPE E1DATEM.                             "#EC *
DATA : wa_error_tab TYPE solisti1.                          "#EC *
INTERNAL TABLES AND WORK AREAS FOR BDC
*Internal Table to store the data to display the error message
DATA : i_errormsg TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0."#EC *
*Internal Table to store the data to display the error message
DATA : i_error TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0."#EC *
DATA : itab_error TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0."#EC *
**Work area to store the data to display the error message
DATA : wa_errormsg TYPE solisti1.                           "#EC *
**Internal table which will store data for the error log
DATA:i_error_log TYPE STANDARD TABLE OF ty_error_log INITIAL SIZE 0."#EC *
GLOBAL VARIABLES
DATA:  G_FILE TYPE string.                                  "#EC *
DATA : g_ctr_input_recs(5) type c.                          "#EC *
DATA:  g_ctr_output_recs(5) type p.                         "#EC *
data : g_msg(100) type c.                                   "#EC *
data:  g_struct_file TYPE string.                           "#EC *
data:  g_login type FILEINTERN.                             "#EC *
data:  g_phyin type string.                                 "#EC *
DATA:  g_lprnt type RSPOPSHORT.                             "#EC *
DATA:  g_FNAME1 TYPE STRING.                                "#EC *
DATA : g_repid TYPE repid,                                  "#EC *
       g_exit(1) TYPE C,                                    "#EC *
       gx_variant  type disvariant.                         "#EC *
DATA : g_lines    TYPE i .                                  "#EC *
data : g_save(1) type c.                                    "#EC *
DATA : g_splid     TYPE rspoid .                            "#EC *
data:  p_login type FILEINTERN.                             "#EC *
data:  p_phyin type string.                                 "#EC *
DATA:
  go_table         TYPE REF TO cl_salv_table,
  go_sdescr        TYPE REF TO cl_abap_structdescr,
  go_tdescr        TYPE REF TO cl_abap_tabledescr,
  gdo_data         TYPE REF TO data,
  gdo_handle       TYPE REF TO data,
  gs_comp          TYPE abap_componentdescr,
  gt_components    TYPE abap_component_tab.
FIELD-SYMBOLS:
       TYPE table.
GLOBAL CONSTANTS
CONSTANTS c_msgar   TYPE rslgarea   VALUE 'F8'.             "#EC *
CONSTANTS c_msgid   TYPE rslgsubid  VALUE 'E'.              "#EC *
CONSTANTS c_urgnc   TYPE char04     VALUE 'HIGH'.           "#EC *
CONSTANTS C_X(1)       TYPE C          VALUE 'X'.           "#EC *
CONSTANTS C_Y(1)       TYPE C          VALUE 'Y'.           "#EC *
CONSTANTS C_Z(1)       TYPE C          VALUE 'Z'.           "#EC *
CONSTANTS C_E(1)       TYPE C          VALUE 'E'.           "#EC *
CONSTANTS C_SAP(3)     TYPE C          VALUE 'SAP'.         "#EC *
CONSTANTS C_MOD(3)     TYPE C          VALUE 'MOD'.         "#EC *
CONSTANTS C_MD1(3)     TYPE C          VALUE 'MD1'.         "#EC *
CONSTANTS C_MD2(3)     TYPE C          VALUE 'MD2'.         "#EC *
CONSTANTS C_MD3(3)     TYPE C          VALUE 'MD3'.         "#EC *
CONSTANTS C_MD4(3)     TYPE C          VALUE 'MD4'.         "#EC *
CONSTANTS C_MD5(3)     TYPE C          VALUE 'MD5'.         "#EC *
constants:   c_000001(6)  type c value '000001',            "#EC *
             c_e1cuv1m(7) type c value 'E1CUV1M',           "#EC *
             c_02(2)  type c value '02',                    "#EC *
             c_009(3)   type c value '009',                 "#EC *
             c_0001(4) type c value '0001'.                 "#EC *
constants:  c_e1datem(7) type c value 'E1DATEM'.            "#EC *
constants:  c_e1cuvtm(7) type c value 'E1CUVTM'.            "#EC *
GLOBAL INTERNAL TABLES FOR ALV DISPLAY
*Internal tables for ALV Field cat
DATA :
i_fieldcat_ov  TYPE STANDARD TABLE OF slis_fieldcat_alv INITIAL SIZE 0,"#EC *
i_fieldcat_dtl TYPE STANDARD TABLE OF slis_fieldcat_alv INITIAL SIZE 0,"#EC *
i_fieldcat_ov1 TYPE lvc_t_fcat,                             "#EC *
i_events       TYPE slis_t_event.                           "#EC *
GLOBAL WORK AREAS FOR ALV DISPLAY
*Work area for ALV Field layout
DATA : wa_layout TYPE slis_layout_alv.                      "#EC *
*Work area for Field Cat. Table
DATA : wa_fieldcat TYPE slis_fieldcat_alv.                  "#EC *
GLOBAL VARIABLES FOR ALV DISPLAY
DATA : g_event  TYPE slis_t_event.                          "#EC *
DATA : g_top_of_page TYPE slis_t_listheader.                "#EC *
DATA : g_ok_code     TYPE char4.                            "#EC *
DATA : g_variant     type disvariant.                       "#EC *
GLOBAL CONSTANTS FOR ALV DISPLAY
BAL handling
data: iv_log_handle type BALLOGHNDL.                        "#EC *
data: is_log_header type bal_s_log.                         "#EC *
data: iv_object     type bal_s_log-object    value 'CAPI'.  "#EC *
data: iv_subobject  type bal_s_log-subobject value 'CAPI_LOG'."#EC *
data: iv_tcode      type bal_s_log-altcode   value 'SE38'.  "#EC *
*MOD-005
RANGES:
    R_MESTYP FOR EDIDC-MESTYP,                              "#EC *
    R_CREDAT FOR EDIDC-CREDAT,                                  "#EC *
    R_CRETIM FOR EDIDC-CRETIM,                              "#EC *
    R_SNDPRT FOR EDIDC-SNDPRT,                              "#EC *
    R_SNDPRN FOR EDIDC-SNDPRN.                              "#EC *
DATA:
    L_MESSTYPE TYPE TUMLS_MESSTYPE.                         "#EC *
*MOD-005
data:        p_sndprn TYPE EDI_SNDPRN,                      "#EC *
             p_sndprt TYPE EDI_SNDPRT,                      "#EC *
             p_sndpor TYPE EDI_SNDPOR.                      "#EC *
data:        p_rcvprn TYPE EDI_RCVPRN,                      "#EC *
             p_rcvprt TYPE EDI_RCVPRT,                      "#EC *
             p_rcvpor TYPE EDI_RCVPOR.                      "#EC *
data:
  init_E1CUVTM type E1CUVTM,                                "#EC *
  prev_E1CUVTM type E1CUVTM,                                "#EC *
  init_E1DATEM type E1DATEM,                                "#EC *
  prev_E1DATEM type E1DATEM,                                "#EC *
  init_E1CUV1M type E1CUV1M,                                "#EC *
  prev_E1CUV1M type E1CUV1M.                                "#EC *
Source structure definitions
data:
  begin of LSMW_TAB_CONTENT,                                "#EC *
    VTNAM(018) type C,
    CHAR1(030) type C,
    CHAR2(030) type C,
    CHAR3(030) type C,
    CHAR4(030) type C,
    CHAR5(030) type C,
    CHAR6(030) type C,
    CHAR7(030) type C,
    CHAR8(030) type C,
    CHAR9(030) type C,
    CHAR10(030) type C,
    CHAR11(030) type C,
    CHAR12(030) type C,
    CHAR13(030) type C,
    CHAR14(030) type C,
    CHAR15(030) type C,
    FLAG(001) type C,
  end of LSMW_TAB_CONTENT.
Counters
data:
  g_cnt_VAR_TAB  type i,                                    "#EC *
  g_cnt_TAB_CONTENT  type i.                                "#EC *
Counter ct_xxxxxxxxxx: number of transferred records
data:
  ct_edi_dc40 type i,                                       "#EC *
  cs_edi_dc40 type i,                                       "#EC *
  ct_E1CUVTM  type i,                                       "#EC *
  cs_E1CUVTM  type i,                                       "#EC *
  ct_E1DATEM  type i,                                       "#EC *
  cs_E1DATEM  type i,                                       "#EC *
  ct_E1CUV1M  type i,                                       "#EC *
  cs_E1CUV1M  type i.                                       "#EC *
Global data definitions and data declarations
DATA: wa_cabn TYPE ty_cabn,
      wa_cawn TYPE ty_cawn,
      wa_file TYPE ty_file,
      wa_vtnam TYPE ty_vtnam,
      wa_cuvtab_fld TYPE ty_cuvtab_fld,
      wa_cuvtab_valn TYPE ty_cuvtab_valn,
      wa_cuvtab_valc TYPE ty_cuvtab_valc,
      wa_col_pos     TYPE ty_col_pos,
      wa_error       TYPE ty_error,
      wa_dupl        TYPE ty_dupl,
      wa_dupl_file   TYPE ty_dupl.
DATA: wa_vnt_ma TYPE ty_vnt_ma,
      wa_split  TYPE ty_split.
DATA: wa_charval TYPE ty_charval.                           "#EC *
Internal table
DATA: i_cabn        TYPE STANDARD TABLE OF ty_cabn,         "#EC *
      i_cabn_temp   TYPE STANDARD TABLE OF ty_cabn,         "#EC *
      i_cabn_atinn  TYPE STANDARD TABLE OF ty_cabn,         "#EC *
      i_file        TYPE STANDARD TABLE OF ty_file,         "#EC *
      i_file_tmp    TYPE STANDARD TABLE OF ty_file,         "#EC *
      i_vtnam       TYPE STANDARD TABLE OF ty_vtnam,        "#EC *
      i_cuvtab      TYPE STANDARD TABLE OF ty_vtnam,        "#EC *
      i_cuvtab_fld  TYPE STANDARD TABLE OF ty_cuvtab_fld,   "#EC *
      i_cuvtab_valn TYPE STANDARD TABLE OF ty_cuvtab_valn,  "#EC *
      i_cuvtab_valc TYPE STANDARD TABLE OF ty_cuvtab_valc,  "#EC *
      i_col_pos     TYPE STANDARD TABLE OF ty_col_pos,      "#EC *
      i_cawn        TYPE STANDARD TABLE OF ty_cawn,         "#EC *
      i_cawn_n      TYPE STANDARD TABLE OF ty_cawn,         "#EC *
      i_cawn_c      TYPE STANDARD TABLE OF ty_cawn,         "#EC *
      i_cawn_i      TYPE STANDARD TABLE OF ty_cawn,         "#EC *
      i_cuv_error   TYPE STANDARD TABLE OF ty_vtnam,        "#EC *
      i_dupl        TYPE STANDARD TABLE OF ty_dupl,         "#EC *
      i_dbtab       TYPE STANDARD TABLE OF ty_dbtab.        "#EC *
DATA: i_vnt_ma TYPE STANDARD TABLE OF ty_vnt_ma,            "#EC *
      i_split  TYPE STANDARD TABLE OF ty_split.             "#EC *
DATA: i_dupl_file TYPE STANDARD TABLE OF ty_dupl.           "#EC *
DATA: i_charval TYPE STANDARD TABLE OF ty_charval.          "#EC *
Constants
CONSTANTS: c_char TYPE atfor VALUE 'CHAR',                  "#EC *
           c_date TYPE atfor VALUE 'DATE',                  "#EC *
           c_time TYPE atfor VALUE 'TIME',                  "#EC *
           c_varcond TYPE atnam VALUE 'Z_VARCOND'.          "#EC *
Field Symbols
FIELD-SYMBOLS:  TYPE ANY.
Variables
DATA: g_raw(500)  TYPE c,                                   "#EC *
      g_invalid   TYPE char1,                               "#EC *
      g_error     TYPE char1,                               "#EC *
      g_message   TYPE char50,                              "#EC *
      g_slnid_c    TYPE slnid,                              "#EC *
      g_slnid_n    TYPE slnid,                              "#EC *
      g_row        TYPE char5.                              "#EC *
DATA: g_varcond TYPE varcond, "Variant condition "#EC NEEDED
      g_split_var TYPE i.                                   "#EC *
Types: begin of ty_charname,
         name type atnam,
       end of ty_charname.
data: wa_charname type ty_charname,                         "#EC *
      i_charname type standard table of ty_charname.        "#EC *
data: cnt_i type i,                                         "#EC *
      g_tabix type char10.                                  "#EC *
Types: begin of ty_itab_zedidc40.
        include structure edi_dc40.
TYPES:       end of ty_itab_zedidc40.
Types: begin of ty_itab_zedidd40.
        include structure edi_dd40.
TYPES: end of ty_itab_zedidd40.
DATA: itab_zedidc40 type standard table of
                  ty_itab_zedidc40 initial size 0.          "#EC *
DATA: itab_zedidd40 type standard table of
                  ty_itab_zedidd40 initial size 0.          "#EC *
DATA: wa_itab_zedidc40 type ty_itab_zedidc40.
DATA: wa_itab_zedidd40 type ty_itab_zedidd40.
*MOD-009
data: itab_ze1cuvtm type e1cuvtm,                           "#EC *
      itab_ze1datem type e1datem,                           "#EC *
      itab_ze1cuv1m type e1cuv1m.                           "#EC *
data: wdocnum(16) type n value 0.                           "#EC *
data: wsegnum(6)  type n value 0.                           "#EC *
data: witemno(10) type n value 0.                           "#EC *
data: witemno_new(10)  type n value 0.                      "#EC *
data: witemno_gst(10)  type n value 0.                      "#EC *
data: witemno_qst(10)  type n value 0.                      "#EC *
TYPES: BEGIN OF ty_input_data1,                             "#EC *
          line(560) type c,
          flag(1) type c,
       END OF ty_input_data1.
DATA: i_input_data type standard table of
                  ty_input_data1 initial size 0. "with header line.
DATA: i_input_data1 type standard table of
                  ty_input_data1 initial size 0. "with header line.
DATA: wa_input_data type ty_input_data1.                    "#EC *
DATA: g_cnt_input_recs type i.                              "#EC *
DATA: g_flg_error type c.                                   "#EC *
DATA: l_lines type i.                                       "#EC *
DATA: l_lines_varcond type i.                               "#EC *
DATA: l_lines1 type i.                                      "#EC *
DATA: l_tabix type i.                                       "#EC *
DATA: wa_input_data1 type ty_input_data1.                   "#EC *
DATA: FILE TYPE STRING.
Fields that are made available to the user:
DATA:
  g_cnt_records_read TYPE i,                                "#EC *
  g_cnt_records_transferred TYPE i,                         "#EC *
  g_cnt_transactions_read TYPE i,                           "#EC *
  g_cnt_transactions_transferred TYPE i,                    "#EC *
  g_cnt_idocs_package TYPE i.                               "#EC *
data: v_log_handle type balloghndl.                         "#EC *
DATA: gt_curr_edi_dc40 TYPE STANDARD TABLE OF edi_dc40 initial size 0."#EC *
DATA: gt_curr_edi_dd40 TYPE STANDARD TABLE OF edi_dd40 initial size 0."#EC *
DATA: wa_curr_edi_dc40 TYPE edi_dc40.                       "#EC *
DATA: wa_curr_edi_dd40 TYPE edi_dd40.                       "#EC *
internal table for error messages during conversion
DATA: g_error_tab TYPE type_errortab,                       "#EC *
      wa_errortab TYPE type_errorline.                      "#EC *
DATA:  g_edidd_segnam type EDI4SEGNAM,                      "#EC *
       g_edidd_hlevel type EDI4HLEVEC.                      "#EC *
DATA: g_segnum(6) TYPE n.
DATA: g_objecttype(2) type C.
DATA: P_FNAME(128) TYPE C VALUE '/usr/sap/trans/vartabheader'. " MODIF ID MD1 OBLIGATORY.
DATA: P_FNAME1(128) TYPE C VALUE '/usr/sap/trans/vartabcontent'. " MODIF ID MD1 OBLIGATORY.
DATA: alv_fldcat TYPE slis_t_fieldcat_alv,
      it_fldcat TYPE lvc_t_fcat.
field-symbols: .
data: dy_table type ref to data,
      dy_line  type ref to data,
      xfc type lvc_s_fcat,
      ifc type lvc_t_fcat.
data: l_wa_data TYPE TY_CONTENT,
      l_tabname TYPE tabname,
      itab_data TYPE standard table of TY_CONTENT.
DATA:   l_len_slnid TYPE i,                                 "#EC NEEDED
        l_len_varcond TYPE i,                               "#EC NEEDED
        l_temp_slnid TYPE i,                                "#EC NEEDED
        l_temp_slnc TYPE char5,                             "#EC NEEDED
        l_temp_varcond TYPE varcond,                        "#EC NEEDED
        l_sub_var      TYPE i,                              "#EC NEEDED
        l_val_split TYPE char10.                            "#EC NEEDED
DATA: l_invalid.                                          "#EC NEEDED
DECLARATION FOR SELECTION SCREEN
*selection-screen skip 1.
*For all the input field entries
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.
*Parameter for Input File Name:
PARAMETERS:   p_inpt   TYPE RLGRAP-FILENAME MODIF ID MOD . " Presentation server File Variant table
PARAMETERS:   p_inpt1  TYPE RLGRAP-FILENAME MODIF ID MOD . " Presentation server File variant Content
SELECTION-SCREEN END OF BLOCK bl1.
IDoc creation
selection-screen begin of block idocpars
                 with frame title text-006.
parameters:
   p_trfcpt as checkbox default C_X MODIF ID MD3,
   p_packge(5) type n default 1 MODIF ID MD3.
selection-screen end of block idocpars.
SELECTION-SCREEN BEGIN OF BLOCK bl5 WITH FRAME TITLE text-038.
Radio Buttons :
parameters:
  rb_idocp RADIOBUTTON GROUP RB3 DEFAULT 'X' USER-COMMAND UCOM MODIF ID MD6,
  rb_custt RADIOBUTTON GROUP RB3 MODIF ID MD6.
SELECTION-SCREEN END OF BLOCK bl5.
SELECTION-SCREEN BEGIN OF BLOCK bl3 WITH FRAME TITLE text-032.
Radio Buttons :
parameters:
  rb_apsrv RADIOBUTTON GROUP RB1 DEFAULT 'X' USER-COMMAND UCOM MODIF ID MD4,
  rb_convt RADIOBUTTON GROUP RB1 MODIF ID MD4,
  rb_idoc RADIOBUTTON  GROUP RB1 MODIF ID MD4,
  rb_proc RADIOBUTTON  GROUP RB1 MODIF ID MD4.
SELECTION-SCREEN END OF BLOCK bl3.
SELECTION-SCREEN BEGIN OF BLOCK bl4 WITH FRAME TITLE text-037.
Radio Buttons :
parameters:
  rb_appct RADIOBUTTON GROUP RB2 DEFAULT 'X' USER-COMMAND UCOM MODIF ID MD5,
  rb_conct RADIOBUTTON GROUP RB2 MODIF ID MD5,
  rb_cust RADIOBUTTON  GROUP RB2 MODIF ID MD5.
SELECTION-SCREEN END OF BLOCK bl4.
INITIALIZATION
INITIALIZATION.
Check selection-screen entries *
*AT SELECTION-SCREEN.
PERFORM sub_get_physical_file USING p_fpath p_fname.
PERFORM sub_get_physical_file1 USING p_fpath1 p_fname1.
AT SELECTION SCREEN
*AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
PERFORM sub_get_file. " CHANGING p_fname.         "#EC *
*AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname1.
PERFORM sub_get_file1. " CHANGING p_fname1.       "#EC *
AT SELECTI

Hi,
  I now have a requirement for the following:
Duplicate VARCOND if I  Use small letters and capital letters. Sequential number also duplicated.
Here is the code and would appreciate if someone could shed some light on the issue.
*& Report  ZVARTABDYNFINAL
PROGRAM DESCRIPTION: Variant Table and Content Upload Interface.
          DEVELOPER: Aveek Ghose
      CREATION DATE: 2008-08-25
         RDD NUMBER: DCDD027
TRANSPORT NUMBER(S): RD2K902769
*-- REVISION HISTORY -
          DEVELOPER:
       DATE APPLIED: YYYY-MM-DD
         SCR NUMBER: <Scope Change Request ID>
         RDD NUMBER: <Toolset Object ID>
TRANSPORT NUMBER(S):
        DESCRIPTION:
REPORT  ZVARTABDYNFINAL NO STANDARD PAGE HEADING
        LINE-SIZE   150
        LINE-COUNT  55
        MESSAGE-ID  /factglb/gta_custdev.
*&  Include           /FACTGLB/GTDMI_VARTAB_TOP02                      *
*&  Include           /FACTGLB/GTDMI_VARTAB_TOP
*&  Include           /FACTGLB/GTDMI_VARTAB_TOP
PROGRAM DESCRIPTION: Variant Table and Content Upload Interface.
          DEVELOPER: Aveek Ghose
      CREATION DATE: 2008-08-25
         RDD NUMBER: DCDD027
TRANSPORT NUMBER(S): RD2K902769
*-- REVISION HISTORY -
          DEVELOPER:
       DATE APPLIED: YYYY-MM-DD
         SCR NUMBER: <Scope Change Request ID>
         RDD NUMBER: <Toolset Object ID>
TRANSPORT NUMBER(S):
        DESCRIPTION:
TYPE POOLS
TYPE POOLS
TYPE POOLS
*Type declaration for ALV display
TYPE-POOLS : slis.
Include <icon>.
type-pools: col,                                            "#EC *
            icon,                                           "#EC *
            sym,                                            "#EC *
            abap.                                           "#EC *
Target structure definitions
tables:
  E1CUVTM,                                                  "#EC *
  E1DATEM,                                                  "#EC *
  E1CUV1M,                                                  "#EC *
  edp21,                                                    "#EC *
  edi_dc40,                                                 "#EC *
  edi_dd40,                                                 "#EC *
  edi_ds40.                                                 "#EC *
GLOBAL TYPES
TYPES : BEGIN OF ty_vartab.
        include structure E1CUVTM.
TYPES:  END OF ty_vartab.
TYPES : BEGIN OF ty_vartabdate.
        INCLUDE STRUCTURE E1DATEM.
TYPES : END OF ty_vartabdate.
*Structure for data retreived
TYPES : BEGIN OF ty_vardetails.
        INCLUDE STRUCTURE E1CUV1M.
TYPES : END OF ty_vardetails.
*Structure for data retreived from table tabinput.
TYPES : BEGIN OF ty_tabinput,
          lines type string,
        END OF ty_tabinput.
*Structure for data retreived from Table dsn_input.
TYPES : BEGIN OF ty_dsninput,                               "#EC *
          LINE(101) type c,
        END OF ty_dsninput.
*Structure for data retreived from Table dsn_input.
TYPES : BEGIN OF ty_newinput,                               "#EC *
          LINE(101) type c,
          flag(1) type c,
        END OF ty_newinput.
*Structure for keeping the values of all the custom tables
TYPES : BEGIN OF ty_custom_tabs,
          matnr   TYPE matnr,    "Material Number
          werks   TYPE werks_d,  "Plant
          lgort   TYPE lgort_d,  "Storage Location
          qunty   TYPE P DECIMALS 2, "Standard Order Quantity
          det_loc TYPE CHAR6, "Detail Location
          class   TYPE CHAR2,   "Class
          rate    TYPE P DECIMALS 2,    "Rate
        END OF ty_custom_tabs.
*Type declared for the internal table and work area which will store
*fields for error log
TYPES : BEGIN OF ty_error_log,
          matnr TYPE matnr,       "Material Number
          mtart TYPE mtart,       "Material Type
          sel_data TYPE char10,   "No of selectyed data
        END OF ty_error_log.
*Structure for keeping the output data
TYPES : BEGIN OF ty_final,
          VTNAM(018) type C,
          CHAR1(030) type C,
          CHAR2(030) type C,
          CHAR3(030) type C,
          CHAR4(030) type C,
          CHAR5(030) type C,
          CHAR6(030) type C,
          CHAR7(030) type C,
          CHAR8(030) type C,
          CHAR9(030) type C,
          CHAR10(030) type C,
          CHAR11(030) type C,
          CHAR12(030) type C,
          CHAR13(030) type C,
          CHAR14(030) type C,
          CHAR15(030) type C,
          FLAG(001) type C,
        END OF ty_final.
TYPES: begin of TY_CONTENTHD,
          VTNAM(018) type C,
          FLAG(001) type C,
  end of TY_CONTENTHD.
TYPES: begin of TY_CONTENT,
          VTNAM(018) type C,
          CHAR1(030) type C,
          CHAR2(030) type C,
          CHAR3(030) type C,
          CHAR4(030) type C,
          CHAR5(030) type C,
          CHAR6(030) type C,
          CHAR7(030) type C,
          CHAR8(030) type C,
          CHAR9(030) type C,
          CHAR10(030) type C,
          CHAR11(030) type C,
          CHAR12(030) type C,
          CHAR13(030) type C,
          CHAR14(030) type C,
          CHAR15(030) type C,
          FLAG(001) type C,
          Z_VARCOND type VARCOND.
TYPES: end of TY_CONTENT.
TYPES: begin of TY_CONTENTTAB,
          VTNAM(018) type C,
          COMP1(30) TYPE C,
          CHAR1(030) type C,
          COMP2(30) TYPE C,
          CHAR2(030) type C,
          COMP3(30) TYPE C,
          CHAR3(030) type C,
          COMP4(30) TYPE C,
          CHAR4(030) type C,
          COMP5(30) TYPE C,
          CHAR5(030) type C,
          COMP6(30) TYPE C,
          CHAR6(030) type C,
          COMP7(30) TYPE C,
          CHAR7(030) type C,
          COMP8(30) TYPE C,
          CHAR8(030) type C,
          COMP9(30) TYPE C,
          CHAR9(030) type C,
          COMP10(30) TYPE C,
          CHAR10(030) type C,
          COMP11(30) TYPE C,
          CHAR11(030) type C,
          COMP12(30) TYPE C,
          CHAR12(030) type C,
          COMP13(30) TYPE C,
          CHAR13(030) type C,
          COMP14(30) TYPE C,
          CHAR14(030) type C,
          COMP15(30) TYPE C,
          CHAR15(030) type C,
          FLAG(001) type C.
TYPES: end of TY_CONTENTTAB.
TYPES: BEGIN OF TY_E1CUVTM,
          MSGFN       TYPE MSGFN,
          VAR_TAB       TYPE APITABL,
          STATUS       TYPE RCUTBST,
          VTGROUP       TYPE RCUTBGR,
          AUTHSTRUC       TYPE RCUTBBE,
          AUTHENTRY       TYPE RCUFNBI,
          FLDELETE       TYPE FLLKENZ,
          DBTABNAME       TYPE TABNAME16,
          DBCONACTIVE TYPE DBCON_ACTI,
          PRESDEC       TYPE VTDCT,
       END OF TY_E1CUVTM.
TYPES: BEGIN OF TY_E1CUV1M,
          MSGFN     TYPE MSGFN,
          VTLINENO     TYPE VTLINENO,
          VTCHARACT     TYPE ATNAM,
          ATWRT     TYPE ATWRT,
          ATFLV     TYPE ATFLV,
          ATAWE     TYPE MSEHI,
          ATFLB     TYPE ATFLB,
          ATAW1     TYPE MSEHI,
          ATCOD     TYPE ATCOD,
          ATTLV     TYPE ATTLV,
          ATTLB     TYPE ATTLB,
          ATPRZ     TYPE ATPRZ,
          ATINC     TYPE ATINC,
          VTLINENO5     TYPE VTLINENO5,
       END OF TY_E1CUV1M.
TYPES: BEGIN OF TY_E1DATEM,
          MSGFN       TYPE MSGFN,
          KEY_DATE       TYPE SYDATUM,
          AENNR       TYPE AENNR,
          EFFECTIVITY TYPE      CC_MTEFF,
       END OF TY_E1DATEM.
TYPES: BEGIN OF ty_vtnam,
         vtint TYPE vtint,  " Internal number of variant table
         vtnam TYPE vtnam,  " Name of variant table
         dbtab_name type tabname16, "Custom table Name
         error  TYPE char1,  " Indicates error in data format
         reas   TYPE char50, " Reason for failure
       END OF ty_vtnam.
Get data type for characteristic
TYPES: BEGIN OF ty_cabn,
        atinn  TYPE atinn,       "Internal characteristic
        atnam  TYPE atnam,       "Characteristic Name
        atfor  TYPE atfor,       "Data type of characteristic
        atson  TYPE atson,       "Indicator: Additional Values
        atprt  TYPE atprt,       "Check table
        atprr  TYPE atprr,       "Name of Check Report Program
        atprf  TYPE atprf,       "Function Module for Checking Values
        anzdz  TYPE anzdz,       "Number of Decimal Places
        check  TYPE char1,       "Indicates check required or not
       END OF ty_cabn.
Get field names of variant table
TYPES: BEGIN OF ty_cuvtab_fld,
         vtint TYPE vtint,   " Internal number of variant table
         atinn TYPE atinn,   " Internal characteristic
         vtpos TYPE vtpos,   " Item number of characteristic in variant
*mod-012
         DBFLD type NAME_FELD,
*mod-012
         exist TYPE char1,   " X Indictaes characteristic is part of fil
       END OF ty_cuvtab_fld.
Store all data in internal table
TYPES: BEGIN OF ty_file,
          vtnam TYPE vtnam,
          char1 TYPE atwrt,
          char2 TYPE atwrt,
          char3 TYPE atwrt,
          char4 TYPE atwrt,
          char5 TYPE atwrt,
          char6 TYPE atwrt,
          char7 TYPE atwrt,
          char8 TYPE atwrt,
          char9 TYPE atwrt,
          char10 TYPE atwrt,
          char11 TYPE atwrt,
          char12 TYPE atwrt,
          char13 TYPE atwrt,
          char14 TYPE atwrt,
          char15 TYPE atwrt,
          flag   TYPE char1,
          error  TYPE char50,
       END OF ty_file.
To check for duplicates
TYPES: BEGIN OF ty_dupl,
          vtnam TYPE vtnam,
          char1 TYPE atwrt,
          char2 TYPE atwrt,
          char3 TYPE atwrt,
          char4 TYPE atwrt,
          char5 TYPE atwrt,
          char6 TYPE atwrt,
          char7 TYPE atwrt,
          char8 TYPE atwrt,
          char9 TYPE atwrt,
          char10 TYPE atwrt,
          char11 TYPE atwrt,
          char12 TYPE atwrt,
          char13 TYPE atwrt,
          char14 TYPE atwrt,
          char15 TYPE atwrt,
          slnid  TYPE  slnid,
        END OF ty_dupl.
Get previously loaded characteristic values for internal table (CHAR)
TYPES: BEGIN OF ty_cuvtab_valc,
        vtint  TYPE  vtint,   " Internal number of variant table
        slnid  TYPE  slnid,   " Key for value combination in variant tab
        atinn  TYPE  atinn,   " Internal characteristic
        valc   TYPE  atwrt,   " Characteristic Value
      END OF ty_cuvtab_valc.
Get previously loaded characteristic values for internal table (NUM)
TYPES: BEGIN OF ty_cuvtab_valn,
        vtint  TYPE  vtint,      " Internal number of variant table
        slnid  TYPE  slnid,      " Key for value combination in variant tab
        atinn  TYPE  atinn,      " Internal characteristic
        val_from  TYPE  atflv,   " Internal floating point from
       END OF ty_cuvtab_valn.
Store column positions of characteristics
TYPES: BEGIN OF ty_col_pos,
         vtint  TYPE vtint,   " Internal number of variant table
         vtnam  TYPE vtnam,   " Variant table name
         atinn  TYPE atinn,   "Internal characteristic
         atnam  TYPE atnam,   "Characteristic Name
         field  TYPE fieldname,   "Field name
         req    TYPE char1,       " Required or not
         vtpos  TYPE vtpos,       " Item number of characteristics
       END OF ty_col_pos.
Store valid values for characteristics
TYPES: BEGIN OF ty_cawn,
          atinn TYPE atinn,   " Internal characteristic
          atzhl TYPE atzhl,   " Int counter
          atwrt TYPE atwrt,   " Characteristic Value
          atflv TYPE atflv,   " Internal floating point from
          lkenz TYPE lkenz,   " Deletion indicator
      END OF ty_cawn.
Store error messages for individual lines
TYPES: BEGIN OF ty_error,
         vtnam  TYPE vtnam,       " Variant table name
         fname  TYPE fieldname,   " Fieldname
         atnam  TYPE atnam,       " Characteristic name
         atwrt  TYPE atwrt,       " Characteristic value
         row    TYPE char5,       " Row id
      END OF ty_error.
Begin TPR# 4618
To store unique number for variant
TYPES: BEGIN OF ty_vnt_ma,
        vtnam     TYPE vtnam,
        unique_no TYPE ZGTDM_UNQN,
        no_chr    TYPE ZGTDM_NO_CHR,
      END OF ty_vnt_ma.
TYPES: BEGIN OF ty_dbtab,
        vtint     TYPE vtint,
        vtnam     TYPE vtnam,
        DBTAB_NAME TYPE TABNAME16,
      END OF ty_dbtab.
To find out concatenated number for
TYPES: BEGIN OF ty_split,
        f1 TYPE char6,
      END OF ty_split.
TYPES: BEGIN OF ty_charval,
        char TYPE char30,
      END OF ty_charval.
TYPES: BEGIN OF TY_DATA,
       name TYPE string,
       value(15) type c,
      END OF TY_DATA.
DATA: I_DATATAB TYPE STANDARD TABLE OF TY_DATA. "#EC NEEDED
TYPES:
  TUMLS_MESSTYPE type /SAPDMC/LS_MESSTYPE,
  TUMLS_MESSTYPETXT type EDI_TEXT60,
  TUMLS_MESSCODE type EDIPMESCOD.
TYPES:
  TUMLS_TABNAME TYPE TABNAME,                               "#EC *
  TUMLS_SEGMENT TYPE TABNAME.                               "#EC *
TYPES:
  TUMLS_PATHFILE TYPE /SAPDMC/LS_FILENAME,
  TUMLS_FILENAME TYPE /SAPDMC/LS_FILENAME,
  TUMLS_FILETEXT TYPE /SAPDMC/LS_FILETEXT.
TYPES:
  BEGIN OF type_errorline,
     msgty type SYMSGTY,
     id type SYMSGID,
     msgno type symsgno,
     par1 type symsgv,
     par2 type symsgv,
     par3 type symsgv,
     par4 type symsgv,
  END OF type_errorline.
TYPES:
  type_errortab TYPE SORTED TABLE
                OF type_errorline
                WITH NON-UNIQUE KEY id msgno par1 par2 par3 par4.
DATA:
     LV_LINE2  TYPE REF TO DATA.
GLOBAL INTERNAL TABLES
DATA : i_newinput TYPE STANDARD TABLE OF ty_newinput INITIAL SIZE 0."#EC *
DATA : i_contentheader1 TYPE STANDARD TABLE OF ty_contenthd INITIAL SIZE 0."#EC *
DATA : i_contenttab1 TYPE STANDARD TABLE OF ty_content INITIAL SIZE 0."#EC *
DATA : i_contenttab2 TYPE STANDARD TABLE OF ty_content INITIAL SIZE 0."#EC *
DATA : i_contenttab3 TYPE STANDARD TABLE OF ty_content INITIAL SIZE 0."#EC *
DATA : i_contenttab4 TYPE STANDARD TABLE OF ty_content INITIAL SIZE 0."#EC *
DATA : i_contenttab5 TYPE STANDARD TABLE OF ty_contenttab INITIAL SIZE 0."#EC *
DATA : i_E1CUV1M TYPE STANDARD TABLE OF E1CUV1M INITIAL SIZE 0."#EC *
DATA : i_errortab TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0."#EC *
GLOBAL WORK AREAS
**Internal Table for the structure TY_T001L
DATA : wa_vartab TYPE ty_vartab.                            "#EC *
DATA : wa_vartabdate TYPE ty_vartabdate.                    "#EC *
DATA : wa_vardetails TYPE ty_vardetails.                    "#EC *
DATA : wa_tabinput TYPE ty_tabinput.                        "#EC *
DATA : wa_dsninput TYPE ty_dsninput.                        "#EC *
DATA : wa_newinput TYPE ty_newinput.                        "#EC *
DATA : wa_gnewinput TYPE ty_newinput.                       "#EC *
DATA : wa_ginput_data TYPE ty_newinput.                     "#EC *
DATA : wa_final TYPE ty_final.                              "#EC *
DATA : wa_content TYPE ty_content.                          "#EC *
DATA : wa_contenthd TYPE ty_contenthd.                      "#EC *
DATA : wa_contentheader type ty_contenthd.                  "#EC *
DATA : wa_contenttab TYPE ty_content.                       "#EC *
DATA : wa_content1 TYPE ty_content.                         "#EC *
DATA : wa_contenthd1 TYPE ty_contenthd.                     "#EC *
DATA : wa_contentheader1 type ty_contenthd.                 "#EC *
DATA : wa_contenttab1 TYPE ty_content.                      "#EC *
DATA : wa_contenttab2 TYPE ty_content.                      "#EC *
DATA : wa_contenttab3 TYPE ty_content.                      "#EC *
DATA : wa_contenttab4 TYPE ty_content.                      "#EC *
DATA : wa_contenttab5 TYPE ty_contentTAB.                   "#EC *
DATA : wa_E1CUVTM TYPE E1CUVTM.                             "#EC *
DATA : wa_E1CUV1M TYPE E1CUV1M.                             "#EC *
DATA : wa_E1DATEM TYPE E1DATEM.                             "#EC *
DATA : wa_error_tab TYPE solisti1.                          "#EC *
INTERNAL TABLES AND WORK AREAS FOR BDC
*Internal Table to store the data to display the error message
DATA : i_errormsg TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0."#EC *
*Internal Table to store the data to display the error message
DATA : i_error TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0."#EC *
DATA : itab_error TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0."#EC *
**Work area to store the data to display the error message
DATA : wa_errormsg TYPE solisti1.                           "#EC *
**Internal table which will store data for the error log
DATA:i_error_log TYPE STANDARD TABLE OF ty_error_log INITIAL SIZE 0."#EC *
GLOBAL VARIABLES
DATA:  G_FILE TYPE string.                                  "#EC *
DATA : g_ctr_input_recs(5) type c.                          "#EC *
DATA:  g_ctr_output_recs(5) type p.                         "#EC *
data : g_msg(100) type c.                                   "#EC *
data:  g_struct_file TYPE string.                           "#EC *
data:  g_login type FILEINTERN.                             "#EC *
data:  g_phyin type string.                                 "#EC *
DATA:  g_lprnt type RSPOPSHORT.                             "#EC *
DATA:  g_FNAME1 TYPE STRING.                                "#EC *
DATA : g_repid TYPE repid,                                  "#EC *
       g_exit(1) TYPE C,                                    "#EC *
       gx_variant  type disvariant.                         "#EC *
DATA : g_lines    TYPE i .                                  "#EC *
data : g_save(1) type c.                                    "#EC *
DATA : g_splid     TYPE rspoid .                            "#EC *
data:  p_login type FILEINTERN.                             "#EC *
data:  p_phyin type string.                                 "#EC *
GLOBAL CONSTANTS
CONSTANTS c_msgar   TYPE rslgarea   VALUE 'F8'.             "#EC *
CONSTANTS c_msgid   TYPE rslgsubid  VALUE 'E'.              "#EC *
CONSTANTS c_urgnc   TYPE char04     VALUE 'HIGH'.           "#EC *
CONSTANTS C_X(1)       TYPE C          VALUE 'X'.           "#EC *
CONSTANTS C_Y(1)       TYPE C          VALUE 'Y'.           "#EC *
CONSTANTS C_Z(1)       TYPE C          VALUE 'Z'.           "#EC *
CONSTANTS C_E(1)       TYPE C          VALUE 'E'.           "#EC *
CONSTANTS C_SAP(3)     TYPE C          VALUE 'SAP'.         "#EC *
CONSTANTS C_MOD(3)     TYPE C          VALUE 'MOD'.         "#EC *
CONSTANTS C_MD1(3)     TYPE C          VALUE 'MD1'.         "#EC *
CONSTANTS C_MD2(3)     TYPE C          VALUE 'MD2'.         "#EC *
CONSTANTS C_MD3(3)     TYPE C          VALUE 'MD3'.         "#EC *
CONSTANTS C_MD4(3)     TYPE C          VALUE 'MD4'.         "#EC *
CONSTANTS C_MD5(3)     TYPE C          VALUE 'MD5'.         "#EC *
constants:   c_000001(6)  type c value '000001',            "#EC *
             c_e1cuv1m(7) type c value 'E1CUV1M',           "#EC *
             c_02(2)  type c value '02',                    "#EC *
             c_009(3)   type c value '009',                 "#EC *
             c_0001(4) type c value '0001'.                 "#EC *
constants:  c_e1datem(7) type c value 'E1DATEM'.            "#EC *
constants:  c_e1cuvtm(7) type c value 'E1CUVTM'.            "#EC *
GLOBAL INTERNAL TABLES FOR ALV DISPLAY
*Internal tables for ALV Field cat
DATA :
i_fieldcat_ov  TYPE STANDARD TABLE OF slis_fieldcat_alv INITIAL SIZE 0,"#EC *
i_fieldcat_dtl TYPE STANDARD TABLE OF slis_fieldcat_alv INITIAL SIZE 0,"#EC *
i_fieldcat_ov1 TYPE lvc_t_fcat,                             "#EC *
i_events       TYPE slis_t_event.                           "#EC *
GLOBAL WORK AREAS FOR ALV DISPLAY
*Work area for ALV Field layout
DATA : wa_layout TYPE slis_layout_alv.                      "#EC *
*Work area for Field Cat. Table
DATA : wa_fieldcat TYPE slis_fieldcat_alv.                  "#EC *
GLOBAL VARIABLES FOR ALV DISPLAY
DATA : g_event  TYPE slis_t_event.                          "#EC *
DATA : g_top_of_page TYPE slis_t_listheader.                "#EC *
DATA : g_ok_code     TYPE char4.                            "#EC *
DATA : g_variant     type disvariant.                       "#EC *
GLOBAL CONSTANTS FOR ALV DISPLAY
BAL handling
data: iv_log_handle type BALLOGHNDL.                        "#EC *
data: is_log_header type bal_s_log.                         "#EC *
data: iv_object     type bal_s_log-object    value 'CAPI'.  "#EC *
data: iv_subobject  type bal_s_log-subobject value 'CAPI_LOG'."#EC *
data: iv_tcode      type bal_s_log-altcode   value 'SE38'.  "#EC *
*MOD-005
RANGES:
    R_MESTYP FOR EDIDC-MESTYP,                              "#EC *
    R_CREDAT FOR EDIDC-CREDAT,                                  "#EC *
    R_CRETIM FOR EDIDC-CRETIM,                              "#EC *
    R_SNDPRT FOR EDIDC-SNDPRT,                              "#EC *
    R_SNDPRN FOR EDIDC-SNDPRN.                              "#EC *
DATA:
    L_MESSTYPE TYPE TUMLS_MESSTYPE.                         "#EC *
*MOD-005
data:        p_sndprn TYPE EDI_SNDPRN,                      "#EC *
             p_sndprt TYPE EDI_SNDPRT,                      "#EC *
             p_sndpor TYPE EDI_SNDPOR.                      "#EC *
data:        p_rcvprn TYPE EDI_RCVPRN,                      "#EC *
             p_rcvprt TYPE EDI_RCVPRT,                      "#EC *
             p_rcvpor TYPE EDI_RCVPOR.                      "#EC *
data:
  init_E1CUVTM type E1CUVTM,                                "#EC *
  prev_E1CUVTM type E1CUVTM,                                "#EC *
  init_E1DATEM type E1DATEM,                                "#EC *
  prev_E1DATEM type E1DATEM,                                "#EC *
  init_E1CUV1M type E1CUV1M,                                "#EC *
  prev_E1CUV1M type E1CUV1M.                                "#EC *
Source structure definitions
data:
  begin of LSMW_TAB_CONTENT,                                "#EC *
    VTNAM(018) type C,
    CHAR1(030) type C,
    CHAR2(030) type C,
    CHAR3(030) type C,
    CHAR4(030) type C,
    CHAR5(030) type C,
    CHAR6(030) type C,
    CHAR7(030) type C,
    CHAR8(030) type C,
    CHAR9(030) type C,
    CHAR10(030) type C,
    CHAR11(030) type C,
    CHAR12(030) type C,
    CHAR13(030) type C,
    CHAR14(030) type C,
    CHAR15(030) type C,
    FLAG(001) type C,
  end of LSMW_TAB_CONTENT.
Counters
data:
  g_cnt_VAR_TAB  type i,                                    "#EC *
  g_cnt_TAB_CONTENT  type i.                                "#EC *
Counter ct_xxxxxxxxxx: number of transferred records
data:
  ct_edi_dc40 type i,                                       "#EC *
  cs_edi_dc40 type i,                                       "#EC *
  ct_E1CUVTM  type i,                                       "#EC *
  cs_E1CUVTM  type i,                                       "#EC *
  ct_E1DATEM  type i,                                       "#EC *
  cs_E1DATEM  type i,                                       "#EC *
  ct_E1CUV1M  type i,                                       "#EC *
  cs_E1CUV1M  type i.                                       "#EC *
Global data definitions and data declarations
DATA: wa_cabn TYPE ty_cabn,
      wa_cawn TYPE ty_cawn,
      wa_file TYPE ty_file,
      wa_vtnam TYPE ty_vtnam,
      wa_cuvtab_fld TYPE ty_cuvtab_fld,
      wa_cuvtab_valn TYPE ty_cuvtab_valn,
      wa_cuvtab_valc TYPE ty_cuvtab_valc,
      wa_col_pos     TYPE ty_col_pos,
      wa_error       TYPE ty_error,
      wa_dupl        TYPE ty_dupl,
      wa_dupl_file   TYPE ty_dupl.
DATA: wa_vnt_ma TYPE ty_vnt_ma,
      wa_split  TYPE ty_split.
DATA: wa_charval TYPE ty_charval.                           "#EC *
Internal table
DATA: i_cabn        TYPE STANDARD TABLE OF ty_cabn,         "#EC *
      i_cabn_temp   TYPE STANDARD TABLE OF ty_cabn,         "#EC *
      i_cabn_atinn  TYPE STANDARD TABLE OF ty_cabn,         "#EC *
      i_file        TYPE STANDARD TABLE OF ty_file,         "#EC *
      i_file_tmp    TYPE STANDARD TABLE OF ty_file,         "#EC *
      i_vtnam       TYPE STANDARD TABLE OF ty_vtnam,        "#EC *
      i_cuvtab      TYPE STANDARD TABLE OF ty_vtnam,        "#EC *
      i_cuvtab_fld  TYPE STANDARD TABLE OF ty_cuvtab_fld,   "#EC *
      i_cuvtab_valn TYPE STANDARD TABLE OF ty_cuvtab_valn,  "#EC *
      i_cuvtab_valc TYPE STANDARD TABLE OF ty_cuvtab_valc,  "#EC *
      i_col_pos     TYPE STANDARD TABLE OF ty_col_pos,      "#EC *
      i_cawn        TYPE STANDARD TABLE OF ty_cawn,         "#EC *
      i_cawn_n      TYPE STANDARD TABLE OF ty_cawn,         "#EC *
      i_cawn_c      TYPE STANDARD TABLE OF ty_cawn,         "#EC *
      i_cawn_i      TYPE STANDARD TABLE OF ty_cawn,         "#EC *
      i_cuv_error   TYPE STANDARD TABLE OF ty_vtnam,        "#EC *
      i_dupl        TYPE STANDARD TABLE OF ty_dupl,         "#EC *
      i_dbtab       TYPE STANDARD TABLE OF ty_dbtab.        "#EC *
DATA: i_vnt_ma TYPE STANDARD TABLE OF ty_vnt_ma,            "#EC *
      i_split  TYPE STANDARD TABLE OF ty_split.             "#EC *
DATA: i_dupl_file TYPE STANDARD TABLE OF ty_dupl.           "#EC *
DATA: i_charval TYPE STANDARD TABLE OF ty_charval.          "#EC *
Constants
CONSTANTS: c_char TYPE atfor VALUE 'CHAR',                  "#EC *
           c_date TYPE atfor VALUE 'DATE',                  "#EC *
           c_time TYPE atfor VALUE 'TIME',                  "#EC *
           c_varcond TYPE atnam VALUE 'Z_VARCOND'.          "#EC *
Field Symbols
FIELD-SYMBOLS: <fs_vtnam>      TYPE ty_vtnam,               "#EC *
               <fs_cabn>       TYPE ty_cabn,                "#EC *
               <fs_cuvtab_fld> TYPE ty_cuvtab_fld,          "#EC *
               <fs_dupl>       TYPE ty_dupl.                "#EC *
FIELD-SYMBOLS: <FS_DYN_WA> TYPE ANY.
Variables
DATA: g_raw(500)  TYPE c,                                   "#EC *
      g_invalid   TYPE char1,                               "#EC *
      g_error     TYPE char1,                               "#EC *
      g_message   TYPE char50,                              "#EC *
      g_slnid_c    TYPE slnid,                              "#EC *
      g_slnid_n    TYPE slnid,                              "#EC *
      g_row        TYPE char5.                              "#EC *
DATA: g_varcond TYPE varcond, "Variant condition "#EC NEEDED
      g_split_var TYPE i,                                  "#EC *
      g_split_var1 type i.                                 "#EC *
Types: begin of ty_charname,
         name type atnam,
       end of ty_charname.
data: wa_charname type ty_charname,                         "#EC *
      i_charname type standard table of ty_charname.        "#EC *
data: cnt_i type i,                                         "#EC *
      g_tabix type char10.                                  "#EC *
Types: begin of ty_itab_zedidc40.
        include structure edi_dc40.
TYPES:       end of ty_itab_zedidc40.
Types: begin of ty_itab_zedidd40.
        include structure edi_dd40.
TYPES: end of ty_itab_zedidd40.
DATA: itab_zedidc40 type standard table of
                  ty_itab_zedidc40 initial size 0.          "#EC *
DATA: itab_zedidd40 type standard table of
                  ty_itab_zedidd40 initial size 0.          "#EC *
DATA: wa_itab_zedidc40 type ty_itab_zedidc40.               "#EC NEEDED
DATA: wa_itab_zedidd40 type ty_itab_zedidd40.
*MOD-009
data: itab_ze1cuvtm type e1cuvtm,                           "#EC *
      itab_ze1datem type e1datem,                           "#EC *
      itab_ze1cuv1m type e1cuv1m.                           "#EC *
data: wdocnum(16) type n value 0.                           "#EC *
data: wsegnum(6)  type n value 0.                           "#EC *
data: witemno(10) type n value 0.                           "#EC *
data: witemno_new(10)  type n value 0.                      "#EC *
data: witemno_gst(10)  type n value 0.                      "#EC *
data: witemno_qst(10)  type n value 0.                      "#EC *
TYPES: BEGIN OF ty_input_data1,                             "#EC *
          line(560) type c,
          flag(1) type c,
       END OF ty_input_data1.
DATA: i_input_data type standard table of
                  ty_input_data1 initial size 0. "with header line.
DATA: i_input_data1 type standard table of
                  ty_input_data1 initial size 0. "with header line.
DATA: wa_input_data type ty_input_data1.                    "#EC *
DATA: g_cnt_input_recs type i.                              "#EC *
DATA: g_flg_error type c.                                   "#EC *
DATA: l_lines type i.                                       "#EC *
DATA: l_lines1 type i.                                      "#EC *
DATA: l_tabix type i.                                       "#EC *
DATA: wa_input_data1 type ty_input_data1.                   "#EC *
DATA: FILE TYPE STRING.
Fields that are made available to the user:
DATA:
  g_cnt_records_read TYPE i,                                "#EC *
  g_cnt_records_transferred TYPE i,                         "#EC *
  g_cnt_transactions_read TYPE i,                           "#EC *
  g_cnt_transactions_transferred TYPE i,                    "#EC *
  g_cnt_idocs_package TYPE i.                               "#EC *
data: v_log_handle type balloghndl.                         "#EC *
DATA: gt_curr_edi_dc40 TYPE STANDARD TABLE OF edi_dc40 initial size 0."#EC *
DATA: gt_curr_edi_dd40 TYPE STANDARD TABLE OF edi_dd40 initial size 0."#EC *
DATA: wa_curr_edi_dc40 TYPE edi_dc40.                       "#EC *
DATA: wa_curr_edi_dd40 TYPE edi_dd40.                       "#EC *
internal table for error messages during conversion
DATA: g_error_tab TYPE type_errortab,                       "#EC *
      wa_errortab TYPE type_errorline.                      "#EC *
DATA:  g_edidd_segnam type EDI4SEGNAM,                      "#EC *
       g_edidd_hlevel type EDI4HLEVEC.                      "#EC *
DATA: g_segnum(6) TYPE n.
DATA: g_objecttype(2) type C.
DATA: P_FNAME(128) TYPE C VALUE '/usr/sap/trans/vartabheader'. " MODIF ID MD1 OBLIGATORY.
DATA: P_FNAME1(128) TYPE C VALUE '/usr/sap/trans/vartabcontent'. " MODIF ID MD1 OBLIGATORY.
field-symbols: <dyn_table> type standard table,
               <dyn_table1> type standard table,
               <dyn_wa>,
               <dyn_wa1> TYPE ANY.
data: dy_table type ref to data,
      dy_line  type ref to data,
      xfc type lvc_s_fcat,
      ifc type lvc_t_fcat.
data: l_tabname TYPE tabname.
DATA: l_len_slnid TYPE i,                                 "#EC NEEDED
        l_len_varcond TYPE i,                               "#EC NEEDED
        l_temp_slnid TYPE i,                                "#EC NEEDED
        l_temp_slnc TYPE char5,                             "#EC NEEDED
        l_temp_varcond TYPE varcond,                        "#EC NEEDED
        l_sub_var      TYPE i,                              "#EC NEEDED
        l_val_split TYPE char10.                            "#EC NEEDED
DATA: l_invalid.                                          "#EC NEEDED
*Include for Global Data Declaration
*INCLUDE ZGTDMI_VARTAB_TOPDYN.
*INCLUDE /FACTGLB/GTDMI_VARTAB_TOP02.
*Include for Selection Screen
*INCLUDE ZGTDMI_VARTAB_SELDYN.
*INCLUDE /FACTGLB/GTDMI_VARTAB_SEL02.
*Include for Sub Routines
*INCLUDE ZGTDMI_VARTAB_FORMSDYN.
*INCLUDE /FACTGLB/GTDMI_VARTAB_FORMS02.
*&  Include           /FACTGLB/GTDMI_VARTAB_SEL02                      *
*&  Include           /FACTGLB/GTDMI_VARTAB_SEL
*&  Include           /FACTGLB/GTDMI_VARTAB_SEL
PROGRAM DESCRIPTION: Variant Table and Content Upload Interface.
          DEVELOPER: Aveek Ghose
      CREATION DATE: 2008-08-25
         RDD NUMBER: DCDD027
TRANSPORT NUMBER(S): RD2K902769
*-- REVISION HISTORY -
          DEVELOPER:
       DATE APPLIED: YYYY-MM-DD
         SCR NUMBER: <Scope Change Request ID>
         RDD NUMBER: <Toolset Object ID>
TRANSPORT NUMBER(S):
        DESCRIPTION:
DECLARATION FOR SELECTION SCREEN
*selection-screen skip 1.
*For all the input field entries
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.
*Parameter for Input File Name:
PARAMETERS:   p_inpt   TYPE RLGRAP-FILENAME MODIF ID MOD . " Presentation server File Variant table
PARAMETERS:   p_inpt1  TYPE RLGRAP-FILENAME MODIF ID MOD . " Presentation server File variant Content
SELECTION-SCREEN END OF BLOCK bl1.
IDoc creation
selection-screen begin of block idocpars
                 with frame title text-006.
parameters:
   p_trfcpt as checkbox default C_X MODIF ID MD3,
   p_packge(5) type n default 1 MODIF ID MD3.
selection-screen end of block idocpars.
SELECTION-SCREEN BEGIN OF BLOCK bl3 WITH FRAME TITLE text-032.
Radio Buttons :
parameters:
  rb_apsrv RADIOBUTTON GROUP RB1 DEFAULT 'X' USER-COMMAND UCOM,
  rb_convt RADIOBUTTON GROUP RB1,
  rb_idoc RADIOBUTTON GROUP RB1.
rb_proc RADIOBUTTON GROUP RB1.
SELECTION-SCREEN END OF BLOCK bl3.
INITIALIZATION
INITIALIZATION.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_INPT.
  CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
      STATIC        = C_X
    CHANGING
      FILE_NAME     = P_INPT
    EXCEPTIONS
      MASK_TOO_LONG = 1
      OTHERS        = 2.
  IF SY-SUBRC <> 0.
    MESSAGE e241.
  ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_INPT1.
  CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
      STATIC        = C_X
    CHANGING
      FILE_NAME     = P_INPT1
    EXCEPTIONS
      MASK_TOO_LONG = 1
      OTHERS        = 2.
 

Similar Messages

  • Issue in Dynamic Structure and Component Program

    Hi,
      I have a requirement of creating an inbound idoc program and populating dynamic structures. The program for the dynamic structure creation is as follows: ( I have been referencing Heilmans Blog ): The part for the inbound idoc creation works fine. The data will come in a flat file with Table name and 15 characterstcis. The table name is known at runtime. I need to create the dynamic table, find out the components and then populate the custom table with the dynamically created structures.
    Custom table: 4 components
    Internal table from file: 15 components with value.
    There could be more than one table in the flat file and not all components or char in the flat file is mapped to the table. I would need some expertise in coding the OO part of the program.
    Any inputs will be apprciated:
    <removed 6845 lines of code (forum software cut off at this point, there was more!) - did you actually expect anyone to read that? Also, please use code tags (the "<>" icon on the toolbar)>
    Edited by: Mike Pokraka on Aug 3, 2008 6:15 PM

    Hi,
    The program works fine fo creating inbound idocs. It is the dynamic structure population that seems to be the problem mentioned earlier: Here is the code:
    *& Report  /FACTGLB/GTDMI_VARTAB_IDOCS02                               *
    PROGRAM DESCRIPTION: Variant Table and Content Upload Interface.
              DEVELOPER: Aveek Ghose
          CREATION DATE: 2008-04-18
             RDD NUMBER: DCDD027
    TRANSPORT NUMBER(S): RD2K902769
    *-- REVISION HISTORY -
              DEVELOPER:
           DATE APPLIED: YYYY-MM-DD
             SCR NUMBER: <Scope Change Request ID>
             RDD NUMBER: <Toolset Object ID>
    TRANSPORT NUMBER(S):
            DESCRIPTION:
    REPORT  ZGTDMI_VARTAB_IDOCS_DYNAMIC
            NO STANDARD PAGE HEADING
            LINE-SIZE   150
            LINE-COUNT  55
            MESSAGE-ID  zfactglb.
    **Include for Global Data Declaration
    *INCLUDE /FACTGLB/GTDMI_VARTAB_TOP02.
    **Include for Selection Screen
    *INCLUDE /FACTGLB/GTDMI_VARTAB_SEL02.
    **Include for Sub Routines
    *INCLUDE /FACTGLB/GTDMI_VARTAB_FORMS02.
    *&  Include           /FACTGLB/GTDMI_VARTAB_TOP02                      *
    *&  Include           /FACTGLB/GTDMI_VARTAB_TOP02                      *
    *&  Include           /FACTGLB/GTDMI_VARTAB_TOP
    *&  Include           /FACTGLB/GTDMI_VARTAB_TOP
    PROGRAM DESCRIPTION: Variant Table and Content Upload Interface.
              DEVELOPER: Aveek Ghose
          CREATION DATE: 2008-04-18
             RDD NUMBER: DCDD027
    TRANSPORT NUMBER(S): RD2K902769
    *-- REVISION HISTORY -
              DEVELOPER:
           DATE APPLIED: YYYY-MM-DD
             SCR NUMBER: <Scope Change Request ID>
             RDD NUMBER: <Toolset Object ID>
    TRANSPORT NUMBER(S):
            DESCRIPTION:
    TYPE POOLS
    *Type declaration for ALV display
    TYPE-POOLS : slis.
    Include .
    type-pools: col,                                            "#EC *
                icon,                                           "#EC *
                sym,                                            "#EC *
                abap.                                           "#EC *
    Target structure definitions
    tables:
      E1CUVTM,                                                  "#EC *
      E1DATEM,                                                  "#EC *
      E1CUV1M,                                                  "#EC *
      edp21,                                                    "#EC *
      edi_dc40,                                                 "#EC *
      edi_dd40,                                                 "#EC *
      edi_ds40.                                                 "#EC *
    GLOBAL TYPES
    TYPES : BEGIN OF ty_vartab.
            include structure E1CUVTM.
    TYPES:  END OF ty_vartab.
    TYPES : BEGIN OF ty_vartabdate.
            INCLUDE STRUCTURE E1DATEM.
    TYPES : END OF ty_vartabdate.
    *Structure for data retreived
    TYPES : BEGIN OF ty_vardetails.
            INCLUDE STRUCTURE E1CUV1M.
    TYPES : END OF ty_vardetails.
    *Structure for data retreived from table tabinput.
    TYPES : BEGIN OF ty_tabinput,
              lines type string,
            END OF ty_tabinput.
    *Structure for data retreived from Table dsn_input.
    TYPES : BEGIN OF ty_dsninput,                               "#EC *
              LINE(101) type c,
            END OF ty_dsninput.
    *Structure for data retreived from Table dsn_input.
    TYPES : BEGIN OF ty_newinput,                               "#EC *
              LINE(101) type c,
              flag(1) type c,
            END OF ty_newinput.
    *Structure for keeping the values of all the custom tables
    TYPES : BEGIN OF ty_custom_tabs,
              matnr   TYPE matnr,    "Material Number
              werks   TYPE werks_d,  "Plant
              lgort   TYPE lgort_d,  "Storage Location
              qunty   TYPE P DECIMALS 2, "Standard Order Quantity
              det_loc TYPE CHAR6, "Detail Location
              class   TYPE CHAR2,   "Class
              rate    TYPE P DECIMALS 2,    "Rate
            END OF ty_custom_tabs.
    *Type declared for the internal table and work area which will store
    *fields for error log
    TYPES : BEGIN OF ty_error_log,
              matnr TYPE matnr,       "Material Number
              mtart TYPE mtart,       "Material Type
              sel_data TYPE char10,   "No of selectyed data
            END OF ty_error_log.
    *Structure for keeping the output data
    TYPES : BEGIN OF ty_final,
              VTNAM(018) type C,
              CHAR1(030) type C,
              CHAR2(030) type C,
              CHAR3(030) type C,
              CHAR4(030) type C,
              CHAR5(030) type C,
              CHAR6(030) type C,
              CHAR7(030) type C,
              CHAR8(030) type C,
              CHAR9(030) type C,
              CHAR10(030) type C,
              CHAR11(030) type C,
              CHAR12(030) type C,
              CHAR13(030) type C,
              CHAR14(030) type C,
              CHAR15(030) type C,
              FLAG(001) type C,
            END OF ty_final.
    TYPES: begin of TY_CONTENTHD,
              VTNAM(018) type C,
              FLAG(001) type C,
      end of TY_CONTENTHD.
    TYPES: begin of TY_CONTENT,
              VTNAM(018) type C,
              CHAR1(030) type C,
              CHAR2(030) type C,
              CHAR3(030) type C,
              CHAR4(030) type C,
              CHAR5(030) type C,
              CHAR6(030) type C,
              CHAR7(030) type C,
              CHAR8(030) type C,
              CHAR9(030) type C,
              CHAR10(030) type C,
              CHAR11(030) type C,
              CHAR12(030) type C,
              CHAR13(030) type C,
              CHAR14(030) type C,
              CHAR15(030) type C,
              FLAG(001) type C.
    TYPES: end of TY_CONTENT.
    TYPES: BEGIN OF TY_E1CUVTM,
              MSGFN       TYPE MSGFN,
              VAR_TAB       TYPE APITABL,
              STATUS       TYPE RCUTBST,
              VTGROUP       TYPE RCUTBGR,
              AUTHSTRUC       TYPE RCUTBBE,
              AUTHENTRY       TYPE RCUFNBI,
              FLDELETE       TYPE FLLKENZ,
              DBTABNAME       TYPE TABNAME16,
              DBCONACTIVE TYPE DBCON_ACTI,
              PRESDEC       TYPE VTDCT,
           END OF TY_E1CUVTM.
    TYPES: BEGIN OF TY_E1CUV1M,
              MSGFN     TYPE MSGFN,
              VTLINENO     TYPE VTLINENO,
              VTCHARACT     TYPE ATNAM,
              ATWRT     TYPE ATWRT,
              ATFLV     TYPE ATFLV,
              ATAWE     TYPE MSEHI,
              ATFLB     TYPE ATFLB,
              ATAW1     TYPE MSEHI,
              ATCOD     TYPE ATCOD,
              ATTLV     TYPE ATTLV,
              ATTLB     TYPE ATTLB,
              ATPRZ     TYPE ATPRZ,
              ATINC     TYPE ATINC,
              VTLINENO5     TYPE VTLINENO5,
           END OF TY_E1CUV1M.
    TYPES: BEGIN OF TY_E1DATEM,
              MSGFN       TYPE MSGFN,
              KEY_DATE       TYPE SYDATUM,
              AENNR       TYPE AENNR,
              EFFECTIVITY TYPE      CC_MTEFF,
           END OF TY_E1DATEM.
    TYPES: BEGIN OF ty_vtnam,
             vtint TYPE vtint,  " Internal number of variant table
             vtnam TYPE vtnam,  " Name of variant table
             error  TYPE char1,  " Indicates error in data format
             reas   TYPE char50, " Reason for failure
           END OF ty_vtnam.
    Get data type for characteristic
    TYPES: BEGIN OF ty_cabn,
            atinn  TYPE atinn,       "Internal characteristic
            atnam  TYPE atnam,       "Characteristic Name
            atfor  TYPE atfor,       "Data type of characteristic
            atson  TYPE atson,       "Indicator: Additional Values
            atprt  TYPE atprt,       "Check table
            atprr  TYPE atprr,       "Name of Check Report Program
            atprf  TYPE atprf,       "Function Module for Checking Values
            anzdz  TYPE anzdz,       "Number of Decimal Places
            check  TYPE char1,       "Indicates check required or not
           END OF ty_cabn.
    Get field names of variant table
    TYPES: BEGIN OF ty_cuvtab_fld,
             vtint TYPE vtint,   " Internal number of variant table
             atinn TYPE atinn,   " Internal characteristic
             vtpos TYPE vtpos,   " Item number of characteristic in variant
             exist TYPE char1,   " X Indictaes characteristic is part of fil
           END OF ty_cuvtab_fld.
    Store all data in internal table
    TYPES: BEGIN OF ty_file,
              vtnam TYPE vtnam,
              char1 TYPE atwrt,
              char2 TYPE atwrt,
              char3 TYPE atwrt,
              char4 TYPE atwrt,
              char5 TYPE atwrt,
              char6 TYPE atwrt,
              char7 TYPE atwrt,
              char8 TYPE atwrt,
              char9 TYPE atwrt,
              char10 TYPE atwrt,
              char11 TYPE atwrt,
              char12 TYPE atwrt,
              char13 TYPE atwrt,
              char14 TYPE atwrt,
              char15 TYPE atwrt,
              flag   TYPE char1,
              error  TYPE char50,
           END OF ty_file.
    To check for duplicates
    TYPES: BEGIN OF ty_dupl,
              vtnam TYPE vtnam,
              char1 TYPE atwrt,
              char2 TYPE atwrt,
              char3 TYPE atwrt,
              char4 TYPE atwrt,
              char5 TYPE atwrt,
              char6 TYPE atwrt,
              char7 TYPE atwrt,
              char8 TYPE atwrt,
              char9 TYPE atwrt,
              char10 TYPE atwrt,
              char11 TYPE atwrt,
              char12 TYPE atwrt,
              char13 TYPE atwrt,
              char14 TYPE atwrt,
              char15 TYPE atwrt,
              slnid  TYPE  slnid,
            END OF ty_dupl.
    Get previously loaded characteristic values for internal table (CHAR)
    TYPES: BEGIN OF ty_cuvtab_valc,
            vtint  TYPE  vtint,   " Internal number of variant table
            slnid  TYPE  slnid,   " Key for value combination in variant tab
            atinn  TYPE  atinn,   " Internal characteristic
            valc   TYPE  atwrt,   " Characteristic Value
          END OF ty_cuvtab_valc.
    Get previously loaded characteristic values for internal table (NUM)
    TYPES: BEGIN OF ty_cuvtab_valn,
            vtint  TYPE  vtint,      " Internal number of variant table
            slnid  TYPE  slnid,      " Key for value combination in variant tab
            atinn  TYPE  atinn,      " Internal characteristic
            val_from  TYPE  atflv,   " Internal floating point from
           END OF ty_cuvtab_valn.
    Store column positions of characteristics
    TYPES: BEGIN OF ty_col_pos,
             vtint  TYPE vtint,   " Internal number of variant table
             vtnam  TYPE vtnam,   " Variant table name
             atinn  TYPE atinn,   "Internal characteristic
             atnam  TYPE atnam,   "Characteristic Name
             field  TYPE fieldname,   "Field name
             req    TYPE char1,       " Required or not
             vtpos  TYPE vtpos,       " Item number of characteristics
           END OF ty_col_pos.
    Store valid values for characteristics
    TYPES: BEGIN OF ty_cawn,
              atinn TYPE atinn,   " Internal characteristic
              atzhl TYPE atzhl,   " Int counter
              atwrt TYPE atwrt,   " Characteristic Value
              atflv TYPE atflv,   " Internal floating point from
              lkenz TYPE lkenz,   " Deletion indicator
          END OF ty_cawn.
    Store error messages for individual lines
    TYPES: BEGIN OF ty_error,
             vtnam  TYPE vtnam,       " Variant table name
             fname  TYPE fieldname,   " Fieldname
             atnam  TYPE atnam,       " Characteristic name
             atwrt  TYPE atwrt,       " Characteristic value
             row    TYPE char5,       " Row id
          END OF ty_error.
    Begin TPR# 4618
    To store unique number for variant
    TYPES: BEGIN OF ty_vnt_ma,
            vtnam     TYPE vtnam,
            unique_no TYPE ZGTDM_UNQN,
            no_chr    TYPE ZGTDM_NO_CHR,
          END OF ty_vnt_ma.
    To find out concatenated number for
    TYPES: BEGIN OF ty_split,
            f1 TYPE char6,
          END OF ty_split.
    TYPES: BEGIN OF ty_charval,
            char TYPE char30,
          END OF ty_charval.
    TYPES: BEGIN OF TY_DATA,
           name TYPE string,
           value(15) type c,
          END OF TY_DATA.
    DATA: I_DATATAB TYPE STANDARD TABLE OF TY_DATA.
    TYPES:
      TUMLS_MESSTYPE type /SAPDMC/LS_MESSTYPE,
      TUMLS_MESSTYPETXT type EDI_TEXT60,
      TUMLS_MESSCODE type EDIPMESCOD.
    TYPES:
      TUMLS_TABNAME TYPE TABNAME,                               "#EC *
      TUMLS_SEGMENT TYPE TABNAME.                               "#EC *
    TYPES:
      TUMLS_PATHFILE TYPE /SAPDMC/LS_FILENAME,
      TUMLS_FILENAME TYPE /SAPDMC/LS_FILENAME,
      TUMLS_FILETEXT TYPE /SAPDMC/LS_FILETEXT.
    TYPES:
      BEGIN OF type_errorline,
         msgty type SYMSGTY,
         id type SYMSGID,
         msgno type symsgno,
         par1 type symsgv,
         par2 type symsgv,
         par3 type symsgv,
         par4 type symsgv,
      END OF type_errorline.
    TYPES:
      type_errortab TYPE SORTED TABLE
                    OF type_errorline
                    WITH NON-UNIQUE KEY id msgno par1 par2 par3 par4.
    DATA:
        LV_INDEX TYPE SY-INDEX,
        LV_INDEX2 TYPE SYINDEX,
        LV_TABLE1 TYPE REF TO DATA,
        LV_TABLE2 TYPE REF TO DATA,
        LV_TABLE3 TYPE REF TO DATA,
        LV_TABLE4 TYPE REF TO DATA,
        LV_LINE1  TYPE REF TO DATA,
        LV_LINE2  TYPE REF TO DATA,
        LV_LINE3  TYPE REF TO DATA,
        LV_LINE4  TYPE REF TO DATA,
        LV_OFFSET1 TYPE SYTABIX,
        ST_IS_LAYOUT_ALV TYPE SLIS_LAYOUT_ALV,
        L_IT_FCATLOG_ALV TYPE SLIS_T_FIELDCAT_ALV,
        L_IT_FLDCAT TYPE LVC_T_FCAT.
    GLOBAL INTERNAL TABLES
    DATA : i_newinput TYPE STANDARD TABLE OF ty_newinput INITIAL SIZE 0."#EC *
    DATA : i_contentheader1 TYPE STANDARD TABLE OF ty_contenthd INITIAL SIZE 0."#EC *
    DATA : i_contenttab1 TYPE STANDARD TABLE OF ty_content INITIAL SIZE 0."#EC *
    DATA : i_contenttab2 TYPE STANDARD TABLE OF ty_content INITIAL SIZE 0."#EC *
    DATA : i_contenttab3 TYPE STANDARD TABLE OF ty_content INITIAL SIZE 0."#EC *
    DATA : i_contenttab4 TYPE STANDARD TABLE OF ty_content INITIAL SIZE 0."#EC *
    DATA : i_E1CUV1M TYPE STANDARD TABLE OF E1CUV1M INITIAL SIZE 0."#EC *
    DATA : i_errortab TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0."#EC *
    GLOBAL WORK AREAS
    **Internal Table for the structure TY_T001L
    DATA : wa_vartab TYPE ty_vartab.                            "#EC *
    DATA : wa_vartabdate TYPE ty_vartabdate.                    "#EC *
    DATA : wa_vardetails TYPE ty_vardetails.                    "#EC *
    DATA : wa_tabinput TYPE ty_tabinput.                        "#EC *
    DATA : wa_dsninput TYPE ty_dsninput.                        "#EC *
    DATA : wa_newinput TYPE ty_newinput.                        "#EC *
    DATA : wa_gnewinput TYPE ty_newinput.                       "#EC *
    DATA : wa_ginput_data TYPE ty_newinput.                     "#EC *
    DATA : wa_final TYPE ty_final.                              "#EC *
    DATA : wa_content TYPE ty_content.                          "#EC *
    DATA : wa_contenthd TYPE ty_contenthd.                      "#EC *
    DATA : wa_contentheader type ty_contenthd.                  "#EC *
    DATA : wa_contenttab TYPE ty_content.                       "#EC *
    DATA : wa_content1 TYPE ty_content.                         "#EC *
    DATA : wa_contenthd1 TYPE ty_contenthd.                     "#EC *
    DATA : wa_contentheader1 type ty_contenthd.                 "#EC *
    DATA : wa_contenttab1 TYPE ty_content.                      "#EC *
    DATA : wa_contenttab2 TYPE ty_content.                      "#EC *'
    DATA : wa_contenttab3 TYPE ty_content.                      "#EC *
    DATA : wa_contenttab4 TYPE ty_content.                      "#EC *
    DATA : wa_E1CUVTM TYPE E1CUVTM.                             "#EC *
    DATA : wa_E1CUV1M TYPE E1CUV1M.                             "#EC *
    DATA : wa_E1DATEM TYPE E1DATEM.                             "#EC *
    DATA : wa_error_tab TYPE solisti1.                          "#EC *
    INTERNAL TABLES AND WORK AREAS FOR BDC
    *Internal Table to store the data to display the error message
    DATA : i_errormsg TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0."#EC *
    *Internal Table to store the data to display the error message
    DATA : i_error TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0."#EC *
    DATA : itab_error TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0."#EC *
    **Work area to store the data to display the error message
    DATA : wa_errormsg TYPE solisti1.                           "#EC *
    **Internal table which will store data for the error log
    DATA:i_error_log TYPE STANDARD TABLE OF ty_error_log INITIAL SIZE 0."#EC *
    GLOBAL VARIABLES
    DATA:  G_FILE TYPE string.                                  "#EC *
    DATA : g_ctr_input_recs(5) type c.                          "#EC *
    DATA:  g_ctr_output_recs(5) type p.                         "#EC *
    data : g_msg(100) type c.                                   "#EC *
    data:  g_struct_file TYPE string.                           "#EC *
    data:  g_login type FILEINTERN.                             "#EC *
    data:  g_phyin type string.                                 "#EC *
    DATA:  g_lprnt type RSPOPSHORT.                             "#EC *
    DATA:  g_FNAME1 TYPE STRING.                                "#EC *
    DATA : g_repid TYPE repid,                                  "#EC *
           g_exit(1) TYPE C,                                    "#EC *
           gx_variant  type disvariant.                         "#EC *
    DATA : g_lines    TYPE i .                                  "#EC *
    data : g_save(1) type c.                                    "#EC *
    DATA : g_splid     TYPE rspoid .                            "#EC *
    data:  p_login type FILEINTERN.                             "#EC *
    data:  p_phyin type string.                                 "#EC *
    DATA:
      go_table         TYPE REF TO cl_salv_table,
      go_sdescr        TYPE REF TO cl_abap_structdescr,
      go_tdescr        TYPE REF TO cl_abap_tabledescr,
      gdo_data         TYPE REF TO data,
      gdo_handle       TYPE REF TO data,
      gs_comp          TYPE abap_componentdescr,
      gt_components    TYPE abap_component_tab.
    FIELD-SYMBOLS:
           TYPE table.
    GLOBAL CONSTANTS
    CONSTANTS c_msgar   TYPE rslgarea   VALUE 'F8'.             "#EC *
    CONSTANTS c_msgid   TYPE rslgsubid  VALUE 'E'.              "#EC *
    CONSTANTS c_urgnc   TYPE char04     VALUE 'HIGH'.           "#EC *
    CONSTANTS C_X(1)       TYPE C          VALUE 'X'.           "#EC *
    CONSTANTS C_Y(1)       TYPE C          VALUE 'Y'.           "#EC *
    CONSTANTS C_Z(1)       TYPE C          VALUE 'Z'.           "#EC *
    CONSTANTS C_E(1)       TYPE C          VALUE 'E'.           "#EC *
    CONSTANTS C_SAP(3)     TYPE C          VALUE 'SAP'.         "#EC *
    CONSTANTS C_MOD(3)     TYPE C          VALUE 'MOD'.         "#EC *
    CONSTANTS C_MD1(3)     TYPE C          VALUE 'MD1'.         "#EC *
    CONSTANTS C_MD2(3)     TYPE C          VALUE 'MD2'.         "#EC *
    CONSTANTS C_MD3(3)     TYPE C          VALUE 'MD3'.         "#EC *
    constants:   c_000001(6)  type c value '000001',            "#EC *
                 c_e1cuv1m(7) type c value 'E1CUV1M',           "#EC *
                 c_02(2)  type c value '02',                    "#EC *
                 c_009(3)   type c value '009',                 "#EC *
                 c_0001(4) type c value '0001'.                 "#EC *
    constants:  c_e1datem(7) type c value 'E1DATEM'.            "#EC *
    constants:  c_e1cuvtm(7) type c value 'E1CUVTM'.            "#EC *
    GLOBAL INTERNAL TABLES FOR ALV DISPLAY
    *Internal tables for ALV Field cat
    DATA :
    i_fieldcat_ov  TYPE STANDARD TABLE OF slis_fieldcat_alv INITIAL SIZE 0,"#EC *
    i_fieldcat_dtl TYPE STANDARD TABLE OF slis_fieldcat_alv INITIAL SIZE 0,"#EC *
    i_fieldcat_ov1 TYPE lvc_t_fcat,                             "#EC *
    i_events       TYPE slis_t_event.                           "#EC *
    GLOBAL WORK AREAS FOR ALV DISPLAY
    *Work area for ALV Field layout
    DATA : wa_layout TYPE slis_layout_alv.                      "#EC *
    *Work area for Field Cat. Table
    DATA : wa_fieldcat TYPE slis_fieldcat_alv.                  "#EC *
    GLOBAL VARIABLES FOR ALV DISPLAY
    DATA : g_event  TYPE slis_t_event.                          "#EC *
    DATA : g_top_of_page TYPE slis_t_listheader.                "#EC *
    DATA : g_ok_code     TYPE char4.                            "#EC *
    DATA : g_variant     type disvariant.                       "#EC *
    GLOBAL CONSTANTS FOR ALV DISPLAY
    BAL handling
    data: iv_log_handle type BALLOGHNDL.                        "#EC *
    data: is_log_header type bal_s_log.                         "#EC *
    data: iv_object     type bal_s_log-object    value 'CAPI'.  "#EC *
    data: iv_subobject  type bal_s_log-subobject value 'CAPI_LOG'."#EC *
    data: iv_tcode      type bal_s_log-altcode   value 'SE38'.  "#EC *
    *MOD-005
    RANGES:
        R_MESTYP FOR EDIDC-MESTYP,                              "#EC *
        R_CREDAT FOR EDIDC-CREDAT,                                  "#EC *
        R_CRETIM FOR EDIDC-CRETIM,                              "#EC *
        R_SNDPRT FOR EDIDC-SNDPRT,                              "#EC *
        R_SNDPRN FOR EDIDC-SNDPRN.                              "#EC *
    DATA:
        L_MESSTYPE TYPE TUMLS_MESSTYPE.                         "#EC *
    *MOD-005
    data:        p_sndprn TYPE EDI_SNDPRN,                      "#EC *
                 p_sndprt TYPE EDI_SNDPRT,                      "#EC *
                 p_sndpor TYPE EDI_SNDPOR.                      "#EC *
    data:        p_rcvprn TYPE EDI_RCVPRN,                      "#EC *
                 p_rcvprt TYPE EDI_RCVPRT,                      "#EC *
                 p_rcvpor TYPE EDI_RCVPOR.                      "#EC *
    data:
      init_E1CUVTM type E1CUVTM,                                "#EC *
      prev_E1CUVTM type E1CUVTM,                                "#EC *
      init_E1DATEM type E1DATEM,                                "#EC *
      prev_E1DATEM type E1DATEM,                                "#EC *
      init_E1CUV1M type E1CUV1M,                                "#EC *
      prev_E1CUV1M type E1CUV1M.                                "#EC *
    Source structure definitions
    data:
      begin of LSMW_TAB_CONTENT,                                "#EC *
        VTNAM(018) type C,
        CHAR1(030) type C,
        CHAR2(030) type C,
        CHAR3(030) type C,
        CHAR4(030) type C,
        CHAR5(030) type C,
        CHAR6(030) type C,
        CHAR7(030) type C,
        CHAR8(030) type C,
        CHAR9(030) type C,
        CHAR10(030) type C,
        CHAR11(030) type C,
        CHAR12(030) type C,
        CHAR13(030) type C,
        CHAR14(030) type C,
        CHAR15(030) type C,
        FLAG(001) type C,
      end of LSMW_TAB_CONTENT.
    Counters
    data:
      g_cnt_VAR_TAB  type i,                                    "#EC *
      g_cnt_TAB_CONTENT  type i.                                "#EC *
    Counter ct_xxxxxxxxxx: number of transferred records
    data:
      ct_edi_dc40 type i,                                       "#EC *
      cs_edi_dc40 type i,                                       "#EC *
      ct_E1CUVTM  type i,                                       "#EC *
      cs_E1CUVTM  type i,                                       "#EC *
      ct_E1DATEM  type i,                                       "#EC *
      cs_E1DATEM  type i,                                       "#EC *
      ct_E1CUV1M  type i,                                       "#EC *
      cs_E1CUV1M  type i.                                       "#EC *
    Global data definitions and data declarations
    DATA: wa_cabn TYPE ty_cabn,
          wa_cawn TYPE ty_cawn,
          wa_file TYPE ty_file,
          wa_vtnam TYPE ty_vtnam,
          wa_cuvtab_fld TYPE ty_cuvtab_fld,
          wa_cuvtab_valn TYPE ty_cuvtab_valn,
          wa_cuvtab_valc TYPE ty_cuvtab_valc,
          wa_col_pos     TYPE ty_col_pos,
          wa_error       TYPE ty_error,
          wa_dupl        TYPE ty_dupl,
          wa_dupl_file   TYPE ty_dupl.
    DATA: wa_vnt_ma TYPE ty_vnt_ma,
          wa_split  TYPE ty_split.
    DATA: wa_charval TYPE ty_charval.                           "#EC *
    Internal table
    DATA: i_cabn        TYPE STANDARD TABLE OF ty_cabn,         "#EC *
          i_cabn_temp   TYPE STANDARD TABLE OF ty_cabn,         "#EC *
          i_cabn_atinn  TYPE STANDARD TABLE OF ty_cabn,         "#EC *
          i_file        TYPE STANDARD TABLE OF ty_file,         "#EC *
          i_file_tmp    TYPE STANDARD TABLE OF ty_file,         "#EC *
          i_vtnam       TYPE STANDARD TABLE OF ty_vtnam,        "#EC *
          i_cuvtab      TYPE STANDARD TABLE OF ty_vtnam,        "#EC *
          i_cuvtab_fld  TYPE STANDARD TABLE OF ty_cuvtab_fld,   "#EC *
          i_cuvtab_valn TYPE STANDARD TABLE OF ty_cuvtab_valn,  "#EC *
          i_cuvtab_valc TYPE STANDARD TABLE OF ty_cuvtab_valc,  "#EC *
          i_col_pos     TYPE STANDARD TABLE OF ty_col_pos,      "#EC *
          i_cawn        TYPE STANDARD TABLE OF ty_cawn,         "#EC *
          i_cawn_n      TYPE STANDARD TABLE OF ty_cawn,         "#EC *
          i_cawn_c      TYPE STANDARD TABLE OF ty_cawn,         "#EC *
          i_cawn_i      TYPE STANDARD TABLE OF ty_cawn,         "#EC *
          i_cuv_error   TYPE STANDARD TABLE OF ty_vtnam,        "#EC *
          i_dupl        TYPE STANDARD TABLE OF ty_dupl.         "#EC *
    DATA: i_vnt_ma TYPE STANDARD TABLE OF ty_vnt_ma,            "#EC *
          i_split  TYPE STANDARD TABLE OF ty_split.             "#EC *
    DATA: i_dupl_file TYPE STANDARD TABLE OF ty_dupl.           "#EC *
    DATA: i_charval TYPE STANDARD TABLE OF ty_charval.          "#EC *
    Constants
    CONSTANTS: c_char TYPE atfor VALUE 'CHAR',                  "#EC *
               c_date TYPE atfor VALUE 'DATE',                  "#EC *
               c_time TYPE atfor VALUE 'TIME',                  "#EC *
               c_varcond TYPE atnam VALUE 'Z_VARCOND'.          "#EC *
    Field Symbols
    FIELD-SYMBOLS:  TYPE ANY.
    Variables
    DATA: g_raw(500)  TYPE c,                                   "#EC *
          g_invalid   TYPE char1,                               "#EC *
          g_error     TYPE char1,                               "#EC *
          g_message   TYPE char50,                              "#EC *
          g_slnid_c    TYPE slnid,                              "#EC *
          g_slnid_n    TYPE slnid,                              "#EC *
          g_row        TYPE char5.                              "#EC *
    DATA: g_varcond TYPE varcond, "Variant condition "#EC NEEDED
          g_split_var TYPE i.                                   "#EC *
    Types: begin of ty_charname,
             name type atnam,
           end of ty_charname.
    data: wa_charname type ty_charname,                         "#EC *
          i_charname type standard table of ty_charname.        "#EC *
    data: cnt_i type i,                                         "#EC *
          g_tabix type char10.                                  "#EC *
    Types: begin of ty_itab_zedidc40.
            include structure edi_dc40.
    TYPES:       end of ty_itab_zedidc40.
    Types: begin of ty_itab_zedidd40.
            include structure edi_dd40.
    TYPES: end of ty_itab_zedidd40.
    DATA: itab_zedidc40 type standard table of
                      ty_itab_zedidc40 initial size 0.          "#EC *
    DATA: itab_zedidd40 type standard table of
                      ty_itab_zedidd40 initial size 0.          "#EC *
    DATA: wa_itab_zedidc40 type ty_itab_zedidc40.
    DATA: wa_itab_zedidd40 type ty_itab_zedidd40.
    *MOD-009
    data: itab_ze1cuvtm type e1cuvtm,                           "#EC *
          itab_ze1datem type e1datem,                           "#EC *
          itab_ze1cuv1m type e1cuv1m.                           "#EC *
    data: wdocnum(16) type n value 0.                           "#EC *
    data: wsegnum(6)  type n value 0.                           "#EC *
    data: witemno(10) type n value 0.                           "#EC *
    data: witemno_new(10)  type n value 0.                      "#EC *
    data: witemno_gst(10)  type n value 0.                      "#EC *
    data: witemno_qst(10)  type n value 0.                      "#EC *
    TYPES: BEGIN OF ty_input_data1,                             "#EC *
              line(560) type c,
              flag(1) type c,
           END OF ty_input_data1.
    DATA: i_input_data type standard table of
                      ty_input_data1 initial size 0. "with header line.
    DATA: i_input_data1 type standard table of
                      ty_input_data1 initial size 0. "with header line.
    DATA: wa_input_data type ty_input_data1.                    "#EC *
    DATA: g_cnt_input_recs type i.                              "#EC *
    DATA: g_flg_error type c.                                   "#EC *
    DATA: l_lines type i.                                       "#EC *
    DATA: l_tabix type i.                                       "#EC *
    DATA: wa_input_data1 type ty_input_data1.                   "#EC *
    DATA: FILE TYPE STRING.
    Fields that are made available to the user:
    DATA:
      g_cnt_records_read TYPE i,                                "#EC *
      g_cnt_records_transferred TYPE i,                         "#EC *
      g_cnt_transactions_read TYPE i,                           "#EC *
      g_cnt_transactions_transferred TYPE i,                    "#EC *
      g_cnt_idocs_package TYPE i.                               "#EC *
    data: v_log_handle type balloghndl.                         "#EC *
    DATA: gt_curr_edi_dc40 TYPE STANDARD TABLE OF edi_dc40 initial size 0."#EC *
    DATA: gt_curr_edi_dd40 TYPE STANDARD TABLE OF edi_dd40 initial size 0."#EC *
    DATA: wa_curr_edi_dc40 TYPE edi_dc40.                       "#EC *
    DATA: wa_curr_edi_dd40 TYPE edi_dd40.                       "#EC *
    internal table for error messages during conversion
    DATA: g_error_tab TYPE type_errortab,                       "#EC *
          wa_errortab TYPE type_errorline.                      "#EC *
    DATA:  g_edidd_segnam type EDI4SEGNAM,                      "#EC *
           g_edidd_hlevel type EDI4HLEVEC.                      "#EC *
    DATA: g_segnum(6) TYPE n.
    DATA: g_objecttype(2) type C.
    DATA: P_FNAME(128) TYPE C VALUE '/usr/sap/trans/vartabheader'. " MODIF ID MD1 OBLIGATORY.
    DATA: P_FNAME1(128) TYPE C VALUE '/usr/sap/trans/vartabcontent'. " MODIF ID MD1 OBLIGATORY.
    DATA: alv_fldcat TYPE slis_t_fieldcat_alv,
          it_fldcat TYPE lvc_t_fcat.
    field-symbols: .
    data: dy_table type ref to data,
          dy_line  type ref to data,
          xfc type lvc_s_fcat,
          ifc type lvc_t_fcat.
    data: l_wa_data TYPE TY_CONTENT,
          itab_data TYPE standard table of TY_CONTENT.
    DECLARATION FOR SELECTION SCREEN
    *selection-screen skip 1.
    *For all the input field entries
    SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.
    *Parameter for Input File Name:
    PARAMETERS:   p_inpt   TYPE RLGRAP-FILENAME MODIF ID MOD . " Presentation server File Variant table
    PARAMETERS:   p_inpt1  TYPE RLGRAP-FILENAME MODIF ID MOD . " Presentation server File variant Content
    SELECTION-SCREEN END OF BLOCK bl1.
    IDoc creation
    selection-screen begin of block idocpars
                     with frame title text-006.
    parameters:
       p_trfcpt as checkbox default C_X MODIF ID MD3,
       p_packge(5) type n default 1 MODIF ID MD3.
    selection-screen end of block idocpars.
    SELECTION-SCREEN BEGIN OF BLOCK bl3 WITH FRAME TITLE text-032.
    Radio Buttons :
    parameters:
      rb_apsrv RADIOBUTTON GROUP RB1 DEFAULT 'X' USER-COMMAND UCOM,
      rb_convt RADIOBUTTON GROUP RB1,
      rb_idoc RADIOBUTTON GROUP RB1,
      rb_proc RADIOBUTTON GROUP RB1.
    SELECTION-SCREEN END OF BLOCK bl3.
    INITIALIZATION
    INITIALIZATION.
    Check selection-screen entries *
    *AT SELECTION-SCREEN.
    PERFORM sub_get_physical_file USING p_fpath p_fname.
    PERFORM sub_get_physical_file1 USING p_fpath1 p_fname1.
    AT SELECTION SCREEN
    *AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
    PERFORM sub_get_file. " CHANGING p_fname.         "#EC *
    *AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname1.
    PERFORM sub_get_file1. " CHANGING p_fname1.       "#EC *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_INPT.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          STATIC        = C_X
        CHANGING
          FILE_NAME     = P_INPT
        EXCEPTIONS
          MASK_TOO_LONG = 1
          OTHERS        = 2.
      IF SY-SUBRC <> 0.
        MESSAGE e241.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_INPT1.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          STATIC        = C_X
        CHANGING
          FILE_NAME     = P_INPT1
        EXCEPTIONS
          MASK_TOO_LONG = 1
          OTHERS        = 2.
      IF SY-SUBRC <> 0.
        MESSAGE e241.
      ENDIF.
    At Selection Screen Output
    AT SELECTION-SCREEN OUTPUT.
    IF rb_apsrv = 'X'.
       LOOP AT SCREEN.
         IF SCREEN-GROUP1 = c_mod.
           SCREEN-INPUT = 0.
         ENDIF.
         IF SCREEN-GROUP1 = c_md2.
           SCREEN-INPUT = 0.
         ENDIF.
         IF SCREEN-GROUP1 = c_md3.
           SCREEN-INPUT = 0.
         ENDIF.
         MODIFY SCREEN.
       ENDLOOP.
    endif.
    IF rb_apsrv = 'X'.
      LOOP AT SCREEN.
        IF SCREEN-GROUP1 = c_md1.
          SCREEN-INPUT = 0.
        ENDIF.
        IF SCREEN-GROUP1 = c_md2.
          SCREEN-INPUT = 0.
        ENDIF.
        IF SCREEN-GROUP1 = c_md3.
          SCREEN-INPUT = 0.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    endif.
    START-OF-SELECTION
    START-OF-SELECTION.
    *Subroutines for start of selection event
      PERFORM sub_start_selection.
      IF rb_apsrv = 'X'.
        PERFORM sub_upload_data_app.
        MESSAGE i256.
        LEAVE LIST-PROCESSING.
        EXIT.
      ELSE.
        PERFORM sub_upload_data.
      ENDIF.
    PERFORM sub_upload_data.
    Get characteristic details
      PERFORM sub_get_cabn.
    Get value for characteristics
      PERFORM sub_get_cawn.
      perform sub_convert_transaction.
    END-OF-SELECTION.
    END OF SELECTION
    *MOD-012
    Final message
      perform sub_final_message_idoc.
    Display errorneous variant tables.
      perform sub_display_variant.
    Display lines with incorrect data
      perform sub_display_errorlines.
    *Subroutines for end of selection event
      PERFORM sub_end_selection.
      perform sub_clear_source_tables.
    *MOD-012
    *&  Include           /FACTGLB/GTDMI_VARTAB_FORMS02                    *
    *&  Include           /FACTGLB/GTDMI_VARTAB_FORMS02                    *

  • How to pass values in dynamic structure and then dynamic table

    Hi,
    we have a Z structure in se11 holding 10 fields. But at run time i need to create a dynamic table with more than 10 records.
    I am able to create the structure and corresponding internal table. Now the issue is i have to populate this dynamic structure with some values and then append it to dynamic internal table. Since the dynamic  table type is any its not allowing an index operation like modify etc etc.
    Could anyone help me in passing the values . I have searched in SDN . everyone created a dynamic table and then populated it values from some standard or custom tables.Then assigning the component of structure  and displaying the output. but in my situation i have no such values stored in any tables. i populate values based on certain calculation.

    Hi Friends,
    This is the piece of code.After creating dynamic work area and dynamic table what i should do?
    TYPES: BEGIN OF STR,
    ID TYPE I,
    NAME(30) TYPE C,
    END OF STR.
    data: v_lines type i.
    STR_TYPE ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_NAME( 'STR' ).
    STR_COMP = STR_TYPE->GET_COMPONENTS( ).
    APPEND LINES OF STR_COMP TO COMP_TAB.
    COMP-NAME = 'NAME1'.
    COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING(  ).
    APPEND COMP TO COMP_TAB.
    COMP-NAME = 'VALUE1'.
    COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
    APPEND COMP TO COMP_TAB.
    COMP-NAME = 'NAME2'.
    COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
    APPEND COMP TO COMP_TAB.
    COMP-NAME = 'VALUE2'.
    COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
    APPEND COMP TO COMP_TAB.
    COMP-NAME = 'NAME3'.
    COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
    APPEND COMP TO COMP_TAB.
    COMP-NAME = 'VALUE3'.
    COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
    APPEND COMP TO COMP_TAB.
    NEW_STR = CL_ABAP_STRUCTDESCR=>CREATE( COMP_TAB ).
    NEW_TAB = CL_ABAP_TABLEDESCR=>CREATE(
    P_LINE_TYPE = NEW_STR
    P_TABLE_KIND = CL_ABAP_TABLEDESCR=>TABLEKIND_STD
    P_UNIQUE = ABAP_FALSE ).
    CREATE DATA DREF TYPE HANDLE NEW_TAB.
    CREATE DATA DREF1 TYPE HANDLE NEW_str.

  • Dynamic Regions and parameters - issue

    Jdev 11.1.1.6
    I have a main page that contains a dynamic region. I want to pass parameters to the region.
    Note that I have successfully created parameters for a NORMAL region inside a "parent" form. With a normal "child" region in a "parent",
    1. Open the "child" taskflow, click on the whitepace, go to overview, then paraemeters and define a parameter name and value, ex: InputParam and #{pageFlowScope.InputParam}.
    2. Open the "parent" form, click on the region, go to bindings, and edit the region. You see the parameter you specified, InputParam and you can enter a value. This value will come from the parent.
    3. Set refresh to if needed.
    However,
    With a dynamic region containing more than one "child" taskflow, I am getting an error. I do everything the same above.
    However, when I have the taskflow selected on the bindings tab of the parent form, and click on the structure window, parameter node, The ID text field is surrounded by orange, and a message displays that the reference to "InputParam" is not found.
    How are the name or id values specified for a dynamic region? How does one map a parameter from the parent to the "child"? Do you need to put this into a bean?
    Thanks,
    Stuart

    1) Parent A tasflow contains Child B taskflow.
    2) Child B expects a parameter called 'inputParameterChild'
    3) This will be defined inside the child B taskflow with 'java.lang.String' and value as '#{pageFlowScope.inputParam}'
    4) When you click the child B taskflow in parent A taskflow you will see the parameter expected by child B as 'inputParameterChild'
    5) Now you can pass the value as '#{pageFlowScope.inputParam}' , here you should have the inputParam set in the bean or in the parent taskflow as explained in step 2 and 3
    are you still facing the issue?

  • Dynamic List and Security Issue

    Hi
    I have a Dynamic List Wizard for orders, which the user can click on edit to edit or modify the order and if the user choose "Yes" to submit ( the order form has a submit filed which has Yes / No Values)then the EDIT button disappear and the user has no more control on the record(using show if conditional Region server behavior).
    - Now i noticed that when i click on the edit the address bar includes the (www.mysite.com/form.php?order_id=1) now say the order Number 2 is already submitted (still on the list but no Edit button for it) if i write 3 or 4 or any other number instead of 1 at the address bar (www.mysite.com/form.php?order_id=3) the record which has the order number 3 displays on the screen and then you can edit it and when click update the Edit Button becomes Active which destroy the whole concept.
    so, how to fix that?

    Hi Lorie,
    Taking it a step further
    interesting that you´re mentioning this -- because I was just in the middle of finding a workaround for the very same issue ;-)
    I actually did find a pretty easy solution, which basically goes like this:
    1) wrap the whole table *plus* any possibly added hidden fields located below this table in a "Show IF conditional region" behaviour -- but make sure to *not* include the buttons within the "KT_bottombuttons" div in here.
    2) as I assume that your "supplier_name" column holds a numeric value which equals the user´s "kt_login_id" Session Variable (which it should !), define the following conditions for the "Show IF conditional region" behaviour:
    Expression 1: choose "supplier_name" from the tNG recordset
    Condition: ==
    Expression 2: choose Session -> kt_login_id
    3) tick the Has ELSE option
    4) confirm with OK
    5) replace the default "has Else" message with something meaningful like "you can´t edit this record !"
    Switching to Code view and navigating to the very start of your "Show IF conditional region" should display something like this:
    if (@$row_rsqueryname['supplier_name'] == @$_SESSION['kt_login_id']) {
    When viewing the modified Dynamic Form in a browser, you´ll note that this solution will indeed display the form instances for all "authorized" records, whereas those form instances which don´t match the required credentials will be replaced with that "has else" message.
    BUT !! This solution has one major drawback which I haven´t been able to resolve yet :: when the Dynamic Form goes into Insert Record mode
    (means when you click the "add new" link in the Dynamic List), all inner form instances will display that "has else" message.
    The only workaround I currently can come up with is to have the List´s "add new" link point to a separate "add_new.php" page that´s going to insert a single record.
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Dynamic Structures and Internal Tables

    Hi All,
    I am doing a report to create condition records based on the condition type and condition table. Assume the condition type as PR00 and it as condition table of 304,305,306.Each condition table as its own header and item fields.Based on the  condition table that the user specifies in the selection screen
    the header and item structures of my report should change dynamically and these should be moved  to the dynamic internal table that contains both header and item fields.Can anyone give an idea how to achieve it. Thanks in advance.
    Regards,
    Chakradhar.

    Hi All,
    Thanks for your replies.
    SPLIT i_string_line-input_str AT cl_abap_char_utilities=>horizontal_tab
    INTO i_header_line-header
              i_header_line-vkorg
              i_header_line-vtweg                                                                              
              i_header_line-pltyp                                                                              
             i_header_line-waerk.    
    In the above syntax based on the condition table I selected on selection screen my flat file is as below.
    case 1: If condition table given is 304
    H    SalesOrganization    DistributionChannel    Customer
    I    Material    Releasestatus    Amount    Currency    ValidFrom    ValidTo
    case 2: If condition table given is 305
    H    SalesOrganization    DistributionChannel
    I    Material    Releasestatus    Amount    Currency    ValidFrom    ValidTo
    case 3: If condition table given is 306
    H    SalesOrganization    DistributionChannel     PriceListType     DocumentCurrency
    I    Material    Releasestatus    Amount    Currency    ValidFrom    ValidTo
    In the above code i_string_line-input_str contains the following heading of fields based on the condition table we select in selection screen.when I want to split them into respective fields
    using INTO clause my structure should change dynamically.How can I achieve it and my entire program is in OOPS ALV.Thanks in Advance.
    Regards,
    Chakradhar.

  • How to tell if a movie is a reference after the fact and components issue..

    Hello,
    I am unsure if a quicktime movie I made is self-contained or a reference movie. It is not playing and I was told I need components to play it (though I am not sure which ones) .... but what got me thinking is I looked at the data size in the inspector window and it says 20 gb and the file size says 2 gb. Is there a way to know if it's a ref movie or self-contained?
    This will solve my first question, and of course my next is how do I get it to play? What do I need to install? How do I know what components are needed? It was exported as a DVCPRO HD 720p60. I have quicktime Pro - I think it's version 7.
    Any help would be greatly appreciated.

    I believe that the movie is self-contained...I am seeing (in the properties window, resources tab) the original movie pointing to one .mov file and ten .mov1-10 files underneath. Does that sound self-contained?
    No, afraid not. When I said "the file will point to itself," I meant the resource will be the same as the open file's physical location on your hard drive. If it is pointing to other files with different names/locations or to a URL on the internet, then it is a reference file.
    I don't have FCP on my system. Do you know what components for QT I need to install to playback the DVCPro HD movie? Is it possible to play such a file w/out having FCP?
    Sorry my answer was so vague. QT Kirk has already "nailed" the answer for you. You have to install the FCP application. This application will install an entire set of encoding and decoding "DVCPROHD" components. Since your system does not have FCP installed, you should ask whoever provided these files to either transcode the files to AIC/AIFF for editing on a non-FCP system or export their FCP completed project to a common distribution/delivery format like H.264/AAC.

  • Home Page Structure and Components

    We are facing some performance problems with the home page of our intranet (based on SAP EP5 SP6 - Migration to EP6 is starting) and we fair that the number of objects on the home page is dramatically impacting the load time.
    We are interested to get the following informations for other companies :
    o How many objects / components are loaded on the home page ?
    o To have a printscreen of the homepage
    o To have an overview of the laoding time (average) of the homepage.
    In our situation we have about 100 objects on the homepage and the average response time is about 9 sec. I will post a printscreen soon.
    Thanks for your responses - Philippe

    Hi Philippe
    Read How to…Optimize And Fine-Tune SAP Enterprise Portal 5.0 document
    if u haven't it mail me on [email protected] i'll send it u.
    regards,
    kaushal

  • Dynamic Tree and TreeNode Issue

    I am using JSC2 (060120) on Win2K pro, exporting the WAR and running in JBoss 4.0.3 running under JDK 1.5.0_04.
    I am trying to dynamically build a tree as the user clicks on nodes and am not having success following the example at http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/sitemaptree.html
    When I attempt to add the child nodes directly to nodes via clickedNode.getChildren().add(myNewNode); I get an error as follows:
    10:17:29,260 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
    javax.faces.el.ReferenceSyntaxException: AP-1030Child.id
    at com.sun.faces.application.ApplicationImpl.checkSyntax(ApplicationImpl.java:749)
    at com.sun.faces.application.ApplicationImpl.createValueBinding(ApplicationImpl.java:291)
    The ID shown AP-1030Child.id does not exist, my to be parent node is named AP-1030 and my to be child is named AP-1030-Bottom.
    The only way I can get the Tree to build properly is to add the to be child (AP-1030-Bottom) to the Tree itself and then assign it's parent as the node (AP-1030). But, the problem I run into then is the next time the parent node (AP-1030) is clicked parent.getChildCount() or parent.getChildren().size() both evaluate to zero and I attempt to build the children for the node at which point the code blows up due to duplicate naming.
    Has anyone else experienced this? Am I doing something wrong?
    Here is the code I use to build my tree initially on the SessionBean...
    for(int i = 0; i < count; i++)
    TreeNode newNode = new TreeNode();
    newNode.setId("AP-" + pages.pageId);
    newNode.setText(pages[i].page);
    newNode.setImageURL("/resources/tree_document.gif");
    MethodBinding nodeMethodBinding = this.getApplication().createMethodBinding("#{MainPage.treeNode_action}", null);
    newNode.setAction(nodeMethodBinding);
    this.applicationPagesTree.getChildren().add(newNode);
    Here is the code I am using to add the child nodes to the clicked node...
         for(int l = 0; l < locationsCount; l++) {                               
              TreeNode locationNode = new TreeNode();
    String sectionText = "";
              (populate sectionText with Top|Left|Center|Right|Bottom based on data)
              locationNode.setText(sectionText);
              // making unique name for this object in the tree: parentname + section
    locationNode.setId(searchID + "-" + sectionText);
    locationNode.setImageURL("/resources/tree_document.gif");
              // bind to method for the page sections click
    MethodBinding nodeMethodBinding = this.getApplication().createMethodBinding("#{MainPage.locationNode_action}", null);           locationNode.setAction(nodeMethodBinding);
              // adding to the base tree object after the parent (why can I just not add to the node?)
              this.treeList.getChildren().add(insertIndex + l, locationNode);
              // this nudges the node over one, otherwise it is peer to the parent (again, why not just add to the parent?)
    locationNode.setParent(node);
    Why is it I can get the String ID from the tree and not the object? Wouldn't it make sense to give me the TreeNode instead of it's ID when calling getCookieSelectedTreeNode()? This would seem a more proper object orientated approach.
    Any help appreciated, thanks.

    Thanks,
    I have tried pretty much that exact same code and it does not work for some reason. That code is the same as the example I showed that I followed originally.
    The only way I can get it to work is as I showed. When I do the node creation and then add to the node in the tree it blows up while rendering with the message from the original post.

  • Dynamic Structure / Element building

    Hallo, I am new to Java and have some problems at building Elements and handling like passing them to some dynamic structure and letting the references be handled without losing the elements in memory.
    There are also some questions about general memory usage. I hope it gets visual at this small testclass. Maybe you can pass me throuh to some reference post at topic?
    import java.util.*;
    import javax.swing.*;
    class Testvec{
         public static void main(String args[]){
              Vector<String> ob = new Vector<String>();
    //          String string[] = new String[1000000]; @tested to add this at vector, but cant remove
              System.out.println(ob.size());
              long mem = Runtime.getRuntime().totalMemory(); //- Runtime.getRuntime().freeMemory();
              //@1 What about that here? total and free almost same value
              long time = System.nanoTime();
              System.out.println("Total Runtime Mem: "+Runtime.getRuntime().totalMemory()/Math.pow(2,20));
              System.out.println("Free Runtime Mem: "+Runtime.getRuntime().freeMemory()/Math.pow(2,20));
              JOptionPane.showInputDialog(null,"Runtime stopped");
              //@2 time to look at taskmanager, the value differs to total runtime memory @doubled
              time = System.nanoTime();
              for (int i = 0; i < 1000000; i++){
    //               string[i] = Integer.toString(i);
                   ob.add(Integer.toString(i));
              time = System.nanoTime()-time;
              mem = Runtime.getRuntime().totalMemory(); //- Runtime.getRuntime().freeMemory() - mem;
              System.out.println("Total Runtime Mem: " +Runtime.getRuntime().totalMemory()/Math.pow(2,20));
              System.out.println("Free Runtime Mem: " +Runtime.getRuntime().freeMemory()/Math.pow(2,20));
              System.out.println("Memory taken @ " mem/Math.pow(2,20) " MBytes" +"\n" +"Time nedded @ " time/Math.pow(10,9) " seconds");
              System.out.println(ob.size());
              //@QUESTION I just want to know how to remove from vector. If i put it in the building loop
              //and remove it immediately after adding, memorysize does not grow. Here like you see the last
              //element is removed, but stays in memory. How to fix it?
              //maybe I have to build the added element in another way? and not at adding but look @tested
              for (int i = 0; i < 1000000; i++){     
                   ob.remove(ob.size()-1);
    //               string[i] = null;
              System.out.println(ob.size());
              //Here I ve tried clearing at once, but does not work either that way. The vector is empty and I ve lost Strings in memory
         //     ob.removeAllElements();
         //     ob.clear();
         //     ob = null;
         // System.gc();
              JOptionPane.showMessageDialog(null,"HalloWindow");//@3 time to look at taskmanager, the value differs to total runtime
              //but not that much anymore and there is a little bytechange(seems to have some cases?) if you run sometimes again
    }

    992686 wrote:
    Hmm, sorry... the format and some bytes were lost between copy and paste.Edit your post and use the tags to format the code.
    And what does happen when I remove them while nobody holding references? If nobody has references to the objects, the garbage collector will collect them. Just putting them in an ArrayList won't lose them, the ArrayList will still have references to the objects.
    tried also to build dynamic array myself but having problems with memory managmentNo, you have no problems with memory management.
    cant get back to the amount of startup, even backwards does not work...That's because you're trying to do irrelevant things. Basically you're wasting your time.
    Maybe I should trie interface building object?No, you should learn the basics of Java by going through the tutorials.
    Have fun there.Thanks, you too!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Error is recreat the dynamic structure.

    Hi all,
    Thanks for all your help, I can finally get the dynamic structure and use that in my development. In my case, user can select many items on the list (which will geneart dynamic structure to strore the data). It works at at the first time. However, when I selecte another item again (which will genereate the same structure) error occus:
    [  LT_GERTAB-BNAME has already been declared.  ]
    What are the possible solution in this case?
    For more details:
    1. I have a report list of different structure.
    2. And there are lots of reports of different date of a report with same structure.
    After I selected the 1st case, thing goes right and after the first selection of 2nd case, it still works.
    But the second time I try to select another report of different date, error occurs.
    How can I pass through this error?

    Since it didn't clear up the previous field list, so duplicated field appears.

  • Defining Dynamic structure in Remote Function module(RFC)

    Team,
    I got a requirement, where I need to create a dynamic structure and dynamic table in the exporting tab of Function module(RFC).
    Say, I have sales request(4 fields) and sales quotation(5 fields).
    Depending on the importing parameter, If it sales request I need to export 4 fields as a structure and if in the importing parameter it is sales quotation then I need to pass 5 fields as a structure.
    Any help please??
    Thanks,
    Sai

    Hi Manu,
    Those are dummy functions.
    Check out
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/047ab790-0201-0010-a9b1-e612f8b71dcd
    (page 14)
    regards,
    Edgar

  • Create Dynamic Structure based on Field-Symbol

    Hi Experts!!
    I need to create a structure with dynamic structure included within.
    I have a parameter on sel. screen in which we provide table name.
    PARAMETERS: p_table TYPE tabname.
    FIELD-SYMBOLS: <gt_data> TYPE ANY TABLE.
    CREATE DATA gr_data TYPE TABLE OF (p_table).
    ASSIGN gr_data-* TO <gt_data>.
    Now I need a structure like below:
    TYPES: BEGIN OF type_test,
    struct TYPE <gt_data>, " dynamic structure based on table name entered on sel. screen
    fld1 TYPE c,
    fld2 TYPE n,
    END OF type_test.
    Can somebody suggest how to achieve this?
    Your help is highly appreciated. Thanks a lot

    You can view this thread where our friend Marcin rocks .. Dynamically create a type
    FIELD-SYMBOLS: <gt_data> TYPE ANY TABLE.
    FIELD-SYMBOLS: <gs_wa> TYPE ANY.
    data:wf_ref type ref to data.
    DATA:i_comp TYPE cl_abap_structdescr=>component_table,
         i_tot_comp TYPE cl_abap_structdescr=>component_table.
    CREATE DATA gr_data TYPE TABLE OF (p_table).
    ASSIGN gr_data-* TO <gt_data>.
    create data wf_ref like line of <gt_data>.
    assign wf_ref->* to <gs_wa>.
    *--Getting Compoents from existing type
      lf_struct ?= cl_abap_typedescr=>describe_by_name( '<GS_WA>' ).
      i_comp = lf_struct->get_components( ).
      APPEND LINES OF i_comp TO i_tot_comp.
    The idea is Get all the field details available it to i_tot_comp, then append individual fields manually to
    i_tot_comp as explained in the link and create a dynamic structure and table.

  • Generate Dynamic Structure

    Hi All,
         Can anyone tell me how to generate a reference to the structure dynamically without using statement
          1) GENERATE SUB-ROUTINE POOL and
          2) passing the referebce to field-symbol
          My structure fields are present in an internal table(with some other fields as well)
           Eg: Internal table contains Field1,field2......upto Field 10.
          But i need the reference to the structure only for Field1,Field /5/6/7 only.
           How to do this??
    Thanks,
    Madan

    Hi Mohan,
    You can create it many ways.
    1. If you have the structure name..
      create data l_dref type standard table of (v_table).
      assign l_dref->*   to <i_master>. " Internal table
      create data l_dwa  like line of <i_master>.
      assign l_dwa->*    to <wa_master>. " Work area
    2. If you don't have particular structure name. Fields properties are known
    Populate fields catalog
      data: l_wa_fcat    type lvc_s_fcat.
      l_wa_fcat-fieldname = p_field.
      l_wa_fcat-datatype  = 'CHAR'.
      l_wa_fcat-inttype   = 'C'.
      l_wa_fcat-intlen    = p_len.
      append l_wa_fcat to i_fcat.
      call method cl_alv_table_create=>create_dynamic_table
        exporting
          it_fieldcatalog = i_fcat
        importing
          ep_table        = dy_table.
      assign dy_table->* to <i_itab>.   " Interanal table
      create data dy_line like line of <i_itab>.
      assign dy_line->* to <wa_itab>.
    3. If any think you don't know unless run time (like length, type etc) Then use RTTS method
    l_gs_comp-type ?= cl_abap_typedescr=>describe_by_data( v_mode ). " here v_mode is a variable and I want to add same field in the structure
      l_gs_comp-name  = l_field. " Structure Field name
      append l_gs_comp to l_gt_components.
    Create instances of dynamic structure and dynamic internal table
      l_go_sdescr_new  = cl_abap_structdescr=>create( l_gt_components ). " ref Stucture
      l_go_tdescr      = cl_abap_tabledescr=>create( l_go_sdescr_new ).       " Ref Itab
    Create data refence followed by table creation
      create data l_gdo_handle type handle l_go_tdescr.
      assign l_gdo_handle->* to <i_deep>.     " Itab
      create data dy_deep like line of <i_deep>.
      assign dy_deep->* to <wa_deep>.   " WA
    Thanks
    Subhankar

  • Dynamic Structure creation and assigning data.

    Hi,
    I have a structure and a work area,
    DATA: begin of sample_struct,
          elem1 type xxx,
          elem2 type yyy,
          elem3 type zzz,
          end of sample_struct.
    DATA: wa_sample_struct type sample_struct.
    DATA: lr_rtti_struc TYPE REF TO cl_abap_structdescr.
    DATA: lt_comp       TYPE cl_abap_structdescr=>component_table.
    DATA: ls_comp       LIKE LINE OF lt_comp.
    DATA: l_index       TYPE string.
    DATA: lr_data       TYPE REF TO data.
    DATA: lr_table      TYPE REF TO
    I create a new structure at run time extending the sample_struct to add few more components at run time like this.
    lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data(wa_sample_struct).
        lt_comp = lr_rtti_struc->get_components( ).
    do 10 times.
          l_index = sy-index
          concatename 'element' l_index into ls_comp-name
          ls_comp-type = cl_abap_elemdescr=>get_string( ).
          APPEND ls_comp TO lt_comp.
    enddo.
    Then i create a work area of this new structure like this.
    lr_rtti_struc = cl_abap_structdescr=>create( p_components = lt_comp ).
        CREATE DATA lr_data TYPE HANDLE lr_rtti_struc.
        ASSIGN lr_data->* TO <fs_data>.
    Now <fs_data> is a work area for the structure.
    I can move the data in wa_sample_struct into <fs_data> like this.
    move-corresponding wa_sample_struct to <fs_data>.
    My problem is how do i access the dynamic components of this work area so that i can assign data to those components.
    If anybody knows how to access the dynamically added components of <fs_data> so that I can assgin data to those.
    Thanks in advance
    Sesh
    Message was edited by: Seshatalpasai Madala

    Hi,
          Looks like the problem is not well stated as I am getting answers which are not relevent.
    My existing structure.
    DATA: begin of sample_struct,
    elem1 type xxx,
    elem2 type yyy,
    elem3 type zzz,
    end of sample_struct.
    I create a new structure using this structure at runtime by adding new fields which are in a internal table. I add the new fields as follows.
    loop at it_tab into wa_tab.
    ls_comp-name = wa_tab.
    ls_comp-type = cl_abap_elemdescr=>get_string( ).
    APPEND ls_comp TO lt_comp.
    endloop.
    This internal table is built using the user input. So I dont know how many and what are the values in the internal table.
    LT_COMP has the existing structure field's as well as the newly added fields for my new structure.
    I create a new structure using this component list LT_COMP.
    DATA: lr_rtti_struc TYPE REF TO cl_abap_structdescr.
    lr_rtti_struc = cl_abap_structdescr=>create( p_components = lt_comp ).
    Now I have an object of cl_abap_structdescr. Which I can use as a data type for defining Workarea and internal table of this structure like this.
    CREATE DATA lr_data TYPE HANDLE lr_rtti_struc.
    ASSIGN lr_data->* TO <fs_data>.
    I can access all the existing fields of the strucutre like this.
    <fs_data>-elem1
    <fs_data>-elem2
    My problem is how do i access the newly added fields of the strucutre as I dont know the names of the fileds(I know them only at runtime).
    I hope I have explained it well enough, hope to see a relevent answer for the above problem.
    Thanks in advance.
    Sesh

Maybe you are looking for

  • Can't paste a password in Remote Desktop?

    I'm on OS X 10.9.5 trying to use RemoteApp in Remote Desktop to connect to remote.ie. I use pretty long passwords, managed with 1Password.  It seems like the password field in the app has copy and paste disabled, so I have to read and type them in.  

  • Creating PDF's with Central Pro Output Server for AS400 (iseries)

    Today we generate spool files on the AS400 (iSeries)using Central Pro Output Server on the AS400. The user now wants to create the spool files as PDF's and then email them as attachments with a password to open them. Can this be done ?

  • 9.0.2 9.0.2.6 upgrade

    Anybody try the 9.0.2 > 9.0.2.6 upgrade? Care to tell what was involved, how it went, and were you happy with the end results? I'm curious because we have a two-tier Win2K 9.0.2 architecture in production and no development servers in which to test t

  • Apple Wireless Keyboard and annoyance with fn and backspace key

    Hi everybody, Just took delivery of this beautiful Apple Wireless Keyboard but having only one problem with it. I've figured out how in System Preferences/Keyboard & Mouse/Keyboard it's possible to check the box which allows the F1, F2, etc. keys as

  • Receive and ERROR when trying to launch Premiere Elements 11

    Out of the Blue, I am suddenly unable to open Priemere Elements 11, the organizer works fine, but if I slect NEW Project from the welcome screen I get the following errors: A dialog box named "Premiere Elements Debug Event" with the message of "Premi