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                    *

Similar Messages

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

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

  • User include structure and routines/program/user exits

    Hello Gurus,
         following is the step for modify the field catalog in material determination .
    Modify the field catalog (OV26)
    1.     Add the new field to the user include structure:
    o     Header data KOMKDZ
    o     Item data KOMPDZ.
    2.     Add coding to the routines for assigning values to the new fields in order processing in program MV45AFZA. Use user exits:
    o     USEREXIT_MOVE_FIELD_TO_KOMKD (header fields)
    o     USEREXIT_MOVE_FIELD_TO_KOMPD (item fields)
    3.     Add the new field to the field catalog (Customizing activity Basic Functions &#61614; Material Determination &#61614; Maintain prerequisites for material determination &#61614; Maintain field catalog).
    Will you please tell me what the step 1 and step 2 mean ?  and what 's the user include structure and USEREXIT_MOVE_FIELD_TO_KOMKD/USEREXIT_MOVE_FIELD_TO_KOMPD and program MV45AFZA ?
    thanks very much!

    Hi,
    KOMKD is cummunication header and KOMPD is communication item which are actually contained in KOMGD structure. So automatically when you add a field to either of header or item it becomes a part of KOMGD. And moreover KOMGD contains all the fields of KOMKD and KOMPD which are required for materail determination.
    USEREXIT_MOVE_FIELD_TO_KOMKD
    Use this user exit to include or assign values to additional header fields in the communication structure KOMKD taken as a basis for the material determination. This is described in detail in the section "New fields for material determination" .
    USEREXIT_MOVE_FIELD_TO_KOMPD
    Use this user exit to include or assign values to additional item fields in the communication structure KOMPD taken as a basis for the material determination. This is described in detail in the section "New fields for material determination ".
    regards
    sadhu kishore

  • How to dynamically call and order program modules

    Hey guys,
    I have ‘x’ pieces of code (x could be 10’s or 100’s of modules).
    I need to be able to dynamically call and run ‘y’ of them, but I need to be able to do it in parallel, and some of them might be in order.
    For instance ‘A’, ‘B’ and ‘C’ need to run in parallel,
    but 'D' needs data from 'A' and will run after 'A',
    and 'E' needs to run after ‘D’,
    and ‘F’ needs data from 'C' and will to run after ‘C’
    So I have two questions.
    How should I organize and order these dynamic calls?
    and What method should I use to pass data along from one VI to another?

    jcyth wrote:
    [...]But when you thought of Teststand, did you have a specific feature of Teststand that you thought it would be a viable solution?
    Since we will probably have the end user choose the modules required in this module operation, having a premade sequence editor might be nice
    My point mentioning TestStand is that my feeling tells me that you are going to re-implement some very basic functions which are already included in TestStand.
    To be honest: TestStand adds additional costs. You have to purchase licenses, you should get some training which takes time until getting payed off.
    But on the other hand: You also need time to implement and test your self-made approach. Also: Does this project grow in the future? Do you need additional features in the (near) future?
    Going into this will result in a break even in costs where you can say: if i take more time in my self-made approach, it is cheaper to go for TestStand right from the beginning.
    TestStand is designed to be VERY flexible. But you have to get familiar to this flexibiity in order to get where you want. Therefore, i recommend you to collect some information before making the decision. Maybe you want to invite some sales guy from NI in order to present TestStand to you....
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

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

  • NX6600 GT issues with DVI LCD and component HDTV dualview

    Hello -
    I am having some issues with my video card now that I am hooking my monitor up with a DVI cable. The VGA cable worked perfectly with the HDTV but I bought a KVM switch that is DVI only and have been told that DVI is much beter. So, the problem is that the card now identifies my LCD as monitor number 2 and my HDTV as number 1. I can change which is my primary monitor and it seems as though nothing happens. Since I use dualview th8is is a major problem because my start menu is still on the HDTV which is not on all the time. I don't know what the issue is because as soon as I hook it up with VGA there are no problems. It's annoying because I know how quirky KVM switches can be and this one is working perfectly except for this problem.
    Details:
    HDTV is hooked up with component out
    LCD is through DVI
    NX6600GT driver version 7.1.2.2
    Linkskey LDV-212ASK KVM switch
    Thanks for any help!

    I was hoping not to do this but I understand the simplicity of your suggestion.
    It just makes me regret spending the extra amount on the DVI KVM switch.

  • Extract Structure and its program

    Hi Experts,
    Is it possible to know what program/function module is used by datasource extract structure to get the data?
    In my case i need to know this information regarding the extract structure HRMS_BIW_IO_OCCUPANCY (0EMPLOYEE_ATTR).
    Thanks in advance.
    Fabio

    Since a lot of time ago (the last time I met him) he lent 10 euros to me, I was just remembering that I'm still in debt to him !
    (but I'm thinking now that our answer can be evaluated around 10 euros, so...)

  • 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

  • ALV report with dynamic columns, and repeated structure rows

    Hey Guys,
    I've done some ALV programming, but most of the reports were straight forward. This one is a little interesting. So here go the questions...
    Q1: Regarding Columns:
    What is the best way to code a report with columns being dynamic. This is one of the parameters the user is going to enter in his input.
    Q2: Regarding Rows:
    I want to repeat a structure(say it contains f1, f2, f3) multiple time in rows. What is the best way to do it? The labels for these fields have to appear in the first column.
    Below is the visual representation of the questions.
    Jan 06  , Feb 06, Mar 06....(dynamic)
       material 1
    Current Stock
    current required
    $Value of stock
       material 2
    Current Stock
    current required
    $Value of stock
       material 3
    Current Stock
    current required
    $Value of stock
    Thanks for your help.
    Sumit.

    Hi Sumit,
    Just check this sample from one of the SAP site
    ABAP Code Sample for Dynamic Table for ALV with Cell Coloring
    Applies To:
    ABAP / ALV Grid
    Article Summary
    ABAP Code Sample that uses dynamic programming techniques to build a dynamic internal table for display in an ALV Grid with Cell Coloring.
    Code Sample
    REPORT zcdf_dynamic_table.
    * Dynamic ALV Grid with Cell Coloring.
    * Build a field catalog dynamically and provide the ability to color
    * the cells.
    * To test, copy this code to any program name and create screen 100
    * as described in the comments. After the screen is displayed, hit
    * enter to exit the screen.
    * Tested in 4.6C and 6.20
    * Charles Folwell - [email protected] - Feb 2, 2005
    DATA:
    r_dyn_table TYPE REF TO data,
    r_wa_dyn_table TYPE REF TO data,
    r_dock_ctnr TYPE REF TO cl_gui_docking_container,
    r_alv_grid TYPE REF TO cl_gui_alv_grid,
    t_fieldcat1 TYPE lvc_t_fcat, "with cell color
    t_fieldcat2 TYPE lvc_t_fcat, "without cell color
    wa_fieldcat LIKE LINE OF t_fieldcat1,
    wa_cellcolors TYPE LINE OF lvc_t_scol,
    wa_is_layout TYPE lvc_s_layo.
    FIELD-SYMBOLS:
    <t_dyn_table> TYPE STANDARD TABLE,
    <wa_dyn_table> TYPE ANY,
    <t_cellcolors> TYPE lvc_t_scol,
    <w_field> TYPE ANY.
    START-OF-SELECTION.
    * Build field catalog based on your criteria.
    wa_fieldcat-fieldname = 'FIELD1'.
    wa_fieldcat-inttype = 'C'.
    wa_fieldcat-outputlen = '10'.
    wa_fieldcat-coltext = 'My Field 1'.
    wa_fieldcat-seltext = wa_fieldcat-coltext.
    APPEND wa_fieldcat TO t_fieldcat1.
    wa_fieldcat-fieldname = 'FIELD2'.
    wa_fieldcat-inttype = 'C'.
    wa_fieldcat-outputlen = '10'.
    wa_fieldcat-coltext = 'My Field 2'.
    wa_fieldcat-seltext = wa_fieldcat-coltext.
    APPEND wa_fieldcat TO t_fieldcat1.
    * Before adding cell color table, save fieldcatalog to pass
    * to ALV call. The ALV call needs a fieldcatalog without
    * the internal table for cell coloring.
    t_fieldcat2[] = t_fieldcat1[].
    * Add cell color table.
    * CALENDAR_TYPE is a structure in the dictionary with a
    * field called COLTAB of type LVC_T_SCOL. You can use
    * any structure and field that has the type LVC_T_SCOL.
    wa_fieldcat-fieldname = 'T_CELLCOLORS'.
    wa_fieldcat-ref_field = 'COLTAB'.
    wa_fieldcat-ref_table = 'CALENDAR_TYPE'.
    APPEND wa_fieldcat TO t_fieldcat1.
    * Create dynamic table including the internal table
    * for cell coloring.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = t_fieldcat1
    IMPORTING
    ep_table = r_dyn_table
    EXCEPTIONS
    generate_subpool_dir_full = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    * Get access to new table using field symbol.
    ASSIGN r_dyn_table->* TO <t_dyn_table>.
    * Create work area for new table.
    CREATE DATA r_wa_dyn_table LIKE LINE OF <t_dyn_table>.
    * Get access to new work area using field symbol.
    ASSIGN r_wa_dyn_table->* TO <wa_dyn_table>.
    * Get data into table from somewhere. Field names are
    * known at this point because field catalog is already
    * built. Read field names from the field catalog or use
    * COMPONENT <number> in a DO loop to access the fields. A
    * simpler hard coded approach is used here.
    ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'ABC'.
    ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'XYZ'.
    APPEND <wa_dyn_table> TO <t_dyn_table>.
    ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'TUV'.
    ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'DEF'.
    APPEND <wa_dyn_table> TO <t_dyn_table>.
    * Color cells based on your criteria. In this example, a test on
    * FIELD2 is used to decide on color.
    LOOP AT <t_dyn_table> INTO <wa_dyn_table>.
    ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    * Get access to internal table used to color cells.
    ASSIGN COMPONENT 'T_CELLCOLORS'
    OF STRUCTURE <wa_dyn_table> TO <t_cellcolors>.
    CLEAR wa_cellcolors.
    wa_cellcolors-fname = 'FIELD2'.
    IF <w_field> = 'DEF'.
    wa_cellcolors-color-col = '7'.
    ELSE.
    wa_cellcolors-color-col = '5'.
    ENDIF.
    APPEND wa_cellcolors TO <t_cellcolors>.
    MODIFY <t_dyn_table> FROM <wa_dyn_table>.
    ENDLOOP.
    * Display screen. Define screen 100 as empty, with next screen
    * set to 0 and flow logic of:
    * PROCESS BEFORE OUTPUT.
    * MODULE initialization.
    * PROCESS AFTER INPUT.
    CALL SCREEN 100.
    * MODULE initialization OUTPUT
    MODULE initialization OUTPUT.
    * Set up for ALV display.
    IF r_dock_ctnr IS INITIAL.
    CREATE OBJECT r_dock_ctnr
    EXPORTING
    side = cl_gui_docking_container=>dock_at_left
    ratio = '90'.
    CREATE OBJECT r_alv_grid
    EXPORTING i_parent = r_dock_ctnr.
    * Set ALV controls for cell coloring table.
    wa_is_layout-ctab_fname = 'T_CELLCOLORS'.
    * Display.
    CALL METHOD r_alv_grid->set_table_for_first_display
    EXPORTING
    is_layout = wa_is_layout
    CHANGING
    it_outtab = <t_dyn_table>
    it_fieldcatalog = t_fieldcat2.
    ELSE. "grid already prepared
    * Refresh display.
    CALL METHOD r_alv_grid->refresh_table_display
    EXPORTING
    i_soft_refresh = ' '
    EXCEPTIONS
    finished = 1
    OTHERS = 2.
    ENDIF.
    ENDMODULE. " initialization OUTPUT
    Regards
    vijay

  • Fields missing in MPD report after change to structure and program

    I have been working on a consistency report for transaction MPD.
    I had created a structure in SE11 for handling the data.  it was all working, but then i had to go and change the name of the fields in the structure.  Now those fields are missing from the report. 
    When i step through the debugger, all the fields are being populated correctly, but these fields are not displayed on screen.  if i change the field names back in the structure and change the code for populating these fields, they appear okay.
    i have created a custom implementation within BAdi MPD_WKB_REPORTING. 
    i have checked the config and it all points to my Z Structure and Z Table Type.  I have logged off and logged back on!  made sure my code is saved and activated...
    any ideas on how i can display these new fields names/values?
    Just for clarity, the field name has changed. not the linked data type.

    thanks for your response, however those notes and program have not done anything to assist my issue.
    i have found the anwser now!
    within the BAdi was a method i had to amend:  IF_EX_MPD_WKB_REPORTING~GET_ALV_PARAMETERS 
    all fixed now!

Maybe you are looking for

  • RFWT0010 withholding tax type and tax code change in vendor master problem

    Hi Due to some reasons I need to change the withholding tax type and tax code in vendor master. When i am running the report RFWT010,After changing the tax type and tax code in vendor master...the list contains no items. eventhough there are 14 line

  • How can i get my icloud calendar appointments to appear in the outlook to-do bar?

    I find the upcoming appointments in Outlook's To-Do Bar really useful but since synching with icloud they are no longer there. I know this is an ongoing issue and wondered if there was any up-to-date information on how to resolve it?

  • License key question

    I will be adding a viewing license key to our PROD server which is for 2 processors.  The sever actually has 4 processors.  Will this cause any problems during installation?  Will BOSE use just 2 processors of the 4?  Or do we need a 4 processor lice

  • Questions about system requirements w/FCE4  (AVCHD/Intel)

    As you can see I have a Power PC Dual G5. I also have a JVC GZ-HD7 HD Everio camcorder. Im pretty dumb when it comes to this AVCHD. Can anyone tell me if this is the format my camcorder uses all the time or just when using the SD storage? Secondly, i

  • HP Pavilion G6 -1150SD - No audio output device is installed

    Hi I am sanjay. Now staying in Netherlands. i have a HP Pavilion G6 -1150SD laptop. Operating system is Window 7. Now i am facing problem like "No audio output device is installed". This problem i faced while uninstalling some software. May be i unin