Deep structure output Issue:
Hello everyone,
I have an output form that simply contains billing document item records. Repeating subform
works great. However I have been asked to make a more complex solution. I have been
tasked to output the corresponding condition records for each billing item.
I have even tried to build a deep structure where one field is the condition records for the billing item.
I am not having luck. The billing items repeat, but the condition records do not. I have even embedding a subform
inside of another, but it doesn't allow repeating.
Any thoughts to resolve this?
So the output would be :
billing item
condition recs
condition recs
condition recs
billing item
condition recs
condition recs
condition recs
check this shizzle out...
Hi,
if its like colum1, column2 (tab2).
you can represent column2 as a nested table in the form. and put these tables structure intoa subform of type flowed.
then you can have the required format.
the same can also be acheived using nested subforms instead of tables.
example of such scenario is PO & line items.
po number1 , items 1
item 2
item 3
po number2 , items 1
item 2
item 3
hope this helps you.
Cheers,
Sai
found here - Re: Nested Table: How to display formatted text in the form ?
Similar Messages
-
How to convert flat to deep structure ?
hi all, i hava a problem. this is my code:
TYPES: BEGIN OF mytype,
f1(14) TYPE C,
f2(24) TYPE C,
f3(9) TYPE C,
f4(6) TYPE C,
f5(4) TYPE N,
f6(5) TYPE N,
Myfield (8) TYPE F,
END OF mytype.
DATA: mylocaltable TYPE TABLE OF mytype WITH HEADER LINE.
read data from CSV file and put it to mylocaltable, it works fine ))), but next:
DATA: OUTPUT TYPE TABLE OF DEEP_STRUCTURE_TYPE WITH HEADER LINE.
DATA: deepstructure LIKE LINE OF OUTPUT-message_type-line.
LOOP AT mylocaltable.
MOVE-CORRESPONDING mylocaltable to deepstructure.
APPEND deepstructure TO OUTPUT-message_type-line.
ENDLOOP.
TRY.
CREATE OBJECT PROXY.
CALL METHOD PROXY->Message_Out
EXPORTING
OUTPUT = OUTPUT.
COMMIT WORK.
ENDTRY.
there is a error message on line "Myfield (8) TYPE F,":
"Myfield" must be a character like data object (data type C, N, D, T or STRING) .
in the DEEP structure OUTPUT the field "Myfield" has XSD:DOUBLE type (in XI).
Please help me to solve this problem. Thanks.
P.S. the data for "Myfield" can be like "12345678,12345678" - i mean it's float and has max length - 16.Hi, thanks for reply, but i've solved this problem by other way:
1.
i've changed
Myfield (8) TYPE F, to Myfield (16) TYPE С,
2.
then i've changed
LOOP AT mylocaltable.
MOVE-CORRESPONDING mylocaltable to deepstructure.
APPEND deepstructure TO OUTPUT-message_type-line.
ENDLOOP.
to
DATA: Float type F.
LOOP AT mylocaltable.
deepstructure-f1 = mylocaltable-f1.
deepstructure-f2 = mylocaltable-f2.
deepstructure-f3 = mylocaltable-f3.
deepstructure-f4 = mylocaltable-f4.
deepstructure-f5 = mylocaltable-f5.
deepstructure-f6 = mylocaltable-f6.
CALL FUNCTION 'CHAR_FLTP_CONVERSION'
EXPORTING
STRING = mylocaltable-Myfield
IMPORTING
FLSTR = Float
EXCEPTIONS
EXPONENT_TOO_BIG = 1
EXPONENT_TOO_SMALL = 2
STRING_NOT_FLTP = 3
TOO_MANY_DECIM = 4
OTHERS = 5.
deepstructure-Myfield = Float.
APPEND deepstructure TO OUTPUT-message_type-line.
ENDLOOP.
Anyway thanks to all !!!!! )))). -
Creating an XML From a Deep Structure using XSL Transformation
Hi ABAPers,
I have a requirement to use XSL Transformations on an ABAP deep type structure.
Currently i have an API that fills in this deep structure and by using CALL TRANSFORMATION ID.... i will get the BIG XML having having 100s of nodes . But actualy form the deep structure i need only some NODES (say 50)... So i tried writing an XSLT
in the transaction STRANS.. but on using this TRANSFORMATION which i wrote i am getting an error messgae like INVALID XML...
Am i going in right track or is there a good solution...
My sample transformation is as below...
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:value-of select="DATA/NODE_ELEMENTS/UUID_KEY/UUID"/>
<xsl:value-of select="DATA/NODE_ELEMENTS/SEMANTICAL_NAME"/>
<xsl:value-of select="DATA/NODE_ELEMENTS/STRUCT_CAT"/>
<xsl:value-of select="DATA/NODE_ELEMENTS/USAGE_CAT"/>
<xsl:value-of select="DATA/NODE_ELEMENTS/RESTRICTED_IND"/>
<xsl:value-of select="VALUES/DATA/NODE_ID"/>.
</xsl:template>
</xsl:transform>
Please help me in solving this issue....
Thanks,
Linda.Hi Linda,
I am replying based on your sample code.
Try the below following suggestions.
here 'GRPHDR' is the node where I am selecting the data.
IGRPHDR is the name of the reference.
First calling the transformation in you program.
TYPES: BEGIN OF tl_hdr,
msgid(20) TYPE c,
END OF tl_hdr.
DATA : t_hdr TYPE STANDARD TABLE OF tl_hdr.
GET REFERENCE OF t_hdr INTO l_result_xml-value.
l_result_xml-name = 'IGRPHDR'.
APPEND l_result_xml TO t_result_xml.
TRY.
CALL TRANSFORMATION yfi_xml_read
SOURCE XML it_xml_data
RESULT (t_result_xml).
CATCH cx_root INTO l_rif_ex.
l_var_text = l_rif_ex->get_text( ).
l_bapiret-type = 'E'.
l_bapiret-message = l_var_text.
APPEND l_bapiret TO errormsgs.
EXIT.
ENDTRY.
in XSL transformation
First write a block of statement to specify from which node you are taking the data.
No matter it is a node or sub-node.
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<IGRPHDR> " reference name of internal table
<xsl:apply-templates select="//GrpHdr"/>
</IGRPHDR>
</asx:values>
</asx:abap>
</xsl:template>
Next select the data from the nodes under the nodes specified in the transformation.
here msgid is the field i am selecting for value.
<xsl:template match="GrpHdr">
<item>
<MSGID> " field in the internal table t_hdr where data has to go
<xsl:value-of select="MsgId"/>
</MSGID>
</item>
</xsl:template>
reply back if further clarification is needed.
Thanks and regards,
Kannan N -
To create a deep structure for dynamic internal table.
Hello
My ALV has fields which are defined dynamically during execution.
so, i did it in the following way,
Declared Field symbolds, DREF and fieldcatalog as,
FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE,
<fs_dyntable>.
DATA: dref_dyntab TYPE REF TO data,
dref_dynwa TYPE REF TO data.
DATA: ts_fieldcatalog TYPE lvc_t_fcat.
DATA: wa_fieldcatalog TYPE lvc_s_fcat.
Updated Fieldcatalog dynamically as,
*function module to read segment structure
CALL FUNCTION 'SEGMENT_READ'
EXPORTING
segmenttyp = v_segment_name
TABLES
segmentstructure = ts_seg_structure
EXCEPTIONS
no_authority = 1
segment_not_existing = 2
OTHERS = 3.
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN '1'.
MESSAGE e024.
STOP.
WHEN '2'.
MESSAGE e025 WITH v_segment_name.
STOP.
WHEN OTHERS.
MESSAGE e023.
ENDCASE.
ENDIF.
*FETCH FIELDS FROM STRUCTURE OF SEGMENT AND CREATE FIELDCATALOG FOR
EACH FIELD OF SEGMENT (DYNAMIC FIELD CATALOG)
LOOP AT ts_seg_structure INTO wa_seg_structure.
ADD 1 TO v_counter.
wa_fieldcatalog-fieldname = wa_seg_structure-fieldname.
wa_fieldcatalog-col_pos = v_counter.
wa_fieldcatalog-ref_table = wa_seg_structure-segtyp.
APPEND wa_fieldcatalog TO ts_fieldcatalog.
CLEAR wa_fieldcatalog.
ENDLOOP.
and generated dynamic internal table using fieldcatalog as,
*--Method to get the structure of table using fieldcatalog.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = ts_fieldcatalog
IMPORTING
*--Variable of type REF TO DATA.
ep_table = dref_dyntab.
IF sy-subrc <> 0.
MESSAGE e023.
ENDIF.
*--Dynamic internal tables required when show segments selected
IF p_selseg IS NOT INITIAL.
ASSIGN dref_dyntab->* TO <t_dyntable>.
*--Create dynamic work area and assign to FS
CREATE DATA dref_dynwa LIKE LINE OF <t_dyntable>.
ASSIGN dref_dynwa->* TO <fs_dyntable>.
And then i populated this <t_dyntable> which is being passed as data-table to method
CL_GUI_ALV_GRID => SET_TABLE_FOR_FIRST_DISPLAY
for ALV grid Display along with above used filedcatalog ts_fieldcatalog.
Things are fine till here, but now i have the requirement to edit selected rows of the ALV display..
As you might be aware, we need a field
TS_STYLEROW TYPE lvc_t_styl, (i.e, a field of type 'h' and we can say as an internal table inside an internal table or else as a deep structure)
in the output internal table <t_dyntable> to meet our requirement.
My issue is about declaring one such field of type 'h' in this dynamically created internal table ''<t_dyntable>".
I tried in the following way by adding one such field to fieldcatalog :
*Field for Styling
ADD 1 TO v_counter.
wa_fieldcatalog-fieldname = 'TS_STYLEROW'.
wa_fieldcatalog-tabname = 'TS_STYLE'.
wa_fieldcatalog-col_pos = v_counter.
wa_fieldcatalog-no_out = 'X'.
wa_fieldcatalog-inttype = 'h'. " I even mentioned this
APPEND wa_fieldcatalog TO ts_fieldcatalog.
CLEAR wa_fieldcatalog.
But this is creating a field of type 'C' in the table <t_dyntable> instead of what i was expecting
Guyz and respected,
Please advice me with the solution or ur ideas....
Note : The overall requirement is create a deep structure for dynamically generated internal table.
Your help is highly appreciated and unforgettable..!!!!!!!hi,
Dynamic append
Dynamic internal table
Dynamic internal table
dynamic columns in ALV
Variant for dynamic selection
thanks -
Reciever file adapter configuration for Deep structure
Hi Experts,
I have a idoc to file scenario in which i used a data type for file in below format:
DT_Test
-->Recordset(0.unbounded)
>E21DPU1(0.unbounded)
>field1
>field2
>E21DPU5(0.unbounded)
>filed 3
>filed 4
>E21DP03(0.unbounded)
>filed 5
>filed 6
Here DT_test is datatype name,Recordset is a structure name which contain E21DPU1, E21DPU5,E21DPO3 stucture inside it.Now,E21DPU5 and E21DPO3 structures are under E21DPU1.
I am confused in creating content conversion parameters i.e what we have to mention in Recordset Stucture .
I used E21DPU1,,E21DPU5,,E21DP03,* .should it work for deep structure.
Thanks
DeepakHi,
file adapter does not handle 2 level deep structures
the easiest way to do it now is to go for abap or java mapping
and create a line for each of the output lines and handle this in the file adapter
so like <line> </line>
<line>E21DPU1(0.unbounded) with fields </line>
<line>E21DPU5(0.unbounded) with fields </line>
<line> etc. </line>
Regards,
Michal Krawczyk -
XSLT and ABAP Transformation Deep Structure
Hello Everyone,
While I've read the forums and the links of a number of folks doing the same thing. I am stuck in that I cannot figure out how to populate a deep structure via XSLT. Not sure what is going wrong, but I suspect it is obvious. The simple problem is that my structure is not getting populated. It is blank. The transformation works in testing STRANS (and in Stylus Studio).
I cannot figure out what is wrong that makes the t_pexr2002 table blank. Thanks for any insight.
Greg
The simple program is:
TYPES: BEGIN OF ty_head,
sndprn TYPE string,
bgmref TYPE string,
moabetrh TYPE string,
create_date TYPE string,
settlement_date TYPE string,
no_lines TYPE string,
END OF ty_head.
TYPES: BEGIN OF ty_pricing,
moabetr TYPE string,
END OF ty_pricing.
TYPES: BEGIN OF ty_item,
docname TYPE string,
docnummr TYPE string,
pricing TYPE ty_pricing,
END OF ty_item.
TYPES: BEGIN OF ty_summary,
status_message TYPE string,
END OF ty_summary.
TYPES: BEGIN OF ty_mn,
header_data TYPE ty_head,
item_data TYPE ty_item,
summary_data TYPE ty_summary,
END OF ty_mn.
DATA: t_pexr2002 TYPE STANDARD TABLE OF ty_mn.
DATA: xml_doc TYPE REF TO cl_xml_document, xml TYPE string.
CREATE OBJECT xml_doc.
CALL METHOD xml_doc->import_from_file
EXPORTING
filename = 'C:\temp\2640273.xml'.
CALL METHOD xml_doc->render_2_string
EXPORTING
pretty_print = 'X'
IMPORTING
stream = xml.
CALL TRANSFORMATION zusl_pexr2002_v1
SOURCE XML xml
RESULT output = t_pexr2002.
Edited by: Thomas Zloch on Jun 9, 2010 6:05 PMHere is my XSLT:
Here is the transformation: Also pretty simple...
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ... >
<xsl:strip-space elements="*"/>
<xsl:template match="/PEXR2002/IDOC">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<OUTPUT>
<HEADER_DATA>
<SNDPRN>
<xsl:value-of select="EDI_DC40/SNDPRN"/>
</SNDPRN>
<BGMREF>
<xsl:value-of select="E1IDKU1/BGMREF"/>
</BGMREF>
<MOABETRH>
<xsl:value-of select="E1IDKU5/MOABETR"/>
</MOABETRH>
<CREATE_DATE>
<xsl:value-of select="EDI_DC40/CREDAT"/>
</CREATE_DATE>
<SETTLEMENT_DATE>
<xsl:value-of select="E1EDK03/DATUM"/>
</SETTLEMENT_DATE>
<NO_LINES>
<xsl:value-of select="count(E1IDPU1)"/>
</NO_LINES>
</HEADER_DATA>
<ITEM_DATA>
<xsl:for-each select="E1IDPU1">
<DOCNAME>
<xsl:value-of select="DOCNAME"/>
</DOCNAME>
<DOCNUMMR>
<xsl:value-of select="DOCNUMMR"/>
</DOCNUMMR>
<PRICING_DATA>
<xsl:for-each select="E1IDPU5[MOAQUAL = '006']">
<MOABETR>
<xsl:value-of select="MOABETR"/>
</MOABETR>
</xsl:for-each>
</PRICING_DATA>
</xsl:for-each>
</ITEM_DATA>
<SUMMARY_DATA>
<xsl:for-each select="EDI_DS40">
<STATUS_MESSAGE>
<xsl:value-of select="STAPA1"/>
</STATUS_MESSAGE>
</xsl:for-each>
</SUMMARY_DATA>
</OUTPUT>
</asx:values>
</asx:abap>
</xsl:template>
</xsl:transform>
Edited by: Thomas Zloch on Jun 9, 2010 6:05 PM -
How to use STRANS to translate XML to ABAP with deep structure
every experts, I want to use Tcode: STRANS to translate XML to ABAP, But it does not work well,
here is XML code,I want to translate this XML into an an Inter table gt_orders with deep structure of oeb, and colum oeb is also and intertable,how can I do this.
<?xml version="1.0" encoding="gb2312" ?><axmt410><ObjectID>setSalesOrder</ObjectID><azp01>000000</azp01><oea00>1</oea00><ta_oeaecn>SO-140227-3041</ta_oeaecn><oea03>25325017</oea03><oea02>2014-02-27 17:44:44.0</oea02><ta_oea002>2763.0</ta_oea002><ta_oea001>0.0</ta_oea001><oea14></oea14><oea15>25325017</oea15><oea23>RMB</oea23><oeaconf>S3</oeaconf><oea10></oea10><oeaud01>null</oeaud01><ta_oea007></ta_oea007><oea25>101</oea25><ta_oea008>0</ta_oea008><ta_oea009>null</ta_oea009><oeauser>Hanjingya</oeauser><ta_oeanday>2014-02-27 17:44:44.991</ta_oeanday><ta_oeamday>2014-02-28 08:30:14.866</ta_oeamday><ta_oeacday>2014-02-28 08:30:14.866</ta_oeacday><oeaud02>0</oeaud02><ta_oea030>null</ta_oea030><oeb><oeb03>1</oeb03><oeb04>7400208249</oeb04><oeb05>PCS</oeb05><oeb17>921.0</oeb17><oeb13>921.0</oeb13><oeb15></oeb15><oeb12>5</oeb12><oeb09>990001</oeb09><ta_oeb001></ta_oeb001><ta_oeb002>Yunnan</ta_oeb002><ta_oeb003>address1</ta_oeb003><ta_oeb004>zhangdagui、zhanglan</ta_oeb004><ta_oeb005>15974749998、15987782008</ta_oeb005><ta_oeb006>address and street</ta_oeb006><oebud01></oebud01></oeb><oeb><oeb03>2</oeb03><oeb04>7400208250</oeb04><oeb05>PCS</oeb05><oeb17>921.0</oeb17><oeb13>921.0</oeb13><oeb15></oeb15><oeb12>5</oeb12><oeb09>990001</oeb09><ta_oeb001></ta_oeb001><ta_oeb002>Yunnan</ta_oeb002><ta_oeb003>address2</ta_oeb003><ta_oeb004>zhangdagui、chenlan</ta_oeb004><ta_oeb005>15974749998、15987782008</ta_oeb005><ta_oeb006>address and street</ta_oeb006><oebud01></oebud01></oeb></axmt410>
I write these codes in SAP XSLT editor
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
<xsl:strip-space elements="*"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<ORDERS>
<xsl:apply-templates select="//axmt410"/>
</ORDERS>
</asx:values>
</asx:abap>
</xsl:template>
<xsl:template match="axmt410">
<OBJECTID>
<xsl:value-of select="ObjectID"/>
</OBJECTID>
<AZP01>
<xsl:value-of select="azp01"/>
</AZP01>
<OEA00>
<xsl:value-of select="oea00"/>
</OEA00>
<TA_OEAECN>
<xsl:value-of select="ta_oeaecn"/>
</TA_OEAECN>
<OEA03>
<xsl:value-of select="oea03"/>
</OEA03>
<OEA05>
<xsl:value-of select="oea05"/>
</OEA05>
<OEA02>
<xsl:value-of select="oea02"/>
</OEA02>
<TA_OEA002>
<xsl:value-of select="ta_oea002"/>
</TA_OEA002>
<TA_OEA001>
<xsl:value-of select="ta_oea001"/>
</TA_OEA001>
<OEA14>
<xsl:value-of select="ora14"/>
</OEA14>
<OEA15>
<xsl:value-of select="ora15"/>
</OEA15>
<OEA23>
<xsl:value-of select="ora23"/>
</OEA23>
<OEACONF>
<xsl:value-of select="oeaconf"/>
</OEACONF>
<OEA10>
<xsl:value-of select="ora10"/>
</OEA10>
<OEAUD01>
<xsl:value-of select="oeaud01"/>
</OEAUD01>
<TA_OEA007>
<xsl:value-of select="ta_oea007"/>
</TA_OEA007>
<OEA25>
<xsl:value-of select="ora25"/>
</OEA25>
<TA_OEA008>
<xsl:value-of select="ta_oea008"/>
</TA_OEA008>
<TA_OEA009>
<xsl:value-of select="ta_oea009"/>
</TA_OEA009>
<TA_OEA013>
<xsl:value-of select="ta_oea013"/>
</TA_OEA013>
<TA_OEA014>
<xsl:value-of select="ta_oea014"/>
</TA_OEA014>
<TA_OEA015>
<xsl:value-of select="ta_oea015"/>
</TA_OEA015>
<TA_OEA016>
<xsl:value-of select="ta_oea016"/>
</TA_OEA016>
<TA_OEA017>
<xsl:value-of select="ta_oea017"/>
</TA_OEA017>
<TA_OEA018>
<xsl:value-of select="ta_oea018"/>
</TA_OEA018>
<TA_OEA019>
<xsl:value-of select="ta_oea019"/>
</TA_OEA019>
<TA_OEA020>
<xsl:value-of select="ta_oea020"/>
</TA_OEA020>
<TA_OEA021>
<xsl:value-of select="ta_oea021"/>
</TA_OEA021>
<TA_OEA022>
<xsl:value-of select="ta_oea022"/>
</TA_OEA022>
<TA_OEA028>
<xsl:value-of select="ta_oea028"/>
</TA_OEA028>
<OEAUSER>
<xsl:value-of select="oeauser"/>
</OEAUSER>
<TA_OEANDAY>
<xsl:value-of select="ta_oeanday"/>
</TA_OEANDAY>
<TA_OEAMDAY>
<xsl:value-of select="ta_oeamday"/>
</TA_OEAMDAY>
<TA_OEACDAY>
<xsl:value-of select="ta_oeacday"/>
</TA_OEACDAY>
<OEAUD02>
<xsl:value-of select="oeaud02"/>
</OEAUD02>
<TA_OEA030>
<xsl:value-of select="ta_oea030"/>
</TA_OEA030>
<OEB>
<xsl:for-each select="oeb">
<OEB03>
<xsl:value-of select="oeb03"/>
</OEB03>
<OEB04>
<xsl:value-of select="oeb04"/>
</OEB04>
<OEB05>
<xsl:value-of select="oeb05"/>
</OEB05>
<OEB17>
<xsl:value-of select="oeb17"/>
</OEB17>
<OEB13>
<xsl:value-of select="oeb13"/>
</OEB13>
<OEB15>
<xsl:value-of select="oeb15"/>
</OEB15>
<OEB12>
<xsl:value-of select="oeb12"/>
</OEB12>
<OEB09>
<xsl:value-of select="oeb09"/>
</OEB09>
<TA_OEB001>
<xsl:value-of select="ta_oeb001"/>
</TA_OEB001>
<TA_OEB002>
<xsl:value-of select="ta_oeb002"/>
</TA_OEB002>
<TA_OEB003>
<xsl:value-of select="ta_oeb003"/>
</TA_OEB003>
<TA_OEB004>
<xsl:value-of select="ta_oeb004"/>
</TA_OEB004>
<TA_OEB005>
<xsl:value-of select="ta_oeb005"/>
</TA_OEB005>
<TA_OEB006>
<xsl:value-of select="ta_oeb006"/>
</TA_OEB006>
<OEBUD01>
<xsl:value-of select="oebud01"/>
</OEBUD01>
</xsl:for-each>
</OEB>
</xsl:template>
</xsl:transform>
and I use below ABAP program for a test, but the items from XML can not translate into Interner table gt_orders-oeb[]
TYPE-POOLS abap.
CONSTANTS gs_file TYPE string VALUE 'C:\temp\order02.xml'.
* This is the structure for the data from the XML file
TYPES:
BEGIN OF typ_s_oeb,
oeb03 TYPE string, "
oeb04 TYPE string, "
oeb05 TYPE string, "
oeb17 TYPE string, "
oeb13 TYPE string,
oeb15 TYPE string,
oeb12 TYPE string, "
oeb09 TYPE string, "
ta_oeb001 TYPE string, "
ta_oeb002 TYPE string, "
ta_oeb003 TYPE string, "
ta_oeb004 TYPE string, "
ta_oeb005 TYPE string, "
ta_oeb006 TYPE string, "
ta_oeb013 TYPE string, "
ta_oeb014 TYPE string, "
ta_oeb015 TYPE string, "
ta_oeb016 TYPE string, "
ta_oeb017 TYPE string, "
ta_oeb018 TYPE string, "
ta_oeb019 TYPE string, "
ta_oeb020 TYPE string, "
ta_oeb021 TYPE string, "
ta_oeb022 TYPE string, "
oebud01 TYPE string, "
END OF typ_s_oeb.
TYPES: typ_t_oeb TYPE TABLE OF typ_s_oeb WITH KEY oeb03.
TYPES:
BEGIN OF typ_s_order,
objectid TYPE string, "
azp01 TYPE string, "
oea00 TYPE string, "
ta_oeaecn TYPE string, "
oea03 TYPE string, "
oea02 TYPE string, "
ta_oea002 TYPE string, "
ta_oea001 TYPE string, "
oea14 TYPE string, "
oea15 TYPE string,
oea23 TYPE string, "
oeaconf TYPE string, "
oea10 TYPE string, "
oeaud01 TYPE string, "
ta_oea007 TYPE string, "
oea25 TYPE string, "
ta_oea008 TYPE string, "
ta_oea009 TYPE string, "
oeauser TYPE string, "
ta_oeanday TYPE string, "
ta_oeamday TYPE string, "
ta_oeacday TYPE string, "
oeaud02 TYPE string, "
ta_oea030 TYPE string, "
ta_oea013 TYPE string,
ta_oea014 TYPE string,
ta_oea015 TYPE string,
ta_oea016 TYPE string,
ta_oea017 TYPE string,
ta_oea018 TYPE string,
ta_oea019 TYPE string,
ta_oea020 TYPE string,
ta_oea021 TYPE string,
ta_oea022 TYPE string,
ta_oea025 TYPE string,
oeb TYPE typ_t_oeb,
END OF typ_s_order.
* Table for the XML content
DATA: gt_itab TYPE STANDARD TABLE OF char2048,
gs_itab LIKE LINE OF gt_itab.
* Table and work ares for the data from the XML file
DATA: gt_orders TYPE STANDARD TABLE OF typ_s_order,
gs_orders TYPE typ_s_order.
* Result table that contains references
* of the internal tables to be filled
DATA: gt_result_xml TYPE abap_trans_resbind_tab,
gs_result_xml TYPE abap_trans_resbind.
* For error handling
DATA: gs_rif_ex TYPE REF TO cx_root,
gs_var_text TYPE string.
* Get the XML file from your client
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = gs_file
CHANGING
data_tab = gt_itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Fill the result table with a reference to the data table.
* Within the XSLT stylesheet, the data table can be accessed with
* "IPERSON".
GET REFERENCE OF gt_orders INTO gs_result_xml-value.
gs_result_xml-name = 'ORDERS'.
APPEND gs_result_xml TO gt_result_xml.
* Perform the XSLT styleshee
TRY.
CALL TRANSFORMATION zfx_so_xml_to_abap
SOURCE XML gt_itab
RESULT (gt_result_xml).
CATCH cx_root INTO gs_rif_ex.
gs_var_text = gs_rif_ex->get_text( ).
MESSAGE gs_var_text TYPE 'S'.
ENDTRY.
LOOP AT gt_orders INTO gs_orders.
ENDLOOP.The simplest way seems to me is to use a XSL file for that. The <xsl:output> attributes doctype-system and doctype-public generate the DTD declaration <!DOCTYPE YOUR_ROOT SYSTEM "yourDTDfile.dtd"> and <!DOCTYPE YOUR_ROOT PUBLIC "yourDTDfile.dtd">, respectively.
When calling transformerInstance.transform() the XSLT processor performs the identity transformation - it just copies elements, attributes, content, processing instructions and comments to the result stream.
If you're using an xsl file for your transformation already, simply add <xsl:output doctype-system="yourDTDfile.dtd"/> to your existing XSL file.
If you're only using the identity transformation you'd need to change the line of code where you obtain the transformer instance from the TransformerFactory to:
t_factory.newTransformer(new StreamSource("test.xsl"));
and use this as test.xsl:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output doctype-system="yourDTDfile.dtd"/>
<!-- this is the identity transformation -->
<xsl:template match="*|@*|comment()|processing-instruction()|text()">
<xsl:copy>
<xsl:apply-templates select="*|@*|comment()|processing-instruction()|text()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>Good luck. -
Dynamic Table - Deep Structure
Hi Gurus,
this is my first posting, so be patient!
I want to create a deep structure dynamic table via method
cl_alv_table_create=>create_dynamic_table, is this possible? Are there tricks to make it happen?
Background: i wanna create an alv with dynamic fieldcatalalog, in this case i want to colour special fields, which is done by lvc_s_layo-?csp_fieldname? in combination with a field in my internal table which is typed ?lvc_t_scol?. Is this possible under 6.2.43
thanxs for your replies
juergen
- ?i dont actually know by rote the correct fieldnames of lvc_xxxxx?Hi Jurgen, I took on the challenge. This program provides a dynamic table with the ability to set the colors of the cells.
Create the structure ZCDF_CELL_COLOR in the dictionary as described in the program.
Create screen 100 as empty, with next screen set to 0, and the following flow logic:
PROCESS BEFORE OUTPUT.
MODULE initialization.
PROCESS AFTER INPUT.
REPORT zcdf_dynamic_table.
* Dynamic ALV Grid with Cell Coloring
DATA:
r_dyn_table TYPE REF TO data,
r_wa_dyn_table TYPE REF TO data,
r_dock_ctnr TYPE REF TO cl_gui_docking_container,
r_alv_grid TYPE REF TO cl_gui_alv_grid,
t_fieldcat1 TYPE lvc_t_fcat, "with cell color
t_fieldcat2 TYPE lvc_t_fcat, "without cell color
wa_fieldcat LIKE LINE OF t_fieldcat1,
wa_cellcolors TYPE LINE OF lvc_t_scol,
wa_is_layout TYPE lvc_s_layo.
FIELD-SYMBOLS:
<t_dyn_table> TYPE STANDARD TABLE,
<wa_dyn_table> TYPE ANY,
<t_cellcolors> TYPE lvc_t_scol,
<w_field> TYPE ANY.
START-OF-SELECTION.
* Build field catalog based on your criteria.
wa_fieldcat-fieldname = 'FIELD1'.
wa_fieldcat-inttype = 'C'.
wa_fieldcat-outputlen = '10'.
wa_fieldcat-coltext = 'My Field 1'.
wa_fieldcat-seltext = wa_fieldcat-coltext.
APPEND wa_fieldcat TO t_fieldcat1.
wa_fieldcat-fieldname = 'FIELD2'.
wa_fieldcat-inttype = 'C'.
wa_fieldcat-outputlen = '10'.
wa_fieldcat-coltext = 'My Field 2'.
wa_fieldcat-seltext = wa_fieldcat-coltext.
APPEND wa_fieldcat TO t_fieldcat1.
* Before adding cell color table,
* save fieldcatalog to pass
* to ALV call.
t_fieldcat2[] = t_fieldcat1[].
* Add cell color table.
* ZCDF_CELL_COLOR is a structure in the
* dictionary with one
* field called T_CELL_COLOR of type LVC_T_SCOL.
wa_fieldcat-fieldname = 'T_CELLCOLORS'.
wa_fieldcat-ref_field = 'T_CELL_COLOR'.
wa_fieldcat-ref_table = 'ZCDF_CELL_COLOR'.
APPEND wa_fieldcat TO t_fieldcat1.
* Create dynamic table.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fieldcat1
IMPORTING
ep_table = r_dyn_table
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Get access to new table using field symbol.
ASSIGN r_dyn_table->* TO <t_dyn_table>.
* Create work area for new table.
CREATE DATA r_wa_dyn_table LIKE LINE OF <t_dyn_table>.
* Get access to new work area using field symbol.
ASSIGN r_wa_dyn_table->* TO <wa_dyn_table>.
* Get data into table from somewhere. Field names are
* known at this point because field catalog is already
* built. Read field names from the field catalog or use
* COMPONENT <number> in a DO loop to access the fields.
* A simpler hard coded approach is used here.
ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table>
TO <w_field>.
<w_field> = 'ABC'.
ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table>
TO <w_field>.
<w_field> = 'XYZ'.
APPEND <wa_dyn_table> TO <t_dyn_table>.
ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table>
TO <w_field>.
<w_field> = 'TUV'.
ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table>
TO <w_field>.
<w_field> = 'DEF'.
APPEND <wa_dyn_table> TO <t_dyn_table>.
* Color cells based on your criteria.
* In this example, a test on
* FIELD2 is used to decide on color.
LOOP AT <t_dyn_table> INTO <wa_dyn_table>.
ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table>
TO <w_field>.
ASSIGN COMPONENT 'T_CELLCOLORS'
OF STRUCTURE <wa_dyn_table> TO <t_cellcolors>.
CLEAR wa_cellcolors.
wa_cellcolors-fname = 'FIELD2'.
IF <w_field> = 'DEF'.
wa_cellcolors-color-col = '7'.
ELSE.
wa_cellcolors-color-col = '5'.
ENDIF.
APPEND wa_cellcolors TO <t_cellcolors>.
MODIFY <t_dyn_table> FROM <wa_dyn_table>.
ENDLOOP.
CALL SCREEN 100.
* MODULE initialization OUTPUT
MODULE initialization OUTPUT.
* Set up for ALV display.
IF r_dock_ctnr IS INITIAL.
CREATE OBJECT r_dock_ctnr
EXPORTING
side =
cl_gui_docking_container=>dock_at_left
ratio = '90'.
CREATE OBJECT r_alv_grid
EXPORTING i_parent = r_dock_ctnr.
* Set ALV controls.
wa_is_layout-ctab_fname = 'T_CELLCOLORS'.
* Display.
CALL METHOD r_alv_grid->set_table_for_first_display
EXPORTING
is_layout = wa_is_layout
CHANGING
it_outtab = <t_dyn_table>
it_fieldcatalog = t_fieldcat2.
ELSE. "grids already prepared
* Refresh display.
CALL METHOD r_alv_grid->refresh_table_display
EXPORTING
i_soft_refresh = ' '
EXCEPTIONS
finished = 1
OTHERS = 2.
ENDIF.
ENDMODULE. " initialization OUTPUT -
Can we create a deep structure in RFC?
Hi,
My requirement is to create an RFC which has 3 output tables. out of which 1 table contains deep structure, but SAP is not allowing me to create an RFC with deep structure. Message shows only flat structures support in RFC. can any one tell is there any limitation of creating a deep structure in RFC?
Thanks,
Kumar.Instead of a deep structure, you can define another internal table in your signature which will hold all of the data for all of th records of the other internal table, you just need a key value from the other internal table to be able to map which records go with what record in the original internal table. Does this make sense?
Regards,
Rich Heilman -
Problem Mapping Deep Structure to Flat Structure
Hello,
I hope someone can help me. My scenario is idoc to file. I am collecting many idocs with a bpm and writing them out to one file. My bpm is working great, but my mapping program is not working properly. My source message is a deep structure and my target message is a flat structure.
See my example message formats below.
Source message:
zmessage (1..1)
+zidocmessage (0..unbounded)
++zidoc (1..1)
+++zidocheader (1..1)
++++zidocitem (0..unbounded)
Target Message:
zmessage (1..1)
+zfilemessage (1..1)
++zfilefirstrec (1..1)
++zfileheader (1..unbounded)
++zfileitem (1..unbounded)
I need to map zidocheader to zfileheader and zidocitem to zfileitem.
The Source Data:
<zmessage>
<zidocmessage>
<zidoc>
<zidocheader>
<hfield1>hf1</hfield1>
<hfield2>hf2</hfield2>
<zidocitem>
<ifield1>if1</ifield1>
<ifield2>if2</ifield2>
</zidocitem>
<zidocitem>
<ifield1>if1</ifield1>
<ifield2>if2</ifield2>
</zidocitem>
</zidocheader>
</idoc>
<zidocmessage>
<zidoc>
<zidocheader>
<hfield1>hf1</hfield1>
<hfield2>hf2</hfield2>
<zidocitem>
<ifield1>if1</ifield1>
<ifield2>if2</ifield2>
</zidocitem>
<zidocitem>
<ifield1>if1</ifield1>
<ifield2>if2</ifield2>
</zidocitem>
</zidocheader>
</idoc>
</zmessage>
The Target Data:
<zmessage>
<zfilemessage>
<zfilefirstrec>
<firstrecfield1>ff1</firstrecfield1>
<firstrecfield2>ff2</firstrecfield2>
</zfilefirstrec>
<zfileheader>
<hfield1>hf1</hfield1>
<hfield2>hf2</hfield2>
</zfileheader>
<zfileitem>
<ifield1>if1</ifield1>
<ifield2>if2</ifield2>
</zfileitem>
<zfileitem>
<ifield1>if1</ifield1>
<ifield2>if2</ifield2>
</zfileitem>
<zfileheader>
<hfield1>hf1</hfield1>
<hfield2>hf2</hfield2>
</zfileheader>
<zfileitem>
<ifield1>if1</ifield1>
<ifield2>if2</ifield2>
</zfileitem>
<zfileitem>
<ifield1>if1</ifield1>
<ifield2>if2</ifield2>
</zfileitem>
<zfilemessage>
</zmessage>
Can someone advise me on how to map this correctly?
Thank you,
RhondaHello,
Can someone please help me with this problem?
I am at the point where all of the records in my source message are being written out, however, all of the header records are together and all of the line item records are together. So, the target message is not in the proper sequence. It should contain the header record, then item records, header record, then item records, etc.
Is there anyone that can help me with this issue?
Thank you,
Rhonda -
Display Deep structures in ALV
Hi,
We have a requirement to display deep structures in ALV i.e. We have to show Sales Order texts in ALV and as you know it may extend to several lines and the user wants to see it at a glance for every item.I created a new internal table in the output table but field catalog is ignoring the same and not displaying in ALV.
I am using CL_SALV_TABLE factory method but of no help.Please suggest to display the deep structure in ALV.
Thanks in advance.
Regards,
Kranti Yamparala.Hi Kranthi,
we handle such tasks by displaying an icon showing the user that there is something more, in your case the long text. Define this column as hotspot and in the respective event create a popup screen or dialog box with a text edit control or another SALV control showing the long text or other details.
Users prefer a clear list not interrupted by any additional records but they will appreciate the functionality providing detalied information on request.
And, by the way, what do you expect should a deep-structure-ALV look like, what would you do in Excel?
Regards,
Clemens -
Hello all,
I am trying to create a button in each cell for one row of an ALV
Grid.
[http://help.sap.com/saphelp_erp2004/helpdata/en/88/387f380c2f2e3ce10000009b38f8cf/content.htm]
However I have problem with the part:
'If you want to display all cells of a row as pushbuttons, assign
the attribute cl_gui_alv_grid=>mc_style_button to the field style . In this case,
field fieldname remains empty'
I am not so skilled in this part, so please can anyone advice me how
to assign this attribute to the field of the deep structure??
Thanks a lot.Hi John,
To fill the Deep structure, you need write a code like this. Change it according to your requirement.
Data: begin of gt_outtab occurs 0,
<your fields>
ct type lvc_t_styl.
Data: end of gt_outtab.
Fill your data to this outtab.
****You need to write a code like this to fill the last field CT.
Data: ls_s_layo TYPE lvc_s_layo,
lt_t_layo TYPE lvc_t_layo.
As per your requirement we don't need to fill the field. Because all field are to be displayed as pushbuttons. So i commented.
*ls_s_layo-fieldname
ls_s_layo-style = cl_gui_alv_grid=>mc_style_button.
Append ls_s_layo to lt_t_layo.
Now loop thru the output table.
LOOP AT gt_outtab ASSIGNING <fs_outtab>.
<fs_outtab>-ct[] = lt_t_layo.
ENDLOOP.
Regards,
Sampath. -
Hello! Good day to you all!
I'm a begginer to the whole SAP R/3 system... and I have a question related to so-caled deep structures. Have I got an opportunity to describe a deep structure in fiedcatalog like I can do for a simple field?
Like...
ls_fieldcat-fieldname = 'O_TAB'.
where o_tab is an internal table...
P.S. Will be pleased with any suggested ideas and advices.. =)
Peace to everyone!Hi,
Check this code...
REPORT ZTEST1234 MESSAGE-ID ZZ .
DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: L_VALID TYPE C,
V_FLAG,
V_DATA_CHANGE,
V_ROW TYPE LVC_S_ROW,
V_COLUMN TYPE LVC_S_COL,
V_ROW_NUM TYPE LVC_S_ROID.
* CLASS lcl_event_handler DEFINITION
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
**Hot spot Handler
HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
**Double Click Handler
HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW E_COLUMN ES_ROW_NO.
ENDCLASS. "lcl_event_handler DEFINITION
* CLASS lcl_event_handler IMPLEMENTATION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
*Handle Hotspot Click
METHOD HANDLE_HOTSPOT_CLICK .
CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
V_ROW = E_ROW_ID.
V_COLUMN = E_COLUMN_ID.
V_ROW_NUM = ES_ROW_NO.
MESSAGE I000 WITH V_ROW 'clicked'.
ENDMETHOD. "lcl_event_handler
*Handle Double Click
METHOD HANDLE_DOUBLE_CLICK.
ENDMETHOD. "handle_double_click
ENDCLASS. "LCL_EVENT_HANDLER IMPLEMENTATION
*& Global Definitions
DATA: G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1
G_HANDLER TYPE REF TO LCL_EVENT_HANDLER. "handler
DATA: OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE SY-UCOMM,
G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST',
GS_LAYOUT TYPE LVC_S_LAYO.
*- Fieldcatalog for First and second Report
DATA: IT_FIELDCAT TYPE LVC_T_FCAT,
X_FIELDCAT TYPE LVC_S_FCAT,
LS_VARI TYPE DISVARIANT.
* START-OF_SELECTION
START-OF-SELECTION.
DATA:BEGIN OF ITAB OCCURS 0,
VBELN LIKE LIKP-VBELN,
POSNR LIKE LIPS-POSNR,
CELLCOLOR TYPE LVC_T_SCOL, "required for color
DROP(10),
END OF ITAB.
SELECT VBELN
POSNR
FROM LIPS
UP TO 20 ROWS
INTO CORRESPONDING FIELDS OF TABLE ITAB.
END-OF-SELECTION.
IF NOT ITAB[] IS INITIAL.
CALL SCREEN 100.
ELSE.
MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
ENDIF.
*& Form CREATE_AND_INIT_ALV
* text
FORM CREATE_AND_INIT_ALV .
DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING CONTAINER_NAME = G_CONTAINER1.
CREATE OBJECT G_GRID
EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
* Set a titlebar for the grid control
CLEAR GS_LAYOUT.
GS_LAYOUT-GRID_TITLE = TEXT-003.
GS_LAYOUT-ZEBRA = SPACE.
GS_LAYOUT-CWIDTH_OPT = 'X'.
GS_LAYOUT-NO_ROWMARK = 'X'.
GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
CALL METHOD G_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
CREATE OBJECT G_HANDLER.
SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
DATA: LS_CELLCOLOR TYPE LVC_S_SCOL. "required for color
DATA: L_INDEX TYPE SY-TABIX.
"Here i am changing the color of line 1,5,10...
"so you can change the color of font conditionally
LOOP AT ITAB.
L_INDEX = SY-TABIX.
IF L_INDEX = 1 OR L_INDEX = 5 OR L_INDEX = 10.
LS_CELLCOLOR-FNAME = 'VBELN'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '0'.
LS_CELLCOLOR-COLOR-INV = '1'.
APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
LS_CELLCOLOR-FNAME = 'POSNR'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '0'.
LS_CELLCOLOR-COLOR-INV = '1'.
APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
ENDIF.
ENDLOOP.
* setting focus for created grid control
CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
EXPORTING
CONTROL = G_GRID.
* Build fieldcat and set editable for date and reason code
* edit enabled. Assign a handle for the dropdown listbox.
PERFORM BUILD_FIELDCAT.
PERFORM SET_DRDN_TABLE.
* Optionally restrict generic functions to 'change only'.
* (The user shall not be able to add new lines).
PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
**Vaiant to save the layout
LS_VARI-REPORT = SY-REPID.
LS_VARI-HANDLE = SPACE.
LS_VARI-LOG_GROUP = SPACE.
LS_VARI-USERNAME = SPACE.
LS_VARI-VARIANT = SPACE.
LS_VARI-TEXT = SPACE.
LS_VARI-DEPENDVARS = SPACE.
**Calling the Method for ALV output
CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
IS_VARIANT = LS_VARI
IS_LAYOUT = GS_LAYOUT
I_SAVE = 'A'
CHANGING
IT_FIELDCATALOG = IT_FIELDCAT
IT_OUTTAB = ITAB[].
* Set editable cells to ready for input initially
CALL METHOD G_GRID->SET_READY_FOR_INPUT
EXPORTING
I_READY_FOR_INPUT = 1.
ENDFORM. "CREATE_AND_INIT_ALV
*& Form EXCLUDE_TB_FUNCTIONS
* text
* -->PT_EXCLUDE text
FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
* Only allow to change data not to create new entries (exclude
* generic functions).
DATA LS_EXCLUDE TYPE UI_FUNC.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
ENDFORM. " EXCLUDE_TB_FUNCTIONS
*& Form build_fieldcat
* Fieldcatalog
FORM BUILD_FIELDCAT .
DATA: L_POS TYPE I.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-NO_ZERO = 'X'.
X_FIELDCAT-OUTPUTLEN = '10'.
X_FIELDCAT-HOTSPOT = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Item'(025).
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Drop'(025).
X_FIELDCAT-FIELDNAME = 'DROP'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-DRDN_HNDL = '1'.
X_FIELDCAT-DRDN_ALIAS = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
ENDFORM. " build_fieldcat
*& Module STATUS_0100 OUTPUT
* text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
IF G_CUSTOM_CONTAINER IS INITIAL.
**Initializing the grid and calling the fm to Display the O/P
PERFORM CREATE_AND_INIT_ALV.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form SET_DRDN_TABLE
* text
FORM SET_DRDN_TABLE.
DATA:LT_DRAL TYPE LVC_T_DRAL,
LS_DRAL TYPE LVC_S_DRAL.
LOOP AT ITAB .
* First listbox (handle '1').
IF SY-INDEX = 1.
LS_DRAL-HANDLE = '1'.
LS_DRAL-VALUE = ' '.
LS_DRAL-INT_VALUE = ' '.
ELSE.
LS_DRAL-HANDLE = '1'.
LS_DRAL-VALUE = ITAB-POSNR.
LS_DRAL-INT_VALUE = ITAB-POSNR.
ENDIF.
APPEND LS_DRAL TO LT_DRAL.
ENDLOOP.
**Setting the Drop down table for Reason Code
CALL METHOD G_GRID->SET_DROP_DOWN_TABLE
EXPORTING
IT_DROP_DOWN_ALIAS = LT_DRAL.
ENDFORM. " set_drdn_table
Regards
vijay -
How can i map a file with different structures to several deep structures?
Hey experts,
here is my situation. I have to build a file2file scenario. The file has a flat structure without any separators. Depending on the value of the keyfield, i have to determinate, which kind of structure in the current sequence there is. Like i wrote, there isn't any fieldseparator, but for every possible structure (overall 4 types) i know the type by the length of every field in the structure.
My task is:
1. Read the file into PI and transform to XML
2. Map the flat structure depending on the keyvalue to the deep structure
3. Transform several fields in the different structures like the requirement
4. Write back the file via FTP as the same flat structure as before
Do you have any approach to solve the item number 2 (the other steps are clear for me)?
Do i need several mapping-programs? If so, how can i determinate the right mapping-program, deping on the keyvalue?
Thanks in advance
TobiHere the inbound payload:
<?xml version="1.0" encoding="utf-8" ?>
- <ns:MT_MULTI_TYPES xmlns:ns="namespace">
- <VORSATZ>
<ZSATA>0</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>000</BUZEI>
<ERDAT>20080905</ERDAT>
<UZEIT>000549</UZEIT>
<ZPROG>PGRR3010</ZPROG>
<ZLIEF>T</ZLIEF>
<START>20080905</START>
<ZFILL />
<ZENDE>E</ZENDE>
</VORSATZ>
- <KOPFSATZ>
<ZSATA>1</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>000</BUZEI>
<BUDAT>20080904</BUDAT>
<BLDAT>20080904</BLDAT>
<XBLNR />
<WAERS />
<HWAE2>EUR</HWAE2>
<HWAE3 />
<KURS2>000000000</KURS2>
<KURS3>000000000</KURS3>
<BKTXT />
<ZFILK />
<ZENDE>E</ZENDE>
</KOPFSATZ>
- <POSITIONSSATZ>
<ZSATA>4</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>001</BUZEI>
<KOART>S</KOART>
<SHKZG>S</SHKZG>
<NEWKO>30611102</NEWKO>
<GSBER>17AB</GSBER>
<ZUBUK />
<VBUND />
<WRBTR>0000000000000</WRBTR>
<ZBTR1>0000000057576</ZBTR1>
<ZBTR2>0000000000000</ZBTR2>
<ZSTEU />
<VALUT>20080904</VALUT>
<KOSTL />
<AUFNR />
<ZUONR>X4025V64RE460XXXXX</ZUONR>
<SGTXT>REX</SGTXT>
<BEWAR />
<ZFPOS />
<ZENDE>E</ZENDE>
</POSITIONSSATZ>
- <POSITIONSSATZ>
<ZSATA>4</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>009</BUZEI>
<KOART>S</KOART>
<SHKZG>S</SHKZG>
<NEWKO>20519109</NEWKO>
<GSBER>17AB</GSBER>
<ZUBUK />
<VBUND />
<WRBTR>0000000000000</WRBTR>
<ZBTR1>0000000021070</ZBTR1>
<ZBTR2>0000000000000</ZBTR2>
<ZSTEU />
<VALUT>20080904</VALUT>
<KOSTL />
<AUFNR />
<ZUONR>X4025V64RE460XXXXX</ZUONR>
<SGTXT>REX</SGTXT>
<BEWAR />
<ZFPOS />
<ZENDE>E</ZENDE>
</POSITIONSSATZ>
- <POSITIONSSATZ>
<ZSATA>4</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>010</BUZEI>
<KOART>S</KOART>
<SHKZG>S</SHKZG>
<NEWKO>20519109</NEWKO>
<GSBER>17AA</GSBER>
<ZUBUK />
<VBUND />
<WRBTR>0000000000000</WRBTR>
<ZBTR1>0000000009796</ZBTR1>
<ZBTR2>0000000000000</ZBTR2>
<ZSTEU />
<VALUT>20080904</VALUT>
<KOSTL />
<AUFNR />
<ZUONR>X4027V63RE460XXXXX</ZUONR>
<SGTXT>REX</SGTXT>
<BEWAR />
<ZFPOS />
<ZENDE>E</ZENDE>
</POSITIONSSATZ>
- <NACHSATZ>
<ZSATA>9</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>010</BUZEI>
<ERDAT>20080905</ERDAT>
<UZEIT>000549</UZEIT>
<ZPROG>PGRR3010</ZPROG>
<ZZSOL>000000000359502</ZZSOL>
<ZZHAB>000000000359502</ZZHAB>
<ZZBEL>0000001</ZZBEL>
<ZZPOS>000000010</ZZPOS>
<ZFILN />
<ZENDE>E</ZENDE>
</NACHSATZ>
- <VORSATZ>
<ZSATA>0</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>000</BUZEI>
<ERDAT>20080905</ERDAT>
<UZEIT>000549</UZEIT>
<ZPROG>PGRR3010</ZPROG>
<ZLIEF>T</ZLIEF>
<START>20080905</START>
<ZFILL />
<ZENDE>E</ZENDE>
</VORSATZ>
- <KOPFSATZ>
<ZSATA>1</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>000</BUZEI>
<BUDAT>20080904</BUDAT>
<BLDAT>20080904</BLDAT>
<XBLNR />
<WAERS />
<HWAE2>EUR</HWAE2>
<HWAE3 />
<KURS2>000000000</KURS2>
<KURS3>000000000</KURS3>
<BKTXT />
<ZFILK />
<ZENDE>E</ZENDE>
</KOPFSATZ>
- <POSITIONSSATZ>
<ZSATA>4</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>001</BUZEI>
<KOART>S</KOART>
<SHKZG>S</SHKZG>
<NEWKO>30611102</NEWKO>
<GSBER>17AB</GSBER>
<ZUBUK />
<VBUND />
<WRBTR>0000000000000</WRBTR>
<ZBTR1>0000000057576</ZBTR1>
<ZBTR2>0000000000000</ZBTR2>
<ZSTEU />
<VALUT>20080904</VALUT>
<KOSTL />
<AUFNR />
<ZUONR>X4025V64RE460XXXXX</ZUONR>
<SGTXT>REX</SGTXT>
<BEWAR />
<ZFPOS />
<ZENDE>E</ZENDE>
</POSITIONSSATZ>
- <POSITIONSSATZ>
<ZSATA>4</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>009</BUZEI>
<KOART>S</KOART>
<SHKZG>S</SHKZG>
<NEWKO>20519109</NEWKO>
<GSBER>17AB</GSBER>
<ZUBUK />
<VBUND />
<WRBTR>0000000000000</WRBTR>
<ZBTR1>0000000021070</ZBTR1>
<ZBTR2>0000000000000</ZBTR2>
<ZSTEU />
<VALUT>20080904</VALUT>
<KOSTL />
<AUFNR />
<ZUONR>X4025V64RE460XXXXX</ZUONR>
<SGTXT>REX</SGTXT>
<BEWAR />
<ZFPOS />
<ZENDE>E</ZENDE>
</POSITIONSSATZ>
- <POSITIONSSATZ>
<ZSATA>4</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>010</BUZEI>
<KOART>S</KOART>
<SHKZG>S</SHKZG>
<NEWKO>20519109</NEWKO>
<GSBER>17AA</GSBER>
<ZUBUK />
<VBUND />
<WRBTR>0000000000000</WRBTR>
<ZBTR1>0000000009796</ZBTR1>
<ZBTR2>0000000000000</ZBTR2>
<ZSTEU />
<VALUT>20080904</VALUT>
<KOSTL />
<AUFNR />
<ZUONR>X4027V63RE460XXXXX</ZUONR>
<SGTXT>REX</SGTXT>
<BEWAR />
<ZFPOS />
<ZENDE>E</ZENDE>
</POSITIONSSATZ>
- <NACHSATZ>
<ZSATA>9</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>010</BUZEI>
<ERDAT>20080905</ERDAT>
<UZEIT>000549</UZEIT>
<ZPROG>PGRR3010</ZPROG>
<ZZSOL>000000000359502</ZZSOL>
<ZZHAB>000000000359502</ZZHAB>
<ZZBEL>0000001</ZZBEL>
<ZZPOS>000000010</ZZPOS>
<ZFILN />
<ZENDE>E</ZENDE>
</NACHSATZ>
</ns:MT_MULTI_TYPES>
And here the outbound payload:
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:MT_MULTI_TYPES xmlns:ns0="namespace">
- <VORSATZ>
<ZSATA>0</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>000</BUZEI>
<ERDAT>20080905</ERDAT>
<UZEIT>000549</UZEIT>
<ZPROG>PGRR3010</ZPROG>
<ZLIEF>T</ZLIEF>
<START>20080905</START>
<ZFILL />
<ZENDE>E</ZENDE>
</VORSATZ>
- <VORSATZ>
<ZSATA>0</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>000</BUZEI>
<ERDAT>20080905</ERDAT>
<UZEIT>000549</UZEIT>
<ZPROG>PGRR3010</ZPROG>
<ZLIEF>T</ZLIEF>
<START>20080905</START>
<ZFILL />
<ZENDE>E</ZENDE>
</VORSATZ>
- <KOPFSATZ>
<ZSATA>1</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>000</BUZEI>
<BUDAT>20080904</BUDAT>
<BLDAT>20080904</BLDAT>
<XBLNR />
<WAERS />
<HWAE2>EUR</HWAE2>
<HWAE3 />
<KURS2>000000000</KURS2>
<KURS3>000000000</KURS3>
<BKTXT />
<ZFILK />
<ZENDE>E</ZENDE>
</KOPFSATZ>
- <KOPFSATZ>
<ZSATA>1</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>000</BUZEI>
<BUDAT>20080904</BUDAT>
<BLDAT>20080904</BLDAT>
<XBLNR />
<WAERS />
<HWAE2>EUR</HWAE2>
<HWAE3 />
<KURS2>000000000</KURS2>
<KURS3>000000000</KURS3>
<BKTXT />
<ZFILK />
<ZENDE>E</ZENDE>
</KOPFSATZ>
- <POSITIONSSATZ>
<ZSATA>4</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>001</BUZEI>
<KOART>S</KOART>
<SHKZG>S</SHKZG>
<NEWKO>30611102</NEWKO>
<GSBER>17AB</GSBER>
<ZUBUK />
<VBUND />
<WRBTR>0000000000000</WRBTR>
<ZBTR1>0000000057576</ZBTR1>
<ZBTR2>0000000000000</ZBTR2>
<ZSTEU />
<VALUT>20080904</VALUT>
<KOSTL />
<AUFNR />
<ZUONR>X4025V64RE460XXXXX</ZUONR>
<SGTXT>REX</SGTXT>
<BEWAR />
<ZFPOS />
<ZENDE>E</ZENDE>
</POSITIONSSATZ>
- <POSITIONSSATZ>
<ZSATA>4</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>009</BUZEI>
<KOART>S</KOART>
<SHKZG>S</SHKZG>
<NEWKO>20519109</NEWKO>
<GSBER>17AB</GSBER>
<ZUBUK />
<VBUND />
<WRBTR>0000000000000</WRBTR>
<ZBTR1>0000000021070</ZBTR1>
<ZBTR2>0000000000000</ZBTR2>
<ZSTEU />
<VALUT>20080904</VALUT>
<KOSTL />
<AUFNR />
<ZUONR>X4025V64RE460XXXXX</ZUONR>
<SGTXT>REX</SGTXT>
<BEWAR />
<ZFPOS />
<ZENDE>E</ZENDE>
</POSITIONSSATZ>
- <POSITIONSSATZ>
<ZSATA>4</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>010</BUZEI>
<KOART>S</KOART>
<SHKZG>S</SHKZG>
<NEWKO>20519109</NEWKO>
<GSBER>17AA</GSBER>
<ZUBUK />
<VBUND />
<WRBTR>0000000000000</WRBTR>
<ZBTR1>0000000009796</ZBTR1>
<ZBTR2>0000000000000</ZBTR2>
<ZSTEU />
<VALUT>20080904</VALUT>
<KOSTL />
<AUFNR />
<ZUONR>X4027V63RE460XXXXX</ZUONR>
<SGTXT>REX</SGTXT>
<BEWAR />
<ZFPOS />
<ZENDE>E</ZENDE>
</POSITIONSSATZ>
- <POSITIONSSATZ>
<ZSATA>4</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>001</BUZEI>
<KOART>S</KOART>
<SHKZG>S</SHKZG>
<NEWKO>30611102</NEWKO>
<GSBER>17AB</GSBER>
<ZUBUK />
<VBUND />
<WRBTR>0000000000000</WRBTR>
<ZBTR1>0000000057576</ZBTR1>
<ZBTR2>0000000000000</ZBTR2>
<ZSTEU />
<VALUT>20080904</VALUT>
<KOSTL />
<AUFNR />
<ZUONR>X4025V64RE460XXXXX</ZUONR>
<SGTXT>REX</SGTXT>
<BEWAR />
<ZFPOS />
<ZENDE>E</ZENDE>
</POSITIONSSATZ>
- <POSITIONSSATZ>
<ZSATA>4</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>009</BUZEI>
<KOART>S</KOART>
<SHKZG>S</SHKZG>
<NEWKO>20519109</NEWKO>
<GSBER>17AB</GSBER>
<ZUBUK />
<VBUND />
<WRBTR>0000000000000</WRBTR>
<ZBTR1>0000000021070</ZBTR1>
<ZBTR2>0000000000000</ZBTR2>
<ZSTEU />
<VALUT>20080904</VALUT>
<KOSTL />
<AUFNR />
<ZUONR>X4025V64RE460XXXXX</ZUONR>
<SGTXT>REX</SGTXT>
<BEWAR />
<ZFPOS />
<ZENDE>E</ZENDE>
</POSITIONSSATZ>
- <POSITIONSSATZ>
<ZSATA>4</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>010</BUZEI>
<KOART>S</KOART>
<SHKZG>S</SHKZG>
<NEWKO>20519109</NEWKO>
<GSBER>17AA</GSBER>
<ZUBUK />
<VBUND />
<WRBTR>0000000000000</WRBTR>
<ZBTR1>0000000009796</ZBTR1>
<ZBTR2>0000000000000</ZBTR2>
<ZSTEU />
<VALUT>20080904</VALUT>
<KOSTL />
<AUFNR />
<ZUONR>X4027V63RE460XXXXX</ZUONR>
<SGTXT>REX</SGTXT>
<BEWAR />
<ZFPOS />
<ZENDE>E</ZENDE>
</POSITIONSSATZ>
- <NACHSATZ>
<ZSATA>9</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>010</BUZEI>
<ERDAT>20080905</ERDAT>
<UZEIT>000549</UZEIT>
<ZPROG>PGRR3010</ZPROG>
<ZZSOL>000000000359502</ZZSOL>
<ZZHAB>000000000359502</ZZHAB>
<ZZBEL>0000001</ZZBEL>
<ZZPOS>000000010</ZZPOS>
<ZFILN />
<ZENDE>E</ZENDE>
</NACHSATZ>
- <NACHSATZ>
<ZSATA>9</ZSATA>
<MANDT>001</MANDT>
<BUKRS>0560</BUKRS>
<BLART>8F</BLART>
<BELNR>1816008128</BELNR>
<BUZEI>010</BUZEI>
<ERDAT>20080905</ERDAT>
<UZEIT>000549</UZEIT>
<ZPROG>PGRR3010</ZPROG>
<ZZSOL>000000000359502</ZZSOL>
<ZZHAB>000000000359502</ZZHAB>
<ZZBEL>0000001</ZZBEL>
<ZZPOS>000000010</ZZPOS>
<ZFILN />
<ZENDE>E</ZENDE>
</NACHSATZ>
</ns0:MT_MULTI_TYPES> -
Create a deep structure for dynamic internal table
Hi All,
I am creating a dynamic table using method cl_alv_table_create=>create_dynamic_table.
The normal structure gets created. but now I want to creat a Deep structure for having information of colors also for each column. So I want to add a COLTAB type LVC_T_SCOL for colors information .
How should I create this using above method?
Rgds,
MadhuriI created a zcelltab structure as below. But while creating dynamic internal table, I received the error with
'Type "ZCELLTAB" is unknown 68 ZCELLTAB-CELLTAB
Here is the code.
DATA: BEGIN OF ZCELLTAB,
CELLTAB LIKE LVC_S_STYL,
END OF ZCELLTAB.
FIELD-SYMBOLS <T_CELLTAB> TYPE LVC_T_STYL.
DATA : LT_CELLTAB TYPE LVC_T_STYL.
DATA: WA_CELLTAB TYPE LINE OF LVC_T_STYL.
DATA: GT_FCAT1 TYPE LVC_T_FCAT,
GW_FCAT1 TYPE LVC_S_FCAT,
GT_FCAT2 TYPE LVC_T_FCAT,
GW_FCAT2 TYPE LVC_S_FCAT.
After filling the FCAT1, I added the field in FCAT2 like below
GT_FCAT2[ ] = GT_FCAT1[ ].
G_TABIX = G_TABIX + 1.
GW_FCAT2-INTTYPE = 'C'.
MOVE G_TABIX TO GW_FCAT2-COL_POS.
GW_FCAT2-OUTPUTLEN = '10'.
GW_FCAT2-FIELDNAME = 'T_CELLTAB'.
GW_FCAT2-TABNAME = 'ZCELLTAB'.
GW_FCAT2-REF_FIELD = 'CELLTAB'.
GW_FCAT2-REF_TABLE = 'ZCELLTAB'.
APPEND GW_FCAT2 TO GT_FCAT2
CLEAR GW_FCAT2.
While calling the below method, the error with
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = GT_FCAT2
IMPORTING
EP_TABLE = GT_REQ.
ASSIGN GT_REQ->* TO <F_TAB>.
CREATE DATA GWA_REQ LIKE LINE OF <F_TAB>.
ASSIGN GWA_REQ->* TO <F_WA>.
LOOP AT ITAB.
ASSIGN COMPONENT 'MATNR' OF STRUCTURE <F_WA> TO <F_VAL>
<F_VAL> = ITAB-MATNR.
IF ITAB-MATNR IS INITIAL.
ASSIGN COMPONENT 'T_CELLTAB' OF STRUCTURE <F_WA> TO <T_CELLTAB>
CLEAR WA_CELLTAB.
WA_CELLTAB-FIELDNAME = 'MATNR'.
WA_CELLTAB-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
INSERT WA_CELLTAB INTO TABLE <T_CELLTAB>.
ENDIF.
APPEND <F_WA> TO <F_TAB>
ENDLOOP.
CALL METHOD GR_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_CONSISTENCY_CHECK = G_CONSISTENCY_CHECK
IT_TOOLBAR_EXCLUDING = G_EXCLUDE
I_SAVE = G_SAVE
I_DEFAULT = 'X'
IS_LAYOUT = G_LAYOUT
CHANGING
IT_OUTTAB = <F_TAB>
IT_FIELDCATALOG = F_CAT1.
Please let me know where I was wrong.
Should I remove the T_CELLTAB as the field name is not mentioned in the structure 'ZCELLTAB'.
Thanks,
Kumar.
Edited by: venn e on May 7, 2010 4:10 PM
Maybe you are looking for
-
Control File and SPFILE Autobackup command struck
O.S Version: Linux Version "Red Hat Enterprise Linux Server release 6.2 (Santiago) Linux version 2.6.32-220.13.1.el6.x86_64 ([email protected]) (gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) ) #1 SMP Thu Mar 29 11:46:40 EDT
-
I am calling a Pl/sql function in a select query which has a statement as below SELECT SUBSTR(5/2,2,1) INTO m_delim FROM DUAL; The number of records returned from the calling select query is more 1 million. How much adversly the query from DUAL table
-
Cannot Check out controlled GPO's
Hello, When i want to check out a policy in AGPM. I get the following error message: The overall error was: Check Out operation failed. Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) I have checked the permissions of the ser
-
I have Camera Raw 8.7.1 and I don't have camera raw filter and the radial filter tool
I have Camera Raw 8.7.1 and I don't have camera raw filter or the radial filter tool. Reading on line says it should be available? I am confused... why do I not have these tools?
-
Hi, I've just installed this patch: http://sunsolve.sun.com/search/document.do?assetkey=1-21-139162-01-1 Which, among other things, it says: 6646791 Outlook connector to implement its own UI for Out-of-Office functionality. I applied the patch and re