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.
Similar Messages
-
Method t create dynamic structure if the field name contains space
HI all,
I am creating a dynamic internal table. Everything id fine but when creating dynamic structure if field name contains space its giving me dump.Can you please suggest me any other methos which takes space in the field name.
Iam using the following method:
gr_struct_typ ?= cl_abap_structdescr=>create( p_components = gt_component ).
In the gt_component i have one of the field with space like ( RU STAND) and its giving error.
Any help will be appreciated.
thanks
Suku.Hello Sukumar
If the space in the fieldname is a mistake then you could simply use:
CONDENSE ld_fieldname NO-GAPS.
However, I guess your fieldname should contain this space:
>...suggest me any other methos which takes space in the field name.
>
Well, have you ever seen a field or column name in SAP standard containing a space in its name???
Regards
Uwe -
Dynamic file name from input payload (RFC 2 flat file)
Hi,
I have an RFC to flat file scenario. The output flat file has not an XML structure, it's just a plain text file generated with abap mapping.
In my source interface (RFC), I have a field called <FILENAME>, I want to use the value of that field to create the target file using dynamic file name. But if in variable substitution I use payload:ZRFC_NAME,1,FILENAME,1 It doesn't work because the dynamic variable substitution try to access to output payload, not the source one...
What can I do?Hi Marshal,
You can add a extra node to your target strucutre like
FileName- Node
--FileName - Element.
do the mapping from the field filename of RFC to FileName field in u r target strucure. And use this field path at Refrence in variable subtituion.
In the Content converison add the Name & Values as below
FileName.fileldNames -- FileName
FileName.fieldFixedLengths -- 0
FileName.fixedLengthTooShortHandling -- Cut
So the extra field in u r target structure would not populate in u r target text file.
Cheers
Veera -
How to pass values in dynamic structure and then dynamic table
Hi,
we have a Z structure in se11 holding 10 fields. But at run time i need to create a dynamic table with more than 10 records.
I am able to create the structure and corresponding internal table. Now the issue is i have to populate this dynamic structure with some values and then append it to dynamic internal table. Since the dynamic table type is any its not allowing an index operation like modify etc etc.
Could anyone help me in passing the values . I have searched in SDN . everyone created a dynamic table and then populated it values from some standard or custom tables.Then assigning the component of structure and displaying the output. but in my situation i have no such values stored in any tables. i populate values based on certain calculation.Hi Friends,
This is the piece of code.After creating dynamic work area and dynamic table what i should do?
TYPES: BEGIN OF STR,
ID TYPE I,
NAME(30) TYPE C,
END OF STR.
data: v_lines type i.
STR_TYPE ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_NAME( 'STR' ).
STR_COMP = STR_TYPE->GET_COMPONENTS( ).
APPEND LINES OF STR_COMP TO COMP_TAB.
COMP-NAME = 'NAME1'.
COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
APPEND COMP TO COMP_TAB.
COMP-NAME = 'VALUE1'.
COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
APPEND COMP TO COMP_TAB.
COMP-NAME = 'NAME2'.
COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
APPEND COMP TO COMP_TAB.
COMP-NAME = 'VALUE2'.
COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
APPEND COMP TO COMP_TAB.
COMP-NAME = 'NAME3'.
COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
APPEND COMP TO COMP_TAB.
COMP-NAME = 'VALUE3'.
COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
APPEND COMP TO COMP_TAB.
NEW_STR = CL_ABAP_STRUCTDESCR=>CREATE( COMP_TAB ).
NEW_TAB = CL_ABAP_TABLEDESCR=>CREATE(
P_LINE_TYPE = NEW_STR
P_TABLE_KIND = CL_ABAP_TABLEDESCR=>TABLEKIND_STD
P_UNIQUE = ABAP_FALSE ).
CREATE DATA DREF TYPE HANDLE NEW_TAB.
CREATE DATA DREF1 TYPE HANDLE NEW_str. -
Dynamic File Name - Suppress the Substitue varible
Hi All,
I am doing the scenarios like File name at the recevier end would be dynamic for that i take an extra field NAME mapped with UDF which return the file name dynamically. It is working fine and doing good. But the problem here is , this field is the first field in my target structure so i am getting an empty line in the target file.
So My structure as follows:
<b>MT_BNK01 1..1
NAME 1..1
RECORD 0..Unbound
--Record_data 0..Unbound</b>
So in the recever side i written as follows
Recordset Structure:: RECORD
<b>RECORD.fieldSeparator = 'nl'
RECORD.endSeparator = 'nl'</b>
But according to this weblog i can suppress the empty line but it is not working
/people/sravya.talanki2/blog/2005/08/11/solution-to-the-problem-encountered-using-variable-substitution-with-xi-sp12
means, NAME is also in the same level of RECORD in the Structure. So How can i pass the structure as ??
I tried to pass the RecordSet Structure: NAME,RECORD
and following parameters, it is not working
<b>NAME.fieldFixedLength =0
NAME.fieldLengthTooShortHandling = Cut</b>
Can you please suggest me what could be the reason. Tell me what information i need to pass the RecordSet Structure and attrubute information also.
One more thing like, My sender side it is not picking the empty lines. What could be the reason. I given fieldSeparator and endSeparator as 'nl'. So to catch the empty line what i need to do???
Thanks in Advance,
Best Regards,
VijayHi Vijaya,
This can be solved. Actually i had the same scenario where i was getting blank line for the header. Suppose Header was carrying the file name after i cut the value i would get a blank line in file.
So i added in content conversion parameter the following line
Header.endSeparator - '0'
then the first line was not blank.
Try this, i think your issue will be solved
Regards,
Ramesh P
Message was edited by:
Ramesh Parashivamurthy -
Xml file in dynamic file name in file receiver adapter
Hi,
I'm doing the dynamic file name in file receiver adapter. I have done as per instructed in /people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i
All turned out okay. I have got the file name I require. Except that the file format is XML and I need to suppress the filename node occupied by the dynamic file name.
The content conversion mentioned in /people/sravya.talanki2/blog/2005/08/11/solution-to-the-problem-encountered-using-variable-substitution-with-xi-sp12, does not seem to solve my problem. As it is only for file format other than the XML one, because we only do the content conversion if we want to "convert" the format of the content from XML to the other format.
Does anybody have the solution to my problem? thanks in advanceThank you Raj for the direction
The way to do it is :
1. In ID, advanced tab, put a check on the adapter-specific message attributes - file name.
2. Put a "*" on the file name scheme
3. In IR, create a UDF to set up target file name :
DynamicConfiguration conf = (DynamicConfiguration) container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
// set up file name for receiver adapter
String SourceFileName = conf.get(key);
conf.put(key, TargetFileName);
return " ";
4. Map the above UDF to the header level of the target structure.
Regards,
Idi -
How to give a dynamic File Name for Receiver File/FTP Adapter.
Hi Experts,
I have one scenario in which we are creating a flat file of IDOC which is coming from R/3 & sending it to FTP location. For this we have configured Receiver FTP adapter with File Name Scheme as "NT.out" & in File Consturction mode i have given as "Add Time Stamp".
therfore while creating a file it is creating as NTyyyyMMdd-HHmmss-SSS.out
where as my requirement is only to to add Time & not the Date. (NThhmmss.out)
How to do this ?
for your info we are using ABAP Mapping.
Pl help me
Regards,
UmeshHi Umesh,
Add one more field to your target structure for your file name and populate that field as per your requirement like NTyyyyMMdd.out. In receiver communication channel use Variable subtiution option and give the refrence of Payload and file construction mode set as create.
And refer the below weblogs for Variable Subtiutuion File Name Scheme
/people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i - Dynamic File Name Part 1
/people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii - Dynamic File Name Part 2
Hope this way would be solve u r problem.
Cheers
Veera
>>>Reward points, if it is needful -
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 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 -
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 * -
Dynamic table name, how to query?
Hi!
There is a table name that is decided dynamically. the name is:
someNameYYY where YYY denotes the client number.
I get the client number by sy-mandt and concatenate it with someNameYYY to lc_table_name but then comes the problem:
I cannot do
SELECT *
FROM lc_table_name
because I get compiler error "lc_table_name" is not defined in ABAP dictionary.
How do I query a table with the name decided dynamically?
regards
BaranYou can have do something like this :
REPORT ZTABLE_DOWNLOAD .
tables :
dd02l, "SAP Tables
dd03l, "Table fields
dd04t. "R/3 DD: Data element texts
constants : c_activation_status(1) value 'A',
c_tabclass(6) type c value 'INTTAB',
c_language(2) type c value 'EN'.
type-pools : slis.
selection-screen begin of block b1 with frame title text-003.
*parameters :p_mandt like t001-mandt obligatory default '560'.
parameters :p_table like dd03l-tabname obligatory.
selection-screen end of block b1.
data:
table_desc(70) type c,
table_field like dd03l-fieldname,
total_rows type i,
t_rows(20) type c.
field-symbols:
<fs_line> type any,
<fs_field> type any.
at selection-screen.
*Check for the existence of the table
select single * from dd02l where tabname = p_table
and as4local = c_activation_status.
if sy-subrc ne 0.
*Table is not active in dictionary
message e999(zs) with 'Table is not active in dictionary'.
elseif dd02l-tabclass = c_tabclass.
*It is a structure not a table
message e999(zs) with 'This is a structure not a table'.
endif.
start-of-selection.
perform table_data_display.
end-of-selection.
form table_data_display.
data:
l_long_type type i,
lx_struct type ref to data,
lt_table type ref to data,
lcl_sdescr type ref to cl_abap_structdescr,
lx_lvc_cat type lvc_s_fcat,
lt_lvc_cat type lvc_t_fcat, "Field catalog
lx_fieldcat type slis_fieldcat_alv,
lt_fieldcat type slis_t_fieldcat_alv,
lx_layout type slis_layout_alv,
lt_sort type slis_t_sortinfo_alv, "Sort table
ls_sort type slis_sortinfo_alv.
field-symbols :
<fieldcat> type slis_fieldcat_alv,
<lt_table> type table,
<fs> type any,
<components> type abap_compdescr.
*Dynamic creation of a structure
create data lx_struct type (p_table).
assign lx_struct->* to <fs>.
*Get the field structure
lcl_sdescr ?= cl_abap_typedescr=>describe_by_data( <fs> ).
loop at lcl_sdescr->components assigning <components>.
*Do not display field "MANDT"
IF sy-tabix = 1 AND <components>-name = 'MANDT'.
CONTINUE. "next loop
ENDIF.
*Build fieldcatalog
lx_lvc_cat-fieldname = <components>-name.
lx_lvc_cat-ref_table = p_table.
append lx_lvc_cat to lt_lvc_cat.
lx_fieldcat-fieldname = <components>-name.
lx_fieldcat-ref_tabname = p_table.
append lx_fieldcat to lt_fieldcat.
endloop.
*Create an internal table
call method cl_alv_table_create=>create_dynamic_table
exporting it_fieldcatalog = lt_lvc_cat
importing ep_table = lt_table.
assign lt_table->* to <lt_table>.
*Read the data
select * from (p_table)
into corresponding fields of table <lt_table>
order by primary key.
loop at <lt_table> assigning <fs_line>.
assign component 'MANDT' of
structure <fs_line> to <fs_field>.
<fs_field> = p_mandt.
endloop.
if <lt_table>[] is initial.
*No table enties are existing
message e003(zdynamictable) with p_table.
exit.
else.
describe table <lt_table>[] lines total_rows.
t_rows = total_rows.
shift t_rows left deleting leading space.
endif.
*Specify the layout
lx_layout-zebra = 'X'.
lx_layout-colwidth_optimize = 'X'.
*Display the ALV List
select single ddtext into table_desc from dd02t
where tabname eq p_table and ddlanguage eq c_language.
check not table_desc is initial.
concatenate 'Entries from table:'
p_table '(' table_desc ')' '-:' t_rows 'Entries Found' into
table_desc
separated by space.
*Start - Download the data to excel sheet by validating the file path.
data:
*lv_filename type string,
lv_fname_validate like rlgrap-filename.
*CONCATENATE 'C:\ZTABLE_DWN\' P_TABLE '.Xls' INTO LV_FILENAME.
*CONCATENATE '
Pc-p31061\Harman\Tasks\ZTABLE_DWN\' P_TABLE '.xls' INTO
CONCATENATE 'C:\ZTABLE_DWN\' P_TABLE '.xls' INTO
LV_FNAME_VALIDATE.
call function 'WS_FILE_DELETE'
exporting
file = lv_fname_validate
IMPORTING
RETURN =
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = ' '
CODEPAGE = ' '
FILENAME = LV_FNAME_VALIDATE
FILETYPE = 'DAT'
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = <lt_table>.
*call function 'GUI_DOWNLOAD'
exporting
BIN_FILESIZE =
filename = lv_fname_validate
filetype = 'ASC'
write_field_separator = 'X'
IMPORTING
FILELENGTH =
tables
data_tab = <lt_table>.
End of Download.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_background_id = 'ALV_BACKGROUND'
i_grid_title = table_desc
is_layout = lx_layout
it_fieldcat = lt_fieldcat
tables
t_outtab = <lt_table>
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.
clear table_desc.
endform. " table_data_display -
Okay, I just need to figure out how to make dynamic variable
names. In this case, I have a loop, and inside the loop I need to
create a new array for every iteration of the loop. Something like
<cfloop from="0" to="10" index="i">
<cfset LoopArray#i# = Some Value>
</cfloop>
But that doesn't work. How can you make dynamic variable
named? I think it's probably something to do with evaluate or DE,
but I don't know how to use them, and the livedocs make no sense to
me. Thanks!On Thu, 22 May 2008 17:14:42 +0000 (UTC), kenji776 wrote:
> Thank you both for your replied, I did manage to find a
solution (the same one
> posted by JR "Bob" Dobbs). Pretty much just looks
like...
>
>
> <cfloop from="1" to="3" index="i">
> <cfset LinkResults["#i#"][1] = "Player 1's Move
ID">
> <cfset LinkResults["#i#"][2] = "Player 2's Move
ID">
> <cfset LinkResults["#i#"][3] = "Damage to player
1">
> <cfset LinkResults["#i#"][4] = "Damage to player
2">
> </cfloop>
From your values, you don't want a two-dimensional array
(which although
you're actually building LinkResults as a struct, with the
sequential
numeric keys, it's basically an array), you want an array of
structs, eg:
LinkResults
.player1.moveId
LinkResults.player1.damage
What is "i" actually counting through? IE: from 1-3 things...
which are...
what?
Adam -
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
-
How to put a border around locked text boxes?
I have a number of locked text boxes. I need to place a border (a box) around them. How do I do that?
-
Hi, I keep getting this error message for my trigger when performing an insert..select statement (standard plain old insert works): ORA-04091: table ... is mutating, trigger/function may not see it The trigger is as follows: CREATE OR REPLACE TRIGGER
-
Win xp app in mini lion server
Hello, We are thinking to change to a Mac Mini i5 Lion Server, i need to run my Accounting in Win XP, does it works fine with Win XP under Parallels?
-
HT3296 Shouldn't this be available on OSX as well?
I see the support page for controlling ATV with a 3rd Party remote (http://support.apple.com/kb/HT3296). I don't get why this is limited to Apple TV. My Mac Mini has front row and a perfectly fine IRdA sensor/controller. Do people have experience int
-
Hola! Acabo de instalar el WhatsApp messanger en el iphone y me pide que le de un codigo de 3 digitos pero no se a cual codigo se refiere, ya le intente con el 123 y el 000 y nada, me dice q solo me quedan 6 intentos, alguien puede ayudarme? tengo va