Dynamic Structures as Part of a Language
Hi,
I hope I've got the right group for this! I've been a professional software engineer for about 8 years, and I've always tried to concentrate on design principles. I've written a few compilers and a simple VM, and partially designed a new language, and after a while I began to have a few ideas about stuff.
One of the things a came to realise was that I think it is possible to design anything in terms of dynamic data structures (for example, tree-like structures) using only a vector, set, and map.
To me, these three items provide a full complement of tools needed to build most (if not all) dynamic structures. I think they are so important, that they are almost fundamental to a modern language.
Now, clearly there are some situations where it may be more useful to use a linked-list, or I'm sure there are some other specialist data structures that we could think of to solve particular problems, but I think that in 99% of design cases these types will suffice, and infact they have for me, in my experience.
My idea was to actually make these data structures part of the language, just like arrays, say. A possible notation/syntax might look something like this:
Declarations:
{int} m_mySet;
[int] m_myVector;
[int->String] m_myMap;
Simple usage:
int i = m_myVector[j];
m_myVector += 3; // Add to the end.
m_myVector += m_myVector; // Concatenate.
String s = m_myMap;
boolean b = m_mySet.contains(i);
There is also a little inheritance hierarchy:
A vector is a set.
A map is a set.
A [int->T] map is a vector (where T is some type).
So you could have:
boolean contains({int} is, int i)
return is.contains(i);
...and then do...
[int] is = {1,2,3};
boolean b = contains(is,1);
...fairly obviously.
You could also intermix types easily, so you could add map elements to a set with just:
{int} sis;
[String->int] mis;
sis += mis;
There could be VM instructions/optimisations for all operations associated with these three structures.
Obviously there is a lot more design work that needs to be put in, but the principles of what I'm talking about are the use of these three structures as fundamental parts of the language.
For those who have used functional languages, I'm sure you'll see some similarities in these ideas.
Any comments/suggestions?
Si.
I took the ethernet cable from imac into wan port of Time Capsule
That is not correct. Connect the Ethernet cable from your Imac to a LAN <-> port on the Time Capsule.
There is no need to switch off your router. Turning it off will mess up the network and it will NOT speed up the process. You want a green light on the Time Capsule before you attempt to back up. So, configure the Time Capsule the way that it was before.
Simply turn off the wireless on the iMac and connect the Ethernet cable directly from your iMac to a LAN <-> port on the Time Capsule. When the backup is done, you can disconnect the Ethernet cable, and turn the wireless back on for the iMac.
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 SELECTIHi,
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.
-
Dynamic structure names in cfloop
I have designed a web application that allows users to enter
a number of records on one form – for example computer
skills. The user can add up to 20 different computer skills.
On another form, the user’s recorded computer skills
are shown as a number of dynamic checkboxes. One computer skill
means the user sees one checkbox. Twenty computer skills means the
user sees 20 checkboxes. I have made a query loop to output these
computer skills and checkboxes. I have also made structure
variables so that the selection of the specific computer skill
checkbox is retained for later use in the web application. If the
user checks any of the checkboxes, on submission of the form, the
structure value is updated from no to yes (and vice versa). This
part is working, and I am happy with it.
The problem I have is that I am unable to find a way to
individually indicate that the specific checkbox value is checked
or not. If the user selects the checkbox, submits the form and
returns to the form, the checkbox should still show as ticked as
the structure value of that checkbox is “yes” (as in
checked=”yes”). As I am using structures, adding
#currentRow# to the structure name inside the loop does not work,
as CF views this as a different structure name that is not
recognised. For example:
<cfloop query=”rsReturnComputerSkills
<cfinput type=”checkbox”
name=”computerSkill#currentRow#”
checked=”#structure.computerSkill##currentRow#”
</cfloop>
Essentially, I cannot place the dynamic structure value into
the checkbox input field.
I thought that using an array may overcome this, but alas I
encounter the same problem.
Is there a way to append #currentRow# to the structure name
or is there another way to achieve the same that I have not thought
of?Just list server gossip (so take with a large grain of salt).
But some
well regarded members have done simple timing tests and taken
a look at
the Java byte code generated. Evaluate() seems to be pretty
trim in the
latest versions of CFMX.
But I still try to avoid it, because while it may or may not
slow down
execution, it definitely can slow down development if you do
anything
more complicated then concatenate a simple string and a
variable.
Kevin Schmidt wrote:
> Interesting. Do you have the info on that Ian. As far as
I know, at least in the latest Advanced CF Course, Adobe/MM was
still saying that evaluate() brought with it a performance
degradation. -
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 PMHi,
The program works fine fo creating inbound idocs. It is the dynamic structure population that seems to be the problem mentioned earlier: Here is the code:
*& Report /FACTGLB/GTDMI_VARTAB_IDOCS02 *
PROGRAM DESCRIPTION: Variant Table and Content Upload Interface.
DEVELOPER: Aveek Ghose
CREATION DATE: 2008-04-18
RDD NUMBER: DCDD027
TRANSPORT NUMBER(S): RD2K902769
*-- REVISION HISTORY -
DEVELOPER:
DATE APPLIED: YYYY-MM-DD
SCR NUMBER: <Scope Change Request ID>
RDD NUMBER: <Toolset Object ID>
TRANSPORT NUMBER(S):
DESCRIPTION:
REPORT ZGTDMI_VARTAB_IDOCS_DYNAMIC
NO STANDARD PAGE HEADING
LINE-SIZE 150
LINE-COUNT 55
MESSAGE-ID zfactglb.
**Include for Global Data Declaration
*INCLUDE /FACTGLB/GTDMI_VARTAB_TOP02.
**Include for Selection Screen
*INCLUDE /FACTGLB/GTDMI_VARTAB_SEL02.
**Include for Sub Routines
*INCLUDE /FACTGLB/GTDMI_VARTAB_FORMS02.
*& Include /FACTGLB/GTDMI_VARTAB_TOP02 *
*& Include /FACTGLB/GTDMI_VARTAB_TOP02 *
*& Include /FACTGLB/GTDMI_VARTAB_TOP
*& Include /FACTGLB/GTDMI_VARTAB_TOP
PROGRAM DESCRIPTION: Variant Table and Content Upload Interface.
DEVELOPER: Aveek Ghose
CREATION DATE: 2008-04-18
RDD NUMBER: DCDD027
TRANSPORT NUMBER(S): RD2K902769
*-- REVISION HISTORY -
DEVELOPER:
DATE APPLIED: YYYY-MM-DD
SCR NUMBER: <Scope Change Request ID>
RDD NUMBER: <Toolset Object ID>
TRANSPORT NUMBER(S):
DESCRIPTION:
TYPE POOLS
*Type declaration for ALV display
TYPE-POOLS : slis.
Include .
type-pools: col, "#EC *
icon, "#EC *
sym, "#EC *
abap. "#EC *
Target structure definitions
tables:
E1CUVTM, "#EC *
E1DATEM, "#EC *
E1CUV1M, "#EC *
edp21, "#EC *
edi_dc40, "#EC *
edi_dd40, "#EC *
edi_ds40. "#EC *
GLOBAL TYPES
TYPES : BEGIN OF ty_vartab.
include structure E1CUVTM.
TYPES: END OF ty_vartab.
TYPES : BEGIN OF ty_vartabdate.
INCLUDE STRUCTURE E1DATEM.
TYPES : END OF ty_vartabdate.
*Structure for data retreived
TYPES : BEGIN OF ty_vardetails.
INCLUDE STRUCTURE E1CUV1M.
TYPES : END OF ty_vardetails.
*Structure for data retreived from table tabinput.
TYPES : BEGIN OF ty_tabinput,
lines type string,
END OF ty_tabinput.
*Structure for data retreived from Table dsn_input.
TYPES : BEGIN OF ty_dsninput, "#EC *
LINE(101) type c,
END OF ty_dsninput.
*Structure for data retreived from Table dsn_input.
TYPES : BEGIN OF ty_newinput, "#EC *
LINE(101) type c,
flag(1) type c,
END OF ty_newinput.
*Structure for keeping the values of all the custom tables
TYPES : BEGIN OF ty_custom_tabs,
matnr TYPE matnr, "Material Number
werks TYPE werks_d, "Plant
lgort TYPE lgort_d, "Storage Location
qunty TYPE P DECIMALS 2, "Standard Order Quantity
det_loc TYPE CHAR6, "Detail Location
class TYPE CHAR2, "Class
rate TYPE P DECIMALS 2, "Rate
END OF ty_custom_tabs.
*Type declared for the internal table and work area which will store
*fields for error log
TYPES : BEGIN OF ty_error_log,
matnr TYPE matnr, "Material Number
mtart TYPE mtart, "Material Type
sel_data TYPE char10, "No of selectyed data
END OF ty_error_log.
*Structure for keeping the output data
TYPES : BEGIN OF ty_final,
VTNAM(018) type C,
CHAR1(030) type C,
CHAR2(030) type C,
CHAR3(030) type C,
CHAR4(030) type C,
CHAR5(030) type C,
CHAR6(030) type C,
CHAR7(030) type C,
CHAR8(030) type C,
CHAR9(030) type C,
CHAR10(030) type C,
CHAR11(030) type C,
CHAR12(030) type C,
CHAR13(030) type C,
CHAR14(030) type C,
CHAR15(030) type C,
FLAG(001) type C,
END OF ty_final.
TYPES: begin of TY_CONTENTHD,
VTNAM(018) type C,
FLAG(001) type C,
end of TY_CONTENTHD.
TYPES: begin of TY_CONTENT,
VTNAM(018) type C,
CHAR1(030) type C,
CHAR2(030) type C,
CHAR3(030) type C,
CHAR4(030) type C,
CHAR5(030) type C,
CHAR6(030) type C,
CHAR7(030) type C,
CHAR8(030) type C,
CHAR9(030) type C,
CHAR10(030) type C,
CHAR11(030) type C,
CHAR12(030) type C,
CHAR13(030) type C,
CHAR14(030) type C,
CHAR15(030) type C,
FLAG(001) type C.
TYPES: end of TY_CONTENT.
TYPES: BEGIN OF TY_E1CUVTM,
MSGFN TYPE MSGFN,
VAR_TAB TYPE APITABL,
STATUS TYPE RCUTBST,
VTGROUP TYPE RCUTBGR,
AUTHSTRUC TYPE RCUTBBE,
AUTHENTRY TYPE RCUFNBI,
FLDELETE TYPE FLLKENZ,
DBTABNAME TYPE TABNAME16,
DBCONACTIVE TYPE DBCON_ACTI,
PRESDEC TYPE VTDCT,
END OF TY_E1CUVTM.
TYPES: BEGIN OF TY_E1CUV1M,
MSGFN TYPE MSGFN,
VTLINENO TYPE VTLINENO,
VTCHARACT TYPE ATNAM,
ATWRT TYPE ATWRT,
ATFLV TYPE ATFLV,
ATAWE TYPE MSEHI,
ATFLB TYPE ATFLB,
ATAW1 TYPE MSEHI,
ATCOD TYPE ATCOD,
ATTLV TYPE ATTLV,
ATTLB TYPE ATTLB,
ATPRZ TYPE ATPRZ,
ATINC TYPE ATINC,
VTLINENO5 TYPE VTLINENO5,
END OF TY_E1CUV1M.
TYPES: BEGIN OF TY_E1DATEM,
MSGFN TYPE MSGFN,
KEY_DATE TYPE SYDATUM,
AENNR TYPE AENNR,
EFFECTIVITY TYPE CC_MTEFF,
END OF TY_E1DATEM.
TYPES: BEGIN OF ty_vtnam,
vtint TYPE vtint, " Internal number of variant table
vtnam TYPE vtnam, " Name of variant table
error TYPE char1, " Indicates error in data format
reas TYPE char50, " Reason for failure
END OF ty_vtnam.
Get data type for characteristic
TYPES: BEGIN OF ty_cabn,
atinn TYPE atinn, "Internal characteristic
atnam TYPE atnam, "Characteristic Name
atfor TYPE atfor, "Data type of characteristic
atson TYPE atson, "Indicator: Additional Values
atprt TYPE atprt, "Check table
atprr TYPE atprr, "Name of Check Report Program
atprf TYPE atprf, "Function Module for Checking Values
anzdz TYPE anzdz, "Number of Decimal Places
check TYPE char1, "Indicates check required or not
END OF ty_cabn.
Get field names of variant table
TYPES: BEGIN OF ty_cuvtab_fld,
vtint TYPE vtint, " Internal number of variant table
atinn TYPE atinn, " Internal characteristic
vtpos TYPE vtpos, " Item number of characteristic in variant
exist TYPE char1, " X Indictaes characteristic is part of fil
END OF ty_cuvtab_fld.
Store all data in internal table
TYPES: BEGIN OF ty_file,
vtnam TYPE vtnam,
char1 TYPE atwrt,
char2 TYPE atwrt,
char3 TYPE atwrt,
char4 TYPE atwrt,
char5 TYPE atwrt,
char6 TYPE atwrt,
char7 TYPE atwrt,
char8 TYPE atwrt,
char9 TYPE atwrt,
char10 TYPE atwrt,
char11 TYPE atwrt,
char12 TYPE atwrt,
char13 TYPE atwrt,
char14 TYPE atwrt,
char15 TYPE atwrt,
flag TYPE char1,
error TYPE char50,
END OF ty_file.
To check for duplicates
TYPES: BEGIN OF ty_dupl,
vtnam TYPE vtnam,
char1 TYPE atwrt,
char2 TYPE atwrt,
char3 TYPE atwrt,
char4 TYPE atwrt,
char5 TYPE atwrt,
char6 TYPE atwrt,
char7 TYPE atwrt,
char8 TYPE atwrt,
char9 TYPE atwrt,
char10 TYPE atwrt,
char11 TYPE atwrt,
char12 TYPE atwrt,
char13 TYPE atwrt,
char14 TYPE atwrt,
char15 TYPE atwrt,
slnid TYPE slnid,
END OF ty_dupl.
Get previously loaded characteristic values for internal table (CHAR)
TYPES: BEGIN OF ty_cuvtab_valc,
vtint TYPE vtint, " Internal number of variant table
slnid TYPE slnid, " Key for value combination in variant tab
atinn TYPE atinn, " Internal characteristic
valc TYPE atwrt, " Characteristic Value
END OF ty_cuvtab_valc.
Get previously loaded characteristic values for internal table (NUM)
TYPES: BEGIN OF ty_cuvtab_valn,
vtint TYPE vtint, " Internal number of variant table
slnid TYPE slnid, " Key for value combination in variant tab
atinn TYPE atinn, " Internal characteristic
val_from TYPE atflv, " Internal floating point from
END OF ty_cuvtab_valn.
Store column positions of characteristics
TYPES: BEGIN OF ty_col_pos,
vtint TYPE vtint, " Internal number of variant table
vtnam TYPE vtnam, " Variant table name
atinn TYPE atinn, "Internal characteristic
atnam TYPE atnam, "Characteristic Name
field TYPE fieldname, "Field name
req TYPE char1, " Required or not
vtpos TYPE vtpos, " Item number of characteristics
END OF ty_col_pos.
Store valid values for characteristics
TYPES: BEGIN OF ty_cawn,
atinn TYPE atinn, " Internal characteristic
atzhl TYPE atzhl, " Int counter
atwrt TYPE atwrt, " Characteristic Value
atflv TYPE atflv, " Internal floating point from
lkenz TYPE lkenz, " Deletion indicator
END OF ty_cawn.
Store error messages for individual lines
TYPES: BEGIN OF ty_error,
vtnam TYPE vtnam, " Variant table name
fname TYPE fieldname, " Fieldname
atnam TYPE atnam, " Characteristic name
atwrt TYPE atwrt, " Characteristic value
row TYPE char5, " Row id
END OF ty_error.
Begin TPR# 4618
To store unique number for variant
TYPES: BEGIN OF ty_vnt_ma,
vtnam TYPE vtnam,
unique_no TYPE ZGTDM_UNQN,
no_chr TYPE ZGTDM_NO_CHR,
END OF ty_vnt_ma.
To find out concatenated number for
TYPES: BEGIN OF ty_split,
f1 TYPE char6,
END OF ty_split.
TYPES: BEGIN OF ty_charval,
char TYPE char30,
END OF ty_charval.
TYPES: BEGIN OF TY_DATA,
name TYPE string,
value(15) type c,
END OF TY_DATA.
DATA: I_DATATAB TYPE STANDARD TABLE OF TY_DATA.
TYPES:
TUMLS_MESSTYPE type /SAPDMC/LS_MESSTYPE,
TUMLS_MESSTYPETXT type EDI_TEXT60,
TUMLS_MESSCODE type EDIPMESCOD.
TYPES:
TUMLS_TABNAME TYPE TABNAME, "#EC *
TUMLS_SEGMENT TYPE TABNAME. "#EC *
TYPES:
TUMLS_PATHFILE TYPE /SAPDMC/LS_FILENAME,
TUMLS_FILENAME TYPE /SAPDMC/LS_FILENAME,
TUMLS_FILETEXT TYPE /SAPDMC/LS_FILETEXT.
TYPES:
BEGIN OF type_errorline,
msgty type SYMSGTY,
id type SYMSGID,
msgno type symsgno,
par1 type symsgv,
par2 type symsgv,
par3 type symsgv,
par4 type symsgv,
END OF type_errorline.
TYPES:
type_errortab TYPE SORTED TABLE
OF type_errorline
WITH NON-UNIQUE KEY id msgno par1 par2 par3 par4.
DATA:
LV_INDEX TYPE SY-INDEX,
LV_INDEX2 TYPE SYINDEX,
LV_TABLE1 TYPE REF TO DATA,
LV_TABLE2 TYPE REF TO DATA,
LV_TABLE3 TYPE REF TO DATA,
LV_TABLE4 TYPE REF TO DATA,
LV_LINE1 TYPE REF TO DATA,
LV_LINE2 TYPE REF TO DATA,
LV_LINE3 TYPE REF TO DATA,
LV_LINE4 TYPE REF TO DATA,
LV_OFFSET1 TYPE SYTABIX,
ST_IS_LAYOUT_ALV TYPE SLIS_LAYOUT_ALV,
L_IT_FCATLOG_ALV TYPE SLIS_T_FIELDCAT_ALV,
L_IT_FLDCAT TYPE LVC_T_FCAT.
GLOBAL INTERNAL TABLES
DATA : i_newinput TYPE STANDARD TABLE OF ty_newinput INITIAL SIZE 0."#EC *
DATA : i_contentheader1 TYPE STANDARD TABLE OF ty_contenthd INITIAL SIZE 0."#EC *
DATA : i_contenttab1 TYPE STANDARD TABLE OF ty_content INITIAL SIZE 0."#EC *
DATA : i_contenttab2 TYPE STANDARD TABLE OF ty_content INITIAL SIZE 0."#EC *
DATA : i_contenttab3 TYPE STANDARD TABLE OF ty_content INITIAL SIZE 0."#EC *
DATA : i_contenttab4 TYPE STANDARD TABLE OF ty_content INITIAL SIZE 0."#EC *
DATA : i_E1CUV1M TYPE STANDARD TABLE OF E1CUV1M INITIAL SIZE 0."#EC *
DATA : i_errortab TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0."#EC *
GLOBAL WORK AREAS
**Internal Table for the structure TY_T001L
DATA : wa_vartab TYPE ty_vartab. "#EC *
DATA : wa_vartabdate TYPE ty_vartabdate. "#EC *
DATA : wa_vardetails TYPE ty_vardetails. "#EC *
DATA : wa_tabinput TYPE ty_tabinput. "#EC *
DATA : wa_dsninput TYPE ty_dsninput. "#EC *
DATA : wa_newinput TYPE ty_newinput. "#EC *
DATA : wa_gnewinput TYPE ty_newinput. "#EC *
DATA : wa_ginput_data TYPE ty_newinput. "#EC *
DATA : wa_final TYPE ty_final. "#EC *
DATA : wa_content TYPE ty_content. "#EC *
DATA : wa_contenthd TYPE ty_contenthd. "#EC *
DATA : wa_contentheader type ty_contenthd. "#EC *
DATA : wa_contenttab TYPE ty_content. "#EC *
DATA : wa_content1 TYPE ty_content. "#EC *
DATA : wa_contenthd1 TYPE ty_contenthd. "#EC *
DATA : wa_contentheader1 type ty_contenthd. "#EC *
DATA : wa_contenttab1 TYPE ty_content. "#EC *
DATA : wa_contenttab2 TYPE ty_content. "#EC *'
DATA : wa_contenttab3 TYPE ty_content. "#EC *
DATA : wa_contenttab4 TYPE ty_content. "#EC *
DATA : wa_E1CUVTM TYPE E1CUVTM. "#EC *
DATA : wa_E1CUV1M TYPE E1CUV1M. "#EC *
DATA : wa_E1DATEM TYPE E1DATEM. "#EC *
DATA : wa_error_tab TYPE solisti1. "#EC *
INTERNAL TABLES AND WORK AREAS FOR BDC
*Internal Table to store the data to display the error message
DATA : i_errormsg TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0."#EC *
*Internal Table to store the data to display the error message
DATA : i_error TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0."#EC *
DATA : itab_error TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0."#EC *
**Work area to store the data to display the error message
DATA : wa_errormsg TYPE solisti1. "#EC *
**Internal table which will store data for the error log
DATA:i_error_log TYPE STANDARD TABLE OF ty_error_log INITIAL SIZE 0."#EC *
GLOBAL VARIABLES
DATA: G_FILE TYPE string. "#EC *
DATA : g_ctr_input_recs(5) type c. "#EC *
DATA: g_ctr_output_recs(5) type p. "#EC *
data : g_msg(100) type c. "#EC *
data: g_struct_file TYPE string. "#EC *
data: g_login type FILEINTERN. "#EC *
data: g_phyin type string. "#EC *
DATA: g_lprnt type RSPOPSHORT. "#EC *
DATA: g_FNAME1 TYPE STRING. "#EC *
DATA : g_repid TYPE repid, "#EC *
g_exit(1) TYPE C, "#EC *
gx_variant type disvariant. "#EC *
DATA : g_lines TYPE i . "#EC *
data : g_save(1) type c. "#EC *
DATA : g_splid TYPE rspoid . "#EC *
data: p_login type FILEINTERN. "#EC *
data: p_phyin type string. "#EC *
DATA:
go_table TYPE REF TO cl_salv_table,
go_sdescr TYPE REF TO cl_abap_structdescr,
go_tdescr TYPE REF TO cl_abap_tabledescr,
gdo_data TYPE REF TO data,
gdo_handle TYPE REF TO data,
gs_comp TYPE abap_componentdescr,
gt_components TYPE abap_component_tab.
FIELD-SYMBOLS:
TYPE table.
GLOBAL CONSTANTS
CONSTANTS c_msgar TYPE rslgarea VALUE 'F8'. "#EC *
CONSTANTS c_msgid TYPE rslgsubid VALUE 'E'. "#EC *
CONSTANTS c_urgnc TYPE char04 VALUE 'HIGH'. "#EC *
CONSTANTS C_X(1) TYPE C VALUE 'X'. "#EC *
CONSTANTS C_Y(1) TYPE C VALUE 'Y'. "#EC *
CONSTANTS C_Z(1) TYPE C VALUE 'Z'. "#EC *
CONSTANTS C_E(1) TYPE C VALUE 'E'. "#EC *
CONSTANTS C_SAP(3) TYPE C VALUE 'SAP'. "#EC *
CONSTANTS C_MOD(3) TYPE C VALUE 'MOD'. "#EC *
CONSTANTS C_MD1(3) TYPE C VALUE 'MD1'. "#EC *
CONSTANTS C_MD2(3) TYPE C VALUE 'MD2'. "#EC *
CONSTANTS C_MD3(3) TYPE C VALUE 'MD3'. "#EC *
constants: c_000001(6) type c value '000001', "#EC *
c_e1cuv1m(7) type c value 'E1CUV1M', "#EC *
c_02(2) type c value '02', "#EC *
c_009(3) type c value '009', "#EC *
c_0001(4) type c value '0001'. "#EC *
constants: c_e1datem(7) type c value 'E1DATEM'. "#EC *
constants: c_e1cuvtm(7) type c value 'E1CUVTM'. "#EC *
GLOBAL INTERNAL TABLES FOR ALV DISPLAY
*Internal tables for ALV Field cat
DATA :
i_fieldcat_ov TYPE STANDARD TABLE OF slis_fieldcat_alv INITIAL SIZE 0,"#EC *
i_fieldcat_dtl TYPE STANDARD TABLE OF slis_fieldcat_alv INITIAL SIZE 0,"#EC *
i_fieldcat_ov1 TYPE lvc_t_fcat, "#EC *
i_events TYPE slis_t_event. "#EC *
GLOBAL WORK AREAS FOR ALV DISPLAY
*Work area for ALV Field layout
DATA : wa_layout TYPE slis_layout_alv. "#EC *
*Work area for Field Cat. Table
DATA : wa_fieldcat TYPE slis_fieldcat_alv. "#EC *
GLOBAL VARIABLES FOR ALV DISPLAY
DATA : g_event TYPE slis_t_event. "#EC *
DATA : g_top_of_page TYPE slis_t_listheader. "#EC *
DATA : g_ok_code TYPE char4. "#EC *
DATA : g_variant type disvariant. "#EC *
GLOBAL CONSTANTS FOR ALV DISPLAY
BAL handling
data: iv_log_handle type BALLOGHNDL. "#EC *
data: is_log_header type bal_s_log. "#EC *
data: iv_object type bal_s_log-object value 'CAPI'. "#EC *
data: iv_subobject type bal_s_log-subobject value 'CAPI_LOG'."#EC *
data: iv_tcode type bal_s_log-altcode value 'SE38'. "#EC *
*MOD-005
RANGES:
R_MESTYP FOR EDIDC-MESTYP, "#EC *
R_CREDAT FOR EDIDC-CREDAT, "#EC *
R_CRETIM FOR EDIDC-CRETIM, "#EC *
R_SNDPRT FOR EDIDC-SNDPRT, "#EC *
R_SNDPRN FOR EDIDC-SNDPRN. "#EC *
DATA:
L_MESSTYPE TYPE TUMLS_MESSTYPE. "#EC *
*MOD-005
data: p_sndprn TYPE EDI_SNDPRN, "#EC *
p_sndprt TYPE EDI_SNDPRT, "#EC *
p_sndpor TYPE EDI_SNDPOR. "#EC *
data: p_rcvprn TYPE EDI_RCVPRN, "#EC *
p_rcvprt TYPE EDI_RCVPRT, "#EC *
p_rcvpor TYPE EDI_RCVPOR. "#EC *
data:
init_E1CUVTM type E1CUVTM, "#EC *
prev_E1CUVTM type E1CUVTM, "#EC *
init_E1DATEM type E1DATEM, "#EC *
prev_E1DATEM type E1DATEM, "#EC *
init_E1CUV1M type E1CUV1M, "#EC *
prev_E1CUV1M type E1CUV1M. "#EC *
Source structure definitions
data:
begin of LSMW_TAB_CONTENT, "#EC *
VTNAM(018) type C,
CHAR1(030) type C,
CHAR2(030) type C,
CHAR3(030) type C,
CHAR4(030) type C,
CHAR5(030) type C,
CHAR6(030) type C,
CHAR7(030) type C,
CHAR8(030) type C,
CHAR9(030) type C,
CHAR10(030) type C,
CHAR11(030) type C,
CHAR12(030) type C,
CHAR13(030) type C,
CHAR14(030) type C,
CHAR15(030) type C,
FLAG(001) type C,
end of LSMW_TAB_CONTENT.
Counters
data:
g_cnt_VAR_TAB type i, "#EC *
g_cnt_TAB_CONTENT type i. "#EC *
Counter ct_xxxxxxxxxx: number of transferred records
data:
ct_edi_dc40 type i, "#EC *
cs_edi_dc40 type i, "#EC *
ct_E1CUVTM type i, "#EC *
cs_E1CUVTM type i, "#EC *
ct_E1DATEM type i, "#EC *
cs_E1DATEM type i, "#EC *
ct_E1CUV1M type i, "#EC *
cs_E1CUV1M type i. "#EC *
Global data definitions and data declarations
DATA: wa_cabn TYPE ty_cabn,
wa_cawn TYPE ty_cawn,
wa_file TYPE ty_file,
wa_vtnam TYPE ty_vtnam,
wa_cuvtab_fld TYPE ty_cuvtab_fld,
wa_cuvtab_valn TYPE ty_cuvtab_valn,
wa_cuvtab_valc TYPE ty_cuvtab_valc,
wa_col_pos TYPE ty_col_pos,
wa_error TYPE ty_error,
wa_dupl TYPE ty_dupl,
wa_dupl_file TYPE ty_dupl.
DATA: wa_vnt_ma TYPE ty_vnt_ma,
wa_split TYPE ty_split.
DATA: wa_charval TYPE ty_charval. "#EC *
Internal table
DATA: i_cabn TYPE STANDARD TABLE OF ty_cabn, "#EC *
i_cabn_temp TYPE STANDARD TABLE OF ty_cabn, "#EC *
i_cabn_atinn TYPE STANDARD TABLE OF ty_cabn, "#EC *
i_file TYPE STANDARD TABLE OF ty_file, "#EC *
i_file_tmp TYPE STANDARD TABLE OF ty_file, "#EC *
i_vtnam TYPE STANDARD TABLE OF ty_vtnam, "#EC *
i_cuvtab TYPE STANDARD TABLE OF ty_vtnam, "#EC *
i_cuvtab_fld TYPE STANDARD TABLE OF ty_cuvtab_fld, "#EC *
i_cuvtab_valn TYPE STANDARD TABLE OF ty_cuvtab_valn, "#EC *
i_cuvtab_valc TYPE STANDARD TABLE OF ty_cuvtab_valc, "#EC *
i_col_pos TYPE STANDARD TABLE OF ty_col_pos, "#EC *
i_cawn TYPE STANDARD TABLE OF ty_cawn, "#EC *
i_cawn_n TYPE STANDARD TABLE OF ty_cawn, "#EC *
i_cawn_c TYPE STANDARD TABLE OF ty_cawn, "#EC *
i_cawn_i TYPE STANDARD TABLE OF ty_cawn, "#EC *
i_cuv_error TYPE STANDARD TABLE OF ty_vtnam, "#EC *
i_dupl TYPE STANDARD TABLE OF ty_dupl. "#EC *
DATA: i_vnt_ma TYPE STANDARD TABLE OF ty_vnt_ma, "#EC *
i_split TYPE STANDARD TABLE OF ty_split. "#EC *
DATA: i_dupl_file TYPE STANDARD TABLE OF ty_dupl. "#EC *
DATA: i_charval TYPE STANDARD TABLE OF ty_charval. "#EC *
Constants
CONSTANTS: c_char TYPE atfor VALUE 'CHAR', "#EC *
c_date TYPE atfor VALUE 'DATE', "#EC *
c_time TYPE atfor VALUE 'TIME', "#EC *
c_varcond TYPE atnam VALUE 'Z_VARCOND'. "#EC *
Field Symbols
FIELD-SYMBOLS: TYPE ANY.
Variables
DATA: g_raw(500) TYPE c, "#EC *
g_invalid TYPE char1, "#EC *
g_error TYPE char1, "#EC *
g_message TYPE char50, "#EC *
g_slnid_c TYPE slnid, "#EC *
g_slnid_n TYPE slnid, "#EC *
g_row TYPE char5. "#EC *
DATA: g_varcond TYPE varcond, "Variant condition "#EC NEEDED
g_split_var TYPE i. "#EC *
Types: begin of ty_charname,
name type atnam,
end of ty_charname.
data: wa_charname type ty_charname, "#EC *
i_charname type standard table of ty_charname. "#EC *
data: cnt_i type i, "#EC *
g_tabix type char10. "#EC *
Types: begin of ty_itab_zedidc40.
include structure edi_dc40.
TYPES: end of ty_itab_zedidc40.
Types: begin of ty_itab_zedidd40.
include structure edi_dd40.
TYPES: end of ty_itab_zedidd40.
DATA: itab_zedidc40 type standard table of
ty_itab_zedidc40 initial size 0. "#EC *
DATA: itab_zedidd40 type standard table of
ty_itab_zedidd40 initial size 0. "#EC *
DATA: wa_itab_zedidc40 type ty_itab_zedidc40.
DATA: wa_itab_zedidd40 type ty_itab_zedidd40.
*MOD-009
data: itab_ze1cuvtm type e1cuvtm, "#EC *
itab_ze1datem type e1datem, "#EC *
itab_ze1cuv1m type e1cuv1m. "#EC *
data: wdocnum(16) type n value 0. "#EC *
data: wsegnum(6) type n value 0. "#EC *
data: witemno(10) type n value 0. "#EC *
data: witemno_new(10) type n value 0. "#EC *
data: witemno_gst(10) type n value 0. "#EC *
data: witemno_qst(10) type n value 0. "#EC *
TYPES: BEGIN OF ty_input_data1, "#EC *
line(560) type c,
flag(1) type c,
END OF ty_input_data1.
DATA: i_input_data type standard table of
ty_input_data1 initial size 0. "with header line.
DATA: i_input_data1 type standard table of
ty_input_data1 initial size 0. "with header line.
DATA: wa_input_data type ty_input_data1. "#EC *
DATA: g_cnt_input_recs type i. "#EC *
DATA: g_flg_error type c. "#EC *
DATA: l_lines type i. "#EC *
DATA: l_tabix type i. "#EC *
DATA: wa_input_data1 type ty_input_data1. "#EC *
DATA: FILE TYPE STRING.
Fields that are made available to the user:
DATA:
g_cnt_records_read TYPE i, "#EC *
g_cnt_records_transferred TYPE i, "#EC *
g_cnt_transactions_read TYPE i, "#EC *
g_cnt_transactions_transferred TYPE i, "#EC *
g_cnt_idocs_package TYPE i. "#EC *
data: v_log_handle type balloghndl. "#EC *
DATA: gt_curr_edi_dc40 TYPE STANDARD TABLE OF edi_dc40 initial size 0."#EC *
DATA: gt_curr_edi_dd40 TYPE STANDARD TABLE OF edi_dd40 initial size 0."#EC *
DATA: wa_curr_edi_dc40 TYPE edi_dc40. "#EC *
DATA: wa_curr_edi_dd40 TYPE edi_dd40. "#EC *
internal table for error messages during conversion
DATA: g_error_tab TYPE type_errortab, "#EC *
wa_errortab TYPE type_errorline. "#EC *
DATA: g_edidd_segnam type EDI4SEGNAM, "#EC *
g_edidd_hlevel type EDI4HLEVEC. "#EC *
DATA: g_segnum(6) TYPE n.
DATA: g_objecttype(2) type C.
DATA: P_FNAME(128) TYPE C VALUE '/usr/sap/trans/vartabheader'. " MODIF ID MD1 OBLIGATORY.
DATA: P_FNAME1(128) TYPE C VALUE '/usr/sap/trans/vartabcontent'. " MODIF ID MD1 OBLIGATORY.
DATA: alv_fldcat TYPE slis_t_fieldcat_alv,
it_fldcat TYPE lvc_t_fcat.
field-symbols: .
data: dy_table type ref to data,
dy_line type ref to data,
xfc type lvc_s_fcat,
ifc type lvc_t_fcat.
data: l_wa_data TYPE TY_CONTENT,
itab_data TYPE standard table of TY_CONTENT.
DECLARATION FOR SELECTION SCREEN
*selection-screen skip 1.
*For all the input field entries
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.
*Parameter for Input File Name:
PARAMETERS: p_inpt TYPE RLGRAP-FILENAME MODIF ID MOD . " Presentation server File Variant table
PARAMETERS: p_inpt1 TYPE RLGRAP-FILENAME MODIF ID MOD . " Presentation server File variant Content
SELECTION-SCREEN END OF BLOCK bl1.
IDoc creation
selection-screen begin of block idocpars
with frame title text-006.
parameters:
p_trfcpt as checkbox default C_X MODIF ID MD3,
p_packge(5) type n default 1 MODIF ID MD3.
selection-screen end of block idocpars.
SELECTION-SCREEN BEGIN OF BLOCK bl3 WITH FRAME TITLE text-032.
Radio Buttons :
parameters:
rb_apsrv RADIOBUTTON GROUP RB1 DEFAULT 'X' USER-COMMAND UCOM,
rb_convt RADIOBUTTON GROUP RB1,
rb_idoc RADIOBUTTON GROUP RB1,
rb_proc RADIOBUTTON GROUP RB1.
SELECTION-SCREEN END OF BLOCK bl3.
INITIALIZATION
INITIALIZATION.
Check selection-screen entries *
*AT SELECTION-SCREEN.
PERFORM sub_get_physical_file USING p_fpath p_fname.
PERFORM sub_get_physical_file1 USING p_fpath1 p_fname1.
AT SELECTION SCREEN
*AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
PERFORM sub_get_file. " CHANGING p_fname. "#EC *
*AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname1.
PERFORM sub_get_file1. " CHANGING p_fname1. "#EC *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_INPT.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
STATIC = C_X
CHANGING
FILE_NAME = P_INPT
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE e241.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_INPT1.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
STATIC = C_X
CHANGING
FILE_NAME = P_INPT1
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE e241.
ENDIF.
At Selection Screen Output
AT SELECTION-SCREEN OUTPUT.
IF rb_apsrv = 'X'.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = c_mod.
SCREEN-INPUT = 0.
ENDIF.
IF SCREEN-GROUP1 = c_md2.
SCREEN-INPUT = 0.
ENDIF.
IF SCREEN-GROUP1 = c_md3.
SCREEN-INPUT = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
endif.
IF rb_apsrv = 'X'.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = c_md1.
SCREEN-INPUT = 0.
ENDIF.
IF SCREEN-GROUP1 = c_md2.
SCREEN-INPUT = 0.
ENDIF.
IF SCREEN-GROUP1 = c_md3.
SCREEN-INPUT = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
endif.
START-OF-SELECTION
START-OF-SELECTION.
*Subroutines for start of selection event
PERFORM sub_start_selection.
IF rb_apsrv = 'X'.
PERFORM sub_upload_data_app.
MESSAGE i256.
LEAVE LIST-PROCESSING.
EXIT.
ELSE.
PERFORM sub_upload_data.
ENDIF.
PERFORM sub_upload_data.
Get characteristic details
PERFORM sub_get_cabn.
Get value for characteristics
PERFORM sub_get_cawn.
perform sub_convert_transaction.
END-OF-SELECTION.
END OF SELECTION
*MOD-012
Final message
perform sub_final_message_idoc.
Display errorneous variant tables.
perform sub_display_variant.
Display lines with incorrect data
perform sub_display_errorlines.
*Subroutines for end of selection event
PERFORM sub_end_selection.
perform sub_clear_source_tables.
*MOD-012
*& Include /FACTGLB/GTDMI_VARTAB_FORMS02 *
*& Include /FACTGLB/GTDMI_VARTAB_FORMS02 * -
How to pass values in dynamic structure and then dynamic table
Hi,
we have a Z structure in se11 holding 10 fields. But at run time i need to create a dynamic table with more than 10 records.
I am able to create the structure and corresponding internal table. Now the issue is i have to populate this dynamic structure with some values and then append it to dynamic internal table. Since the dynamic table type is any its not allowing an index operation like modify etc etc.
Could anyone help me in passing the values . I have searched in SDN . everyone created a dynamic table and then populated it values from some standard or custom tables.Then assigning the component of structure and displaying the output. but in my situation i have no such values stored in any tables. i populate values based on certain calculation.Hi Friends,
This is the piece of code.After creating dynamic work area and dynamic table what i should do?
TYPES: BEGIN OF STR,
ID TYPE I,
NAME(30) TYPE C,
END OF STR.
data: v_lines type i.
STR_TYPE ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_NAME( 'STR' ).
STR_COMP = STR_TYPE->GET_COMPONENTS( ).
APPEND LINES OF STR_COMP TO COMP_TAB.
COMP-NAME = 'NAME1'.
COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
APPEND COMP TO COMP_TAB.
COMP-NAME = 'VALUE1'.
COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
APPEND COMP TO COMP_TAB.
COMP-NAME = 'NAME2'.
COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
APPEND COMP TO COMP_TAB.
COMP-NAME = 'VALUE2'.
COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
APPEND COMP TO COMP_TAB.
COMP-NAME = 'NAME3'.
COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
APPEND COMP TO COMP_TAB.
COMP-NAME = 'VALUE3'.
COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
APPEND COMP TO COMP_TAB.
NEW_STR = CL_ABAP_STRUCTDESCR=>CREATE( COMP_TAB ).
NEW_TAB = CL_ABAP_TABLEDESCR=>CREATE(
P_LINE_TYPE = NEW_STR
P_TABLE_KIND = CL_ABAP_TABLEDESCR=>TABLEKIND_STD
P_UNIQUE = ABAP_FALSE ).
CREATE DATA DREF TYPE HANDLE NEW_TAB.
CREATE DATA DREF1 TYPE HANDLE NEW_str. -
Hi all,
in a scenario I'm working on at the moment, I get a flat file in and have to send a XML. Up to this point there is no problem, but the second line of the file conains the field list with a delimiter and the other lines the data with the same delimiter and every field of the field list has to become a tag within the target structure. So I have to create the output XML dynamically.
In the first step I use the file content conversion to convert the file into a simple structure like this:
<file>
<recordset>
<data>
<row>...the data...</row>
</data>
</recordset>
</file>
The target structure is similar, but within the row tag I must have the data of the row structured as described in the second row of the flat file.
I have created a mapping with a user-defined, that creates a String with the content for each row element (concatenation of the xml tags and the content), but this doesn't work, because after the mapping the < and > are replaces with the replace strings.
Perhaps anyone has an idea?
Thanks in advanced
Regards
Ollihi,
>>>>Perhaps anyone has an idea?
you have 2 possible choices:
1. do it with message mapping and convert the replace
strings in the adapter (adapter module)
2. do the mapping in java mapping or abap mapping
when you can define dynamic structures
I'd propose the second way but in both you have to write
some code in order to do those dynamic structures
Regards,
michal
<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions">XI FAQ - Frequently Asked Questions</a> -
Dynamic structure on source side
Hi SDners,
i have a req that to pull the data frm 10 sap tables depend and dump it to file ,depending on input data will come frm table dynamically frm ECC side.is it possible that we can make our source structure dynamically depending on input data coming frm ECC side...........
RegardsHi Gangadhar ,
One approach --->
At XI end use a simple structure with only one field.
At ECC end you can use proxy and in Proxy code you can put the logic to fetch the data . and finally pass it to the single field of Interface . Later on handle the data at XI end as per your requirement .
It was just a suggestion, though dynamic structure seems to be a challenging though not sure.
Regards , -
Dynamic structure creating based on the input parameter
Hi all,
How to create a dynamic structure based on the input parameter given in the selection screen. I have a file path given and it contains three fields in common, but after that depending upon the input given the fields get changed. For example, i have 0002 infotype given in the selection screen, my file path structure should contain pernr begda endda and PS0002 structure, if the infotype is changed the PS structure has to be changed dynamcially.
Thank you,
Usha.Ans
-
Dynamic structure handling in PI
Hi All,
Here is the detailed description of the issue I am facing in PI for dynamically handling receiver structure change.
Sender : GIS (Through Web Service)
Receiver: SAP ( ABAP Proxy )
Interface : Synch
Equipment and Functional Location will be sent from GIS through Web service. PI will pass the these two fields to SAP through proxy which in turn calls the BAPI. This BAPI returns the hierarchy of functional and sub functional locations.
Please find the XML below as an example:
<SapAssets>
<FunctionLocation id="fnloc1" name="Substation1" GISGlobalID="589534tgdf222" GisFeatureName="" SAPObjectid="">
<FunctionLocation id="fnloc2" name="Substation2" GISGlobalID = "45896211ithsdvb" GisFeatureName="" SAPObjectid="">
<Equipment id="eq1" GISGlobalID = "270DA616-4E5D-459F-AD21-3B65EBF32EE1" name="Transformer" GisFeatureName="UIXELE.SDE.T_Transformer" SAPObjectid="10000539"></Equipment>
<Equipment id="eq2" GISGlobalID = "1238923789512ED" name="Tower2" GisFeatureName="" SAPObjectid=""></Equipment>
</FunctionLocation>
<FunctionLocation id="fnloc3" name="Substation3" GISGlobalID="" GisFeatureName="" SAPObjectid="" >
<Equipment id="eq3" GISGlobalID = "270DA616-4E5D-459F-AD21-3B65EBF32EE1" name="Transformer" GisFeatureName="UIXELE.SDE.T_Transformer" SAPObjectid="10000539"></Equipment>
<FunctionLocation id="fnloc4" name="Substation3" GISGlobalID="" GisFeatureName="" SAPObjectid="" >
<Equipment id="eq4" GISGlobalID = "270DA616-4E5D-459F-AD21-3B65EBF32EE1" name="Transformer" GisFeatureName="UIXELE.SDE.T_Transformer" SAPObjectid="10000539"></Equipment>
</FunctionLocation>
</FunctionLocation>
<FunctionLocation id="fnloc5" name="Substation3" GISGlobalID="" GisFeatureName="" SAPObjectid="" > </FunctionLocation>
<Equipment id="eq5" GISGlobalID = "270DA616-4E5D-459F-AD21-3B65EBF32EE1" name="Transformer" GisFeatureName="UIXELE.SDE.T_Transformer" SAPObjectid="10000539"></Equipment>
</FunctionLocation>
</SapAssets>
The above updated structure, is representing below mentioned hierarchy
FnLoc1 u2026u2026u2026Parent Functional Location which GIS sends as input to SAP PI,
It has 3 FL (fnloc2, fnloc3, fnloc5) and 1equipment u2013 eq5 installed
_____ Fnloc2 u2026u2026 Fnloc2 has 2 installed equipments (eq1 and eq2)
_______ eq1
_______ eq2
|______ Fnloc3 u2026u2026 Fnloc3 has 1 equipment (eq3) and 1 FL (fnloc4) installed
| |________ eq3
| |________ fnloc4u2026Fnloc4 has 1 equipments (eq4) installed
| |______ eq4
|________ Fnloc5 u2026u2026 Fnloc5 has no equipments installed
|________ eq5
But every time the hierarchy may change as in the the position of nodes and sub-nodes can change. For e.g. instead of 3 sub-functional locations there can be 2 and each can further have its own FLs.
So basically the hierarchy or the XML structure is not fixed and it may vary based on input from GIS.
As per my knowledge we need to create data types for receiver based on some structure. Can anybody please suggest how this dynamic structure change can be handled in PI?
Regards,
AparnaHi Aparna,
you could create a data type with optinal, repeatable fields:
SapAssets
|-FunctionLocation: 0-unbounded
...|-Equipment: 0-unbounded
...|-FunctionLocation: 0-unbounded
......|-Equipment: 0-unbounded
......|-FunctionLocation: 0-unbounded
Regards,
Udo -
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,
SaiHi 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 internal table with dynamic structure
I have an internal table itab1 that have 12 amount fields from period1 thru period12. I need to create a dynamic table with dynamic structure for the period column if the total amount of each column is > 0. Any idea on how to do that?
For example if my itab1 has 20 rows and the sum of period1 = 35, sum of period2 = 0, sum of period3 = 5, sum of period4 =0, sum of period5 = 2 then I need to create a dynamic structure for the field column that have the total > 0, i.e structure struct1 have field period1, period3 and period5 only. Then I will need to load the data to itab2 from itab1. Can someone help.
Thanks. I am on 4.7 and will upgrade to ERP 6.0 soon.go throgh this....
REPORT yusmm_text1 NO STANDARD PAGE HEADING
LINE-SIZE 199.
T A B L E S
TABLES: MARA,
MAKT,
THEAD.
GLOBAL TYPE-POOLS
TYPE-POOLS : SLIS.
GLOBAL TYPES
TYPES : BEGIN OF TP_FINAL,
MATNR TYPE MARA-MATNR,
BEGRU TYPE MARA-BEGRU,
MTART TYPE MARA-MTART,
MAKTX TYPE MAKT-MAKTX,
SPRAS TYPE MAKT-SPRAS,
LTXT(2000) TYPE C ,
SRNO TYPE N ,
END OF TP_FINAL.
TYPES : BEGIN OF TP_T002,
SPRAS TYPE T002-SPRAS,
LAISO TYPE T002-LAISO,
SRNO TYPE N ,
END OF TP_T002.
TYPES : BEGIN OF TP_MARA_MAKT,
MATNR TYPE MARA-MATNR,
BEGRU TYPE MARA-BEGRU,
MTART TYPE MARA-MTART,
SPRAS TYPE MAKT-SPRAS,
MAKTX TYPE MAKT-MAKTX,
END OF TP_MARA_MAKT.
Types: BEGIN OF tp_matnr,
matnr TYPE mara-matnr,
END OF tp_matnr.
GLOBAL ELEMENTARY VARIABLES
DATA : gv_date TYPE sy-datum.
DATA : gv_repid TYPE sy-repid.
DATA : g_var1(10) TYPE C.
DATA : gv_index TYPE sy-tabix.
DATA: gv_strg TYPE string,
gv_strg1(2000) TYPE C.
DATA : gv_lang TYPE sy-langu.
DATA : g_v(3) TYPE N .
DATA : gv_lines(3) TYPE N .
DATA : gv_var(3) TYPE N .
DATA : gv_var1(3) TYPE N.
DATA: gv_str TYPE STRING.
DATA: gv_str1 TYPE STRING.
DATA : gv_li TYPE I,
gv_lit TYPE I,
gv_lin TYPE I.
DATA: g_var11(3) TYPE N,
gv_li1(3) TYPE N,
g_var2(3) TYPE N.
DATA : gv_i1 TYPE I.
DATA : gv_i TYPE I.
DATA: gl_lenght TYPE I.
GLOBAL STRUCTURES
DATA: T_NEWTABLE TYPE REF TO DATA,
T_NEWLINE TYPE REF TO DATA,
T_FLDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
T_FLDCAT TYPE LVC_T_FCAT,
WA_IT_FLDCAT TYPE LVC_S_FCAT,
WA_IT_FLDCAT1 TYPE SLIS_FIELDCAT_ALV,
WA_COLNO(2) TYPE N,
WA_FLNAME(5) TYPE C,
L_LT TYPE SLIS_LAYOUT_ALV.
GLOBAL INTERNAL TABLES (WITH INCLUDE STRUCTURE)
DATA : IG_MARA_MAKT TYPE STANDARD TABLE OF TP_MARA_MAKT,
WG_MARA_MAKT TYPE TP_MARA_MAKT.
DATA : IG_T002 TYPE STANDARD TABLE OF TP_T002,
WG_T002 TYPE TP_T002.
DATA : IG_FINAL TYPE STANDARD TABLE OF TP_FINAL,
WG_FINAL TYPE TP_FINAL.
data : IG_MATNR TYPE STANDARD TABLE OF TP_MATNR WITH HEADER LINE,
WG_MATNR TYPE TP_MATNR.
DATA:BEGIN OF IG_THEAD OCCURS 0.
INCLUDE STRUCTURE THEAD .
DATA: END OF IG_THEAD.
DATA:BEGIN OF IG_TLINE OCCURS 0.
INCLUDE STRUCTURE TLINE .
DATA:END OF IG_TLINE.
FIELD-SYMBOLS
FIELD-SYMBOLS: <T_DYNTABLE> TYPE STANDARD TABLE,"Dynamic internal
"tablename
<FS_DYNTABLE>, "Field symbol to create work area
<FS_FLDVAL> TYPE ANY. " Field symbol to assign values
COMPULSORY
FIELD-SYMBOLS: <FS_DATA> TYPE REF TO DATA,
<FS_DATA1> TYPE REF TO DATA,
<FS_2> TYPE STANDARD TABLE,
<FS_22> TYPE STANDARD TABLE,
<FS_1>,
<FS_11>,
<F>,
<FA>,
<LWA_LINE_WA>,
<LWA_LINE_WA1>.
------- Create Dyn Table From FC
DATA: LT_DATA TYPE REF TO DATA,
LT_DATA1 TYPE REF TO DATA,
LWA_LINE TYPE REF TO DATA,
LWA_LINE1 TYPE REF TO DATA,
LI_FIELD_CAT TYPE LVC_T_FCAT,
LWA_FIELD_CAT TYPE LVC_S_FCAT.
PARAMETERS & SELECT-OPTIONS
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_SPRAS FOR MAKT-SPRAS NO INTERVALS DEFAULT 'EN'
OBLIGATORY ,
S_MATNR FOR MARA-MATNR,
S_MTART FOR MARA-MTART.
PARAMETERS: GP_SIZE TYPE I DEFAULT '200'.
SELECTION-SCREEN : END OF BLOCK B1.
INITIALIZATION
INITIALIZATION.
gv_repid = sy-repid.
gv_date = sy-datum.
AT SELECTION-SCREEN
AT SELECTION-SCREEN.
IF GP_SIZE < 0.
MESSAGE E002(00).
ENDIF.
IF GP_SIZE > 50000.
MESSAGE W130(26) WITH TEXT-004.
SET CURSOR FIELD 'gp_size'.
ENDIF.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM FIELDCAT.
PERFORM LAYOUT.
PERFORM DATA_FETCH.
PERFORM READ_DATA_TO_FINAL.
SORT ig_final BY matnr spras.
gv_lin = gv_li.
gv_li = gv_li - 2.
LOOP AT ig_final INTO wg_final.
ASSIGN COMPONENT 1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = 'Material Number'.
ASSIGN COMPONENT 2 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = 'Authorization Group'.
g_VAR11 = wg_final-srno + 2.
gv_li1 = gv_li1 + 2.
MOVE : g_var11 TO gv_i1.
ASSIGN COMPONENT g_var11 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = 'MatDesc'.
g_var2 = g_var11 + gv_lines.
ASSIGN COMPONENT g_var2 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = 'BasicData'.
APPEND <LWA_LINE_WA1> TO <FS_22>.
EXIT.
ENDLOOP.
LOOP AT ig_final INTO wg_final.
AT NEW matnr.
gv_index = sy-tabix.
ASSIGN COMPONENT 1 OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = wg_final-matnr.
ENDAT.
AT NEW MATNR.
GV_INDEX = SY-TABIX.
ASSIGN COMPONENT 1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = wg_final-matnr.
ENDAT.
ASSIGN COMPONENT 2 OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = wg_final-begru.
ASSIGN COMPONENT 2 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = wg_final-begru.
gv_var = wg_final-srno + 2.
gv_li = gv_li + 2.
MOVE : gv_var TO gv_i.
ASSIGN COMPONENT gv_var OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = wg_final-maktx.
ASSIGN COMPONENT gv_var OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = wg_final-maktx.
gv_var1 = gv_var + gv_lines .
ASSIGN COMPONENT gv_var1 OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = wg_final-ltxt.
ASSIGN COMPONENT gv_var1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = wg_final-ltxt.
AT END OF matnr.
APPEND <LWA_LINE_WA> TO <FS_2>.
CLEAR <LWA_LINE_WA>.
ENDAT.
AT END OF matnr.
APPEND <LWA_LINE_WA1> TO <FS_22>.
CLEAR <LWA_LINE_WA1>.
ENDAT.
ENDLOOP.
PERFORM display..
*& Form data_fetch
text
--> p1 text
<-- p2 text
FORM DATA_FETCH .
SELECT matnr
from mara up to gp_size rows
appending corresponding fields of table ig_matnr
where matnr in s_matnr
and mtart in s_mtart.
loop at ig_matnr.
SELECT MARA~MATNR
MARA~BEGRU
MARA~MTART
MAKT~SPRAS
MAKT~MAKTX FROM MARA INNER JOIN MAKT
ON MARAMATNR = MAKTMATNR
appending corresponding fields of TABLE ig_mara_makt UP TO GP_SIZE
ROWS
WHERE makt~spras IN s_spras
AND mara~matnr IN s_matnr
AND mara~mtart IN s_mtart
AND mara~matnr EQ ig_matnr-matnr.
endloop.
IF sy-subrc = 0.
SORT ig_mara_makt.
ENDIF.
ENDFORM. " data_fetch
*& Form read_data_to_final
text
--> p1 text
<-- p2 text
FORM READ_DATA_TO_FINAL .
LOOP AT ig_mara_makt INTO wg_mara_makt .
wg_final-MATNR = wg_mara_makt-MATNR.
wg_final-BEGRU = wg_mara_makt-BEGRU.
wg_final-MTART = wg_mara_makt-MTART.
wg_final-SPRAS = wg_mara_makt-SPRAS.
wg_final-MAKTX = wg_mara_makt-MAKTX.
READ TABLE ig_t002 INTO wg_t002 WITH KEY spras = wg_final-spras.
IF sy-subrc = 0.
wg_final-srno = wg_t002-srno.
ENDIF.
CLEAR ig_thead[].
ig_thead-TDOBJECT = 'MATERIAL'.
ig_thead-TDNAME = wg_final-matnr.
ig_thead-TDID = 'GRUN'.
ig_thead-TDSPRAS = wg_final-spras.
CALL FUNCTION 'TEXT_READ'
EXPORTING
I_HEADER = IG_THEAD
I_READONLY = 'X'
IMPORTING
E_HEADER = IG_THEAD
TABLES
T_LINES = IG_TLINE[]
EXCEPTIONS
NOTFOUND = 1.
IF sy-subrc EQ 0.
LOOP AT ig_tline.
gv_strg = ig_tline-tdline.
IF gv_strg1 <> ' '.
CONCATENATE gv_strg1 ';' gv_strg INTO gv_strg1.
ELSE.
gv_strg1 = gv_strg.
ENDIF.
ENDLOOP.
wg_final-ltxt = gv_strg1.
APPEND wg_final TO ig_final.
CLEAR wg_final.
gv_strg1 = ' '.
ELSE.
APPEND wg_final TO ig_final.
ENDIF.
ENDLOOP.
ENDFORM. " read_data_to_final
" read_data_to_final
*& Form layout
text
--> p1 text
<-- p2 text
FORM LAYOUT .
CLEAR L_LT.
L_LT-ZEBRA = 'X'.
L_LT-COLWIDTH_OPTIMIZE = 'X'.
L_LT-WINDOW_TITLEBAR = 'MATERIAL DETAILS'.
ENDFORM. " layout
*& Form fieldcat
text
--> p1 text
<-- p2 text
FORM FIELDCAT .
SELECT SPRAS
LAISO FROM t002 INTO CORRESPONDING FIELDS OF TABLE ig_t002
WHERE spras IN s_spras.
DESCRIBE TABLE ig_t002 LINES gv_lines.
LOOP AT ig_t002 INTO wg_t002.
g_v = g_v + 1.
Wg_t002-srno = g_v.
MODIFY ig_t002 FROM wg_t002 TRANSPORTING SRNO.
ENDLOOP.
LOOP AT ig_t002 INTO wg_t002.
CLEAR WA_IT_FLDCAT.
MOVE SY-INDEX TO WA_COLNO.
CONCATENATE 'MD-' wg_t002-LAISO
WA_COLNO
INTO WA_FLNAME.
WA_IT_FLDCAT-FIELDNAME = WA_FLNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = WA_FLNAME.
WA_IT_FLDCAT-INTLEN = 250.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
APPEND WA_IT_FLDCAT TO T_FLDCAT.
CLEAR wg_t002.
ENDLOOP.
LOOP AT ig_t002 INTO wg_t002.
CLEAR WA_IT_FLDCAT.
MOVE SY-INDEX TO WA_COLNO.
CONCATENATE 'BD-' wg_t002-LAISO
WA_COLNO
INTO WA_FLNAME.
WA_IT_FLDCAT-FIELDNAME = WA_FLNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = WA_FLNAME.
WA_IT_FLDCAT-INTLEN = 250.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
APPEND WA_IT_FLDCAT TO T_FLDCAT.
CLEAR wg_t002.
ENDLOOP.
MOVE 'MATNR' TO WA_FLNAME.
WA_IT_FLDCAT-FIELDNAME = WA_FLNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = 'Material No'.
WA_IT_FLDCAT-INTLEN = 18.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
INSERT WA_IT_FLDCAT INTO T_FLDCAT INDEX 1.
MOVE 'BEGRU' TO WA_FLNAME.
WA_IT_FLDCAT-FIELDNAME = WA_FLNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = 'Authorization Group'.
WA_IT_FLDCAT-INTLEN = 4.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
INSERT WA_IT_FLDCAT INTO T_FLDCAT INDEX 2.
DESCRIBE TABLE T_FLDCAT LINES gv_li.
ASSIGN LT_DATA TO <FS_DATA>.
Creating the Dynamic Internal Table
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = T_FLDCAT " Fieldcatalogue
IMPORTING
EP_TABLE = <FS_DATA> " Dynamic Internal Table
EXCEPTIONS
GENERATE_SUBPOOL_DIR_FULL = 1
OTHERS = 2.
Assign Dyn Table To Field Sumbol
ASSIGN <FS_DATA>->* TO <FS_1>.
Assigning the Internal Table TYPE ANY to Standard internal Table
ASSIGN <FS_1> TO <FS_2>.
Creating a Workarea
CREATE DATA LWA_LINE LIKE LINE OF <FS_2> .
Assigning the Content to the workares as a Pointer
ASSIGN LWA_LINE->* TO <LWA_LINE_WA>.
LOOP AT T_FLDCAT INTO WA_IT_FLDCAT.
WA_IT_FLDCAT1-FIELDNAME = WA_IT_FLDCAT-FIELDNAME.
WA_IT_FLDCAT1-TABNAME = WA_IT_FLDCAT-TABNAME.
WA_IT_FLDCAT1-SELTEXT_L = WA_IT_FLDCAT-SELTEXT.
WA_IT_FLDCAT1-REF_TABNAME = 'MARC'.
APPEND WA_IT_FLDCAT1 TO T_FLDCAT1.
CLEAR : WA_IT_FLDCAT,WA_IT_FLDCAT1.
ENDLOOP.
ASSIGN LT_DATA1 TO <FS_DATA1>.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = T_FLDCAT " Fieldcatalogue
IMPORTING
EP_TABLE = <FS_DATA1> " Dynamic Internal table
EXCEPTIONS
GENERATE_SUBPOOL_DIR_FULL = 1
OTHERS = 2.
Assign Dyn Table To Field Sumbol
ASSIGN <FS_DATA1>->* TO <FS_11>.
Assigning the Internal Table TYPE ANY to Standard internal Table
ASSIGN <FS_11> TO <FS_22>.
Creating a Workarea
CREATE DATA LWA_LINE1 LIKE LINE OF <FS_22> .
Assigning the Content to the workares as a Pointer
ASSIGN LWA_LINE1->* TO <LWA_LINE_WA1>.
ENDFORM. " fieldcat
*& Form show
text
--> p1 text
<-- p2 text
FORM Display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = GV_REPID
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_SET'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = L_LT
IT_FIELDCAT = T_FLDCAT1[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = <FS_2>
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " display
FORM PF_STATUS_SET USING RS_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'DISPLAY' .
ENDFORM. "PF_STATUS_SET
*& Form Name: user_command *
*& Form Desc: For Handling USER_COMMAND *
FORM USER_COMMAND USING IF_UCOMM TYPE SY-UCOMM
IS_SELFIELD TYPE SLIS_SELFIELD.
CASE IF_UCOMM.
WHEN 'DOWNLOAD'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = ' '
DIAGNOSE_OBJECT = ' '
TEXT_QUESTION = 'Data download to excel'
TEXT_BUTTON_1 = 'Ja'(001)
ICON_BUTTON_1 = ' '
TEXT_BUTTON_2 = 'Nein'(002)
ICON_BUTTON_2 = ' '
DEFAULT_BUTTON = '1'
DISPLAY_CANCEL_BUTTON = 'X'
USERDEFINED_F1_HELP = ' '
START_COLUMN = 25
START_ROW = 6
POPUP_TYPE =
IMPORTING
ANSWER =
TABLES
PARAMETER =
EXCEPTIONS
TEXT_NOT_FOUND = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'C:\Material-Text.xls'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = 'X'
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = 'X'
IMPORTING
FILELENGTH = GL_LENGHT
TABLES
DATA_TAB = <FS_22>
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF GL_LENGHT NE 0.
MESSAGE S398(00) WITH 'DATA downloaded to EXCEL'.
ENDIF.
ENDCASE.
ENDFORM. "user_command
Thanks -
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 lotYou 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. -
Append a line to a dynamic table in a dynamic structure
Hello,
i've created a dynamic structure <ls_itab> TYPE ANY.
This structure contains a deep structure name 'CELLSTYLES' of type lvc_t_styl.
Now i want to add a line to the deep structure CELLSTYLES.
I'll tried something like this:
data: <ld_fld> TYPE ANY,
<ls_itab> TYPE ANY.
ASSIGN COMPONENT 'CELLSTYLES' OF STRUCTURE <ls_itab> TO <ld_fld>.
But i can't append line to <ld_fld> because it's no internaltable.
Please help.
Best regards,
TomSdHi Thomas,
Put this code at declaration.
FIELD-SYMBOLS: <L_TABLE> TYPE STANDARD TABLE.
Here Append will not work; after the code you have written use.
INSERT <ls_itab> INTO TABLE <L_TABLE>.
Hope it will solve ur problem.
Regards
Krishnendu
Maybe you are looking for
-
I have a macro that updates a key figure . The macro checks certain conditions and if the result is true sets the value of the key figure to 1 and changes the key figure value to 0 if the conditions return a value of false. I executed the macro in a
-
I woke up the other morning and the drop down for my address bar, which had previously had a generous block for each address in memory, had changed. All of the block for remembered addresses had been compressed to half the size they originally were.
-
Anything 100% black in my video is turning neon green?! HELP ASAP
I have a video due to a client within hours and now this happens... What did I do wrong? It doesn't show this under rendered and I tried many times to rerender it. Did I color correct something the wrong way?! It's only on certain clips I believe.
-
Full memory by using the camera
I´ve got a nokia x and wanted to take a picutre today. My phone says "memory is full", but memory is not full. Still got 40 MB space at the phone storage and 1 GB on the internal storage. What can I do?
-
E70: cannot load IR modem driver
I upgraded the FW to the latest version, I have the latest PC Suite installed and still I cannotuse the E70 with my laptop for dialup GPSR connections. It seems PC suite does not automaticly install the correct drivers for IR modems. I now use the st