Xml to abap internal table by using a dynamic internal table at runtime
Hi ,
I have a requirement to convert xml to abap internal table . But the requirement is that i need to create internal table according to the XML .
Ex : If my XML is :
<?xml version="1.0" ?>
- <flights>
- <airline code="AA" name="American Airlines">
- <flight number="0017">
<from airport="JFK">NEW YORK,US</from>
<to airport="SFO">SAN FRANCISCO,US</to>
<departure>110000</departure>
<arrival>140100</arrival>
<type>Scheduled</type>
</flight>
- <flight number="0064">
<from airport="SFO">SAN FRANCISCO,US</from>
<to airport="JFK">NEW YORK,US</to>
<departure>090000</departure>
<arrival>172100</arrival>
<type>Scheduled</type>
</flight>
</airline>
So after conversion my abap internal table shoul have fields as :
airline_code Name flight_number from_airport to_airport departure arrival type
and the field values should be corresponding field values .
Thanks in advance .
Regards .
Hi Ujjwal,
use
CALL TRANSFORMATION
Study the online documentation and if required do some search for CALL TRANSFORMATION and/or XML PARSER
And, when coming back here with next question, tell us what searches you did with what results - please always follow the 'search before post' rule, thank you.
Regards,
Clemens
Similar Messages
-
Passing values to an internal table and use it with the table painter
Hi,
I have seen this topic here before but the answers didn't help me. Maybe I,m doing something wrong.
The problem is that I defined the following structure on the |Types| tab of the |Global Definitions| section:
TYPES: BEGIN OF DETAILS,
EBELP TYPE EKPO-EBELP,
BSMNG TYPE EBAN-BSMNG,
LFDAT TYPE RM06P-LFDAT,
END OF DETAILS.
Then defined the following definition on the |Global Data| section:
WA_DETAILS TYPE STANDARD TABLE OF DETAILS WITH HEADER LINE
The problem is that when I try to assign a value to one of the fields in the program code like this:
LOOP AT WA_EKPO.
WA_DETAILS-EBELP = WA_EKPO-EBELP.
WA_DETAILS-EMATN = WA_EKPO-EMATN.
MODIFY WA_DETAILS.
ENDLOOP.
gives me the following error:
"WA_DETAILS" is not an internal table -the "OCCURS n" specification is missing.
Then if I add the "OCCURS 10" to the definition of the Global Data the error "OCCURS 10" is not expected.
How can I define, assign values and use as a parameter an internal table defined with types for use it with the table painter?Hi,
if it is one record in wa_details. you can directly write as follows..
REPORT ZCR_TEST1 .
TYPES: BEGIN OF details,
ebelp TYPE ekpo-ebelp,
bsmng TYPE eban-bsmng,
lfdat TYPE rm06p-lfdat,
ematn TYPE ekpo-ematn,
END OF details.
DATA: wa_details TYPE STANDARD TABLE OF details WITH HEADER LINE,
wa_ekpo TYPE STANDARD TABLE OF details WITH HEADER LINE.
wa_details-ebelp = '1'.
append wa_details.
wa_ekpo-ebelp = '3'.
append wa_ekpo.
LOOP AT wa_ekpo.
wa_ekpo-ebelp = wa_details-ebelp.
wa_ekpo-ematn = wa_details-ematn.
modify wa_ekpo.
endloop.
Normally it wont be one record, so u need to put <b>read statement with key</b> in LOOP and ENDLOOP.
Regards,
Sriram -
Hi,
Simple question for the ODI guru's.. for an interface that we use, there is a requirement to dynamically look-up value's in a lookup table and then use these value's from the lookup table to write to a target table.
This instead of hard coding string value's in the target table of the interface.
ODI (11g) gives the option to use a lookup table, but it kind of assumes a relationship between the lookup table and source table - ie.it nicely allows you specify either an outer join or a subquery in the select statement.
In this case, using the lookup, there is none however - no relationship between either lookup and source columns. So how would you do this?
An outer join could be used, but then it requires to specify a join on columns of the source and lookup tables, so you could use dummy columns, but that is not ideal as columns might actually match. Any ideas?
CheersIf there is no relationship between the values in your source table and those in the lookup table I can't see how you expect to perform a lookup - without a relationship it would be guesswork. For your requirements you would have to define a link table which held the associations between the 2 tables.
-
How to create table field inside the dynamically created table?
Hi, All!
I have created dynamic internal table (using field catalog and CALL METHOD cl_alv_table_create=>create_dynamic_table )
and put this table into FM REUSE_ALV_GRID_DISPLAY. ALV grid work. Now I need to color rows of my ALV, therefore I have to insert new column with name "COLORS" and type lvc_t_scol. I see three ways to do it , but all ones are unsuccessful:
1. Insert column into field catalog. FM REUSE_ALV_FIELDCATALOG_MERGE does not return info about "COLORS" I guess because COLORS is a table.
2. Insert column into field catalog manually. It provides a short dump during dynamic table creating or during call of REUSE_ALV_GRID_DISPLAY.
3. Create dyn table first, then add new field . I could not find a way how to do it :(((((((
Can somebody help me?
TatianaHi,
Here is the solution for this problem, Sample code:
*& Report ZCHA_ALV_GRID_CELL_COLOR *
REPORT ZCHA_ALV_GRID_CELL_COLOR .
TABLES:MARA.
DATA: W_CONTAINER TYPE SCRFNAME VALUE 'ALV_CONTAINER',
W_GRID TYPE REF TO CL_GUI_ALV_GRID,
W_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
W_EVENT_RECEIVER TYPE REF TO LCL_EVENT_RECEIVER.
*layout
DATA: WA_LAYOUT TYPE LVC_S_LAYO.
*field catalog
DATA: IT_FIELDCAT_WRT_OFF TYPE LVC_T_FCAT,
WA_FIELDCAT_WRT_OFF TYPE LVC_S_FCAT.
DATA:BEGIN OF IT_MARA OCCURS 0,
MATNR LIKE MARA-MATNR,
MAKTX LIKE MAKT-MAKTX,
CELLCOLORS TYPE LVC_T_SCOL,
END OF IT_MARA.
SELECT P~MATNR
Q~MAKTX
INTO CORRESPONDING FIELDS OF TABLE IT_MARA
FROM MARA AS P INNER JOIN
MAKT AS Q ON
PMATNR = QMATNR.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'STATUS'.
SET TITLEBAR 'xxx'.
IF NOT W_CONTAINER IS INITIAL.
CREATE OBJECT W_CUSTOM_CONTAINER
EXPORTING CONTAINER_NAME = W_CONTAINER.
CREATE OBJECT W_GRID
EXPORTING I_PARENT = W_CUSTOM_CONTAINER.
ENDIF.
CLEAR IT_FIELDCAT_WRT_OFF.
REFRESH IT_FIELDCAT_WRT_OFF.
WA_FIELDCAT_WRT_OFF-FIELDNAME = 'MATNR'.
WA_FIELDCAT_WRT_OFF-COL_POS = '1'.
WA_FIELDCAT_WRT_OFF-OUTPUTLEN = '35'.
WA_FIELDCAT_WRT_OFF-SCRTEXT_L = 'Material No'.
APPEND WA_FIELDCAT_WRT_OFF TO IT_FIELDCAT_WRT_OFF.
CLEAR WA_FIELDCAT_WRT_OFF.
WA_FIELDCAT_WRT_OFF-FIELDNAME = 'MAKTX'.
WA_FIELDCAT_WRT_OFF-COL_POS = '2'.
WA_FIELDCAT_WRT_OFF-OUTPUTLEN = '45'.
WA_FIELDCAT_WRT_OFF-SCRTEXT_L = 'Material Desc'.
APPEND WA_FIELDCAT_WRT_OFF TO IT_FIELDCAT_WRT_OFF.
CLEAR WA_FIELDCAT_WRT_OFF.
DATA LS_CELLCOLOR TYPE LVC_S_SCOL.
READ TABLE IT_MARA INDEX 5 .
LS_CELLCOLOR-FNAME = 'MATNR'.
LS_CELLCOLOR-COLOR-COL = '3'.
LS_CELLCOLOR-COLOR-INT = '1'.
APPEND LS_CELLCOLOR TO IT_MARA-CELLCOLORS.
MODIFY IT_MARA INDEX 5.
WA_LAYOUT-CTAB_FNAME = 'CELLCOLORS'.
CALL METHOD W_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = WA_LAYOUT
CHANGING
IT_FIELDCATALOG = IT_FIELDCAT_WRT_OFF
IT_OUTTAB = IT_MARA[].
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
Try to assign appropriate points.
Regards,
Suman -
Table format used in the 'sums' table
Hello,
If you ask numbers to insert a table of the type 'sums', then a table is inserted which has a a thick white line above the last row.
I have many tables and I would like to format them like the sum table.
Therefore, I would like to know how I can insert a thick white line above the last row?
Thanks,
SanjayPlease open Numbers then click Help > Numbers User Guide, it contains much useful information. If after doing all that you cannot find your question or an appropriate answer to your question then by all means come back and ask your question. We'll be pleased to assist you.
These discussions are user to user, not Apple employees answering the question. Questions will be answered as a user such as yourself finds time, desires to, or is willing to respond.
Welcome to Numbers discussions, have fun.
Sincerely,
Yvan KOENIG (from FRANCE dimanche 2 novembre 2008 11:28:16) -
Using XSLT to link XML and ABAP data
Hi Experts,
I am using XSLT to deal with XML and ABAP data.
I using the following statement to convert a Internal Table to XML String:
CALL TRANSFORMATION id SOURCE root = lt_sflight RESULT XML l_xml_string.
And I get the XML String:
<?xml version="1.0" encoding="utf-16" ?>
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<ROOT>
<SFLIGHT>
</SFLIGHT>
<SFLIGHT>
</SFLIGHT>
</ROOT>
</asx:values>
</asx:abap>
But What I expected is:
<?xml version="1.0" encoding="utf-16" ?>
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<ROOT>
<DATA>
</DATA>
<DATA>
</DATA>
</ROOT>
</asx:values>
</asx:abap>
Could you tell me how to get my dream format using XSLT?
Best Regards,
Guo Guo Qing
Edited by: guoqing guo on Jun 11, 2008 9:58 AMHi Experts,
I am using XSLT to deal with XML and ABAP data.
I using the following statement to convert a Internal Table to XML String:
CALL TRANSFORMATION id SOURCE root = lt_sflight RESULT XML l_xml_string.
And I get the XML String:
<?xml version="1.0" encoding="utf-16" ?>
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<ROOT>
<SFLIGHT>
</SFLIGHT>
<SFLIGHT>
</SFLIGHT>
</ROOT>
</asx:values>
</asx:abap>
But What I expected is:
<?xml version="1.0" encoding="utf-16" ?>
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<ROOT>
<DATA>
</DATA>
<DATA>
</DATA>
</ROOT>
</asx:values>
</asx:abap>
Could you tell me how to get my dream format using XSLT?
Best Regards,
Guo Guo Qing
Edited by: guoqing guo on Jun 11, 2008 9:58 AM -
Hi Experts, I need help with this XSLT for call transformation. I have defined an internal table and intend to use it as a source for Call Tranformation. But I have Problems to defining my internal table to get the resut of the function transformation.(SAP 4.7)
In my case i have a xml with attibutes and i can't store these attibutes in internal table.
Hope to hear from any of u soon!
CMA
<--XSLT--
>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/abapxml" version="1.0">
<xsl:template match="//Catalog">
<asx:abap xmlns:asx="http://www.sap.com/abapxml">
<asx:values>
<CATALOG>
<!-- Boucle catalogue -->
<xsl:for-each select="EnTete">
<ENTETE>
<EMETTEUR>
<xsl:value-of select="Emetteur"/>
</EMETTEUR>
<DATEPUBLICATION>
<xsl:value-of select="DatePublication"/>
</DATEPUBLICATION>
<!-- Suite -->
<xsl:for-each select="Univers">
<UNIVERS>
<LIBELLE>
<xsl:value-of select="@libelle"/>
</LIBELLE>
<OBJREF>
<xsl:value-of select="@objref"/>
</OBJREF>
<OBJID>
<xsl:value-of select="@objid"/>
</OBJID>
<EMETTEUR>
<xsl:value-of select="Emetteur"/>
</EMETTEUR>
</UNIVERS>
</xsl:for-each>
</ENTETE>
</xsl:for-each>
<!-- ENTETE-->
</CATALOG>
</asx:values>
</asx:abap>
</xsl:template>
</xsl:transform>
<--XML--
>
<?xml version="1.0" encoding="UTF-8"?>
<asx:abap xmlns:asx="http://www.sap.com/abapxml">
<asx:values>
<Catalog>
<EnTete>
<Emetteur>UGAP</Emetteur>
<DatePublication>27/06/2007 09:20:02</DatePublication>
<Univers libelle="Nettoyage, hygine et entretien" objref="08" objid="374417o.bemp" >
<Emetteur>UGAP</Emetteur>
</Univers>
<Univers libelle="Nettoyage, hygine et entretien" objref="09" objid="374417o.bemp" >
<Emetteur>UGAP</Emetteur>
</Univers>
</EnTete>
</Catalog>
</asx:values>
</asx:abap>
<--abap--
>
TYPES: BEGIN OF t_universs,
libelle(35),
objref(35),
objid(35),
boutique TYPE t_boutique,
END OF t_universs.
TYPES: t_univers TYPE t_universs OCCURS 0.
UNIVERS *
TYPES: BEGIN OF t_entetes,
Emetteur(20),
DatePublication(30),
UNIVERS TYPE t_univers,
END OF t_entetes.
*TYPES: t_entete TYPE t_entetes OCCURS 0.
DATA: it_data TYPE STANDARD TABLE OF t_entetes,
wa_data TYPE t_entetes.
PARAMETER p_file(200) DEFAULT '/tmp/catalogue4.xml' LOWER CASE .
start-of-selection.
DATA: dsn(20) VALUE '/usr/catalogue2.xml',
msg(100).
data : l_sysubrc like sy-subrc.
*OPEN DATASET p_file FOR INPUT MESSAGE msg
IN TEXT MODE ENCODING DEFAULT.
OPEN DATASET p_file FOR INPUT IN BINARY MODE.
IF sy-subrc = 0.
CLEAR : gv_read_xml.
clear l_sysubrc.
READ DATASET p_file INTO gv_read_xml.
Transformation XML en ABAP-DATA
PERFORM check_xml USING gv_read_xml.
CLOSE DATASET p_file.
ENDIF.
*& Form check_xml
FORM check_xml USING p_xml TYPE string.
DATA: cx_runtime_error TYPE REF TO cx_xslt_runtime_error.
DATA: cx_format_error TYPE REF TO cx_xslt_format_error.
DATA: err_text TYPE string.
DATA: lt_xml TYPE STANDARD TABLE OF typ_xml,
ls_xml TYPE typ_xml,
source_xml TYPE string,
lt_result_xml TYPE abap_trans_resbind_tab,
ls_result_xml TYPE abap_trans_resbind.
TRY.
CALL TRANSFORMATION ZUGAP
SOURCE XML p_xml
RESULT CATALOG = it_data.
ENDTRY.
LOOP AT it_data INTO wa_data.
ENDLOOP.
i'm wonder if is it possible to get attribute from xml with abap function transformation...
Hope to hear from any of u soon!Hi Marcelo,
Thanks a lot for your reply, your code is very usefull but my problem is located around the XSLT file.
With my progam (abap), I can't read the attibutes from a XML file correctly because the XSLT have not the suitable tags.
In my XML i have 2 rows of "Univers" and after use the function transformation from abap i can store only 1 rows in internal table :
<Catalog>
<EnTete>
<Emetteur>UBB</Emetteur>
<b><Univers libelle="Nettoyage, hygine et entretien" objref="08">
</Univers>
<Univers libelle="Nettoyage, hygine et entretien" objref="09">
</Univers></b>
</EnTete>
</Catalog>
XSLT :
<xsl:for-each select="EnTete">
<ENTETE>
<EMETTEUR>
<xsl:value-of select="Emetteur"/>
</EMETTEUR>
<xsl:for-each select="Univers">
<UNIVERS>
<UNIVERS1>
<LIBELLE> <xsl:value-of select="@libelle"/></LIBELLE>
<OBJREF> <xsl:value-of select="@objref"/> </OBJREF>
</UNIVERS1>
</UNIVERS>
</xsl:for-each>
</ENTETE>
</xsl:for-each>
My question is : How can i do to define attributes in XSLT to allow read them by a program abap ?
In my example, the program abap get only 1 attribute in my iternal table, what is the suitable syntax in the xslt to read all the attributes ?
Hope to hear from any of u soon!
Christophe. -
Filling dynamic internal table with data from other internal table
Hi Friends,
My problem is that i have already built a dynamic internal table
(class int_table->create) but now i want to fill it with data from other internal table.
The dynamic table column name and the field value of the data filled internal table are same, but how to access that column name, since i cant hard code it anyway.
Like if my werks field value is '8001'. I want to place it under the column 8001 of dynamic table, Can anybody help me in this regard?
Awarding points is not a problem for even giving a slight hint.
Best RegardsHi
See this
Dynamic internal table is internal table that we create on the fly with flexible column numbers.
For sample code, please look at this code tutorial. Hopefully it can help you
Check this link:
http://www.****************/Tutorials/ABAP/DynamicInternaltable/DynamicInternalTable.htm
Sample code:
DATA: l_cnt(2) TYPE n,
l_cnt1(3) TYPE n,
l_nam(12),
l_con(18) TYPE c,
l_con1(18) TYPE c,
lf_mat TYPE matnr.
SORT it_bom_expl BY bom_comp bom_mat level.
CLEAR: l_cnt1, <fs_dyn_wa>.
Looping the component internal table
LOOP AT it_bom_expl INTO gf_it_bom_expl.
CLEAR: l_cnt1.
AT NEW bom_comp.
CLEAR: l_cnt, <fs_dyn_wa>, lf_mat.
For every new bom component the material data is moved to
temp material table which will be used for assigning the levels
checking the count
it_mat_temp[] = it_mat[].
Component data is been assigned to the field symbol which is checked
against the field of dynamic internal table and the value of the
component number is been passed to the dynamic internal table field
value.
ASSIGN COMPONENT c_comp_list OF STRUCTURE <fs_dyn_wa> TO
<fs_check>.
<fs_check> = gf_it_bom_expl-bom_comp.
ENDAT.
AT NEW bom_mat.
CLEAR l_con.
ENDAT.
lf_mat = gf_it_bom_expl-bom_mat.
Looping the temp internal table and looping the dynamic internal table
*by reading line by line into workarea, the materialxxn is been assigned
to field symbol which will be checked and used.
LOOP AT it_mat_temp.
l_nam = c_mat.
l_cnt1 = l_cnt1 + 1.
CONCATENATE l_nam l_cnt1 INTO l_nam.
LOOP AT <fs_dyn_table2> ASSIGNING <fs_dyn_wa2>.
ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa2> TO <fs_xy>.
ENDLOOP.
IF <fs_xy> = lf_mat.
CLEAR lf_mat.
l_con1 = l_con.
ENDIF.
Checking whether the material exists for a component and if so it is
been assigned to the field symbol which is checked against the field
of dynamic internal table and the level of the component number
against material is been passed to the dynamic internal table field
value.
IF <fs_xy> = gf_it_bom_expl-bom_mat.
ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa> TO <fs_check>.
CLEAR l_con.
MOVE gf_it_bom_expl-level TO l_con.
CONCATENATE c_val_l l_con INTO l_con.
CONDENSE l_con NO-GAPS.
IF l_con1 NE space.
CONCATENATE l_con1 l_con INTO l_con SEPARATED BY c_comma.
CLEAR l_con1.
l_cnt = l_cnt - 1.
ENDIF.
<fs_check> = l_con.
l_cnt = l_cnt + 1.
ENDIF.
ENDLOOP.
AT END OF bom_comp.
At end of every new bom component the count is moved to the field
symbol which is checked against the field of dynamic internal table
and the count is been passed to the dynamic internal table field
value.
ASSIGN COMPONENT c_count OF STRUCTURE <fs_dyn_wa> TO <fs_check>.
<fs_check> = l_cnt.
INSERT <fs_dyn_wa> INTO TABLE <fs_dyn_table>.
ENDAT.
ENDLOOP.
Reward if useful
Anji -
Dynamic Internal Table with the same name
Hey Guys
I have a question.
I know that we can create dynamic internal table taking a struct dynamically.
But I have 2 ques on the same subject.
1. Can we create an internal table based on a type that we have locally declared eg
types: begin of ty_demo.
var1(1) type c,
var2 type p,
end of ty_demo.
2. If an internal table is already declared based on the above type say data: i_tab type standard table of ty_demo.
If i need to enhance the struct of this internal table. Can i do that by dynamically redefining it based on a different structure but keepin the same name i_tab.
In a nut shell I cannot change the name of my itab but I want to enhance the structure.
I Hope I am clear.
Help will be greatly apprcieated.
Thanks
Sameerhai.
we can create an internal table based on a type that we have locally declared, but you have to use data instead of types like.
data: begin of ty_demo.
var1(1) type c,
var2 type p,
end of ty_demo.
check the example notes for dynamic itab .
Dynamic internal table is internal table that we create on the fly with flexible column numbers.
For sample code, please look at this code tutorial. Hopefully it can help you
Check this link:
http://www.****************/Tutorials/ABAP/DynamicInternaltable/DynamicInternalTable.htm
Sample code:
DATA: l_cnt(2) TYPE n,
l_cnt1(3) TYPE n,
l_nam(12),
l_con(18) TYPE c,
l_con1(18) TYPE c,
lf_mat TYPE matnr.
SORT it_bom_expl BY bom_comp bom_mat level.
CLEAR: l_cnt1, <fs_dyn_wa>.
Looping the component internal table
LOOP AT it_bom_expl INTO gf_it_bom_expl.
CLEAR: l_cnt1.
AT NEW bom_comp.
CLEAR: l_cnt, <fs_dyn_wa>, lf_mat.
For every new bom component the material data is moved to
temp material table which will be used for assigning the levels
checking the count
it_mat_temp[] = it_mat[].
Component data is been assigned to the field symbol which is checked
against the field of dynamic internal table and the value of the
component number is been passed to the dynamic internal table field
value.
ASSIGN COMPONENT c_comp_list OF STRUCTURE <fs_dyn_wa> TO
<fs_check>.
<fs_check> = gf_it_bom_expl-bom_comp.
ENDAT.
AT NEW bom_mat.
CLEAR l_con.
ENDAT.
lf_mat = gf_it_bom_expl-bom_mat.
Looping the temp internal table and looping the dynamic internal table
*by reading line by line into workarea, the materialxxn is been assigned
to field symbol which will be checked and used.
LOOP AT it_mat_temp.
l_nam = c_mat.
l_cnt1 = l_cnt1 + 1.
CONCATENATE l_nam l_cnt1 INTO l_nam.
LOOP AT <fs_dyn_table2> ASSIGNING <fs_dyn_wa2>.
ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa2> TO <fs_xy>.
ENDLOOP.
IF <fs_xy> = lf_mat.
CLEAR lf_mat.
l_con1 = l_con.
ENDIF.
Checking whether the material exists for a component and if so it is
been assigned to the field symbol which is checked against the field
of dynamic internal table and the level of the component number
against material is been passed to the dynamic internal table field
value.
IF <fs_xy> = gf_it_bom_expl-bom_mat.
ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa> TO <fs_check>.
CLEAR l_con.
MOVE gf_it_bom_expl-level TO l_con.
CONCATENATE c_val_l l_con INTO l_con.
CONDENSE l_con NO-GAPS.
IF l_con1 NE space.
CONCATENATE l_con1 l_con INTO l_con SEPARATED BY c_comma.
CLEAR l_con1.
l_cnt = l_cnt - 1.
ENDIF.
<fs_check> = l_con.
l_cnt = l_cnt + 1.
ENDIF.
ENDLOOP.
AT END OF bom_comp.
At end of every new bom component the count is moved to the field
symbol which is checked against the field of dynamic internal table
and the count is been passed to the dynamic internal table field
value.
ASSIGN COMPONENT c_count OF STRUCTURE <fs_dyn_wa> TO <fs_check>.
<fs_check> = l_cnt.
INSERT <fs_dyn_wa> INTO TABLE <fs_dyn_table>.
ENDAT.
ENDLOOP.
regards.
sowjanya.b -
Dynamic internal table problem in FM - HR_INFOTYPE_OPERATIONS
Dear All,
I have a problem when I use a Dynamic internal table in FM - HR_INFOTYPE_OPERTATION..
Please suggest me on the way to overcome this problem..
We wanted to have a dynamic Program for Info type operations which can be used for any info types as we are changing only BEGDA and the related actions
So in my program I have the parameters to accept
P_BEGDA - 01.10.2007
P_INFTY - P0008
P_ACTIO - COPY
I am able to create a dynamic table based on the parameters P_INFTY and able to read it also using the FM - HR_READ_INFOTYPE
BUT when I pass the dynamic internal table to a FM - HR_INFOTYPE_OPERTATION I am getting a DUMP
The DUMP is at the below statement from FM - HR_INFOTYPE_OPERTATION
ASSIGN record TO <record> CASTING TYPE (tabname). "XDP UniCode
It gives the below possiblities
"ASSIGN_BASE_TOO_SHORT" C
"SAPLHRMM" or "LHRMMU03"
"HR_INFOTYPE_OPERATION"
But If I use the below internal table
Data : g_t_0008 like P0008 occurs 0 with header line.
And If I use the internal table g_t_0008 instead of dynamic tables then it works. So I strongly feel it's due to not having a header in the dynamic table below see below the sample code on how I am generating a dynamic internal table
field-symbols: <dyn_table> type standard table.
data: dy_table type ref to data,
dy_line type ref to data,
xfc type lvc_s_fcat,
ifc type lvc_t_fcat.
to get the srurcute
perform get_structure using l_f_table.
perform create_dynamic_itab .
assign dy_table->* to <dyn_table>.
perform get_data tables <dyn_table01>
using pernr-pernr p_infty.
below are the forms routine .
form get_structure using p_table.
data : idetails type abap_compdescr_tab,
xdetails type abap_compdescr.
data : ref_table_des type ref to cl_abap_structdescr.
clear : ifc[], dy_table.
Get the structure of the table.
ref_table_des ?=
cl_abap_typedescr=>describe_by_name( p_table ).
idetails[] = ref_table_des->components[].
loop at idetails into xdetails.
clear xfc.
xfc-fieldname = xdetails-name .
xfc-datatype = xdetails-type_kind.
xfc-inttype = xdetails-type_kind.
xfc-intlen = xdetails-length.
xfc-decimals = xdetails-decimals.
append xfc to ifc.
endloop.
endform.
form create_dynamic_itab.
Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = ifc
importing
ep_table = dy_table.
endform.
*& Form get_data
form get_data tables p_table
using p_pernr
p_infty.
clear : p_table, p_table[].
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
PERNR = P_PERNR
INFTY = p_infty
BEGDA = p_datum
ENDDA = p_datum
TABLES
INFTY_TAB = p_table
EXCEPTIONS
INFTY_NOT_FOUND = 1
OTHERS = 2.
CHECK SY-SUBRC EQ 0.
IF lines( p_table ) GT 0.
*write :/'Record exist' , 'IT', p_infty.
clear p_table.
PERFORM hr_operation tables p_table
using g_t_t588d-actio g_t_t588d-INFTY
g_t_t588d-SUBTY.
else.
PERFORM append_status using g_t_itab-pernr p_infty ' '
'Error' 'No records'.
ENDIF.
endform. " get_data
form hr_operation tables p_table
using p_actio P_INFTY P_SUBTY.
data: l_f_return LIKE bapireturn1.
ASSIGN COMPONENT 'BEGDA' OF STRUCTURE p_table TO <l_field>.
<l_field> = p_begda.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = P_infty
number = G_T_ITAB-PERNR
subtype = P_subty
validityend = g_f_endda
validitybegin = P_datum
record = P_TABLE
operation = p_actio
IMPORTING
return = l_f_return.
IF sy-subrc NE 0.
ENDIF.
ENDFORM.try
using field symbol for a wrk area instead of Field symbol for a table
loop your inernal table (again a field symbol) assigning to <fs_wrkarea>
in loop call HR_INFO.._OP..
reward if helpful -
Dynamic internal table operations
Hi,
I have an issue with dynamic internal table wherein I need to write a select statement with For All Entries on dynamic internal table and populating the record into another dynamic internal table.
I am trying with the code below but its not working.
SELECT (FLD)
FROM (T_TABLE)
INTO CORRESPONDING FIELDS OF TABLE <DYN1_TABL>
FOR ALL ENTRIES IN <DYN_TABL>
WHERE KEY_FNAME = <DYN_TABL>-KEY_FNAME.
FLD is the dynamic field.
T_TABLE is the dynamic database table.
DYN1_TABL is the dynamic internal table
DYN_TABL is the dynamic internal table
KEY_FNAME is the dynamic key field of T_TABLE.
Pls help me on this issue.
Response with code snippets will be appreciated.
Thanks in advance.Thanks for your reply Nikki but my issue is to reference a field in dynamic internal table to be used with 'For All Entries' satement.
like for static we use
For All Entries in Itab where <fieldname> = itab-<fieldname>
I was looking for the same statement for dynamic tables -
Error in import table data using oracle datapump
i am trying to import table data using oracle datapump
CREATE TABLE emp_xt (
ID NUMBER,
NAME VARCHAR2(30)
ORGANIZATION EXTERNAL (
TYPE ORACLE_DATAPUMP
DEFAULT DIRECTORY backup
LOCATION ('a.dmp')
it return the following error
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04084: The ORACLE_DATAPUMP access driver does not support the ROWID column.
ORA-06512: at "SYS.ORACLE_DATAPUMP", line 19
please help me.dmp file generated from exp command file not from oracle_datapump
-
Hi All,
I was created program to generate Dynamic field catalog and internal table, here is confusion how to display below mentioned internal table data to final dynamic internal table based on document type headings
This is Statsic internal table Data
1 0000123 GBP DA S 6265.45
2 0000123 GBP DA H 240.51
3 0000123 GBP DA S 35.82
4 0000123 GBP D1 H 281.85
5 0000123 GBP D1 S 23.41
6 0000123 GBP D1 S 34.23
7 0000123 GBP RV H 97.02
8 0000123 GBP RV S 52.90
9 0000123 GBP RV S 148.31
Can anybody suggest me how to populate the amount based on Document type and posting (credit or debit)
For Example
CUST DAC DAD D1C D1D RVC RVD
123 6265.45 240.51
35.82
Thanks in Advance
Sekhar
Moderator message: please do not open multiple threads for the same or similar issue.
Edited by: Thomas Zloch on Dec 9, 2011 4:17 PMHi All,
I was created program to generate Dynamic field catalog and internal table, here is confusion how to display below mentioned internal table data to final dynamic internal table based on document type headings
This is Statsic internal table Data
1 0000123 GBP DA S 6265.45
2 0000123 GBP DA H 240.51
3 0000123 GBP DA S 35.82
4 0000123 GBP D1 H 281.85
5 0000123 GBP D1 S 23.41
6 0000123 GBP D1 S 34.23
7 0000123 GBP RV H 97.02
8 0000123 GBP RV S 52.90
9 0000123 GBP RV S 148.31
Can anybody suggest me how to populate the amount based on Document type and posting (credit or debit)
For Example
CUST DAC DAD D1C D1D RVC RVD
123 6265.45 240.51
35.82
Thanks in Advance
Sekhar
Moderator message: please do not open multiple threads for the same or similar issue.
Edited by: Thomas Zloch on Dec 9, 2011 4:17 PM -
Older Business HTML and Dynamic Page Table question
I am not sure if anyone will know here (or if this is the best place to post), but I have a question concerning using the Business HTML template library controls/API for use with ITS. I am attempting to use the "Dynamic Page Table" control, and have hit some problems. Does anyone have any example code they can share on getting this to work correctly (ie, paging through records, selecting from rows, etc)? I have "torn apart" the underlying Javascript and even modified my code to adjust for some formatting issues that the API's do not handle, however, my "pages" all display at once in the beginning and only hide when I use one of the paging icons (forward,back,all back, etc). THe "isVisible" parameter seems to do nothing for the "page" DIVs. Currently running the latest version of ITS and R/3 4.6b on the backend if that helps. Also, the example from the SAP Design Guild cookbook is very basic and does not "page" as I need. Thanks in advance!
CSolomonCheck the following Tables
FND_FORM_CUSTOM_RULES
FND_FORM_CUSTOM_SCOPES
FND_FORM_CUSTOM_ACTIONS
FND_FORM_CUSTOM_PARAMS -
To convert XML to ABAP internal table can we do it with DOM or we need XSLT
I have a requirement where I need to collect the data from XML file into an internal table.
I need to collect this data into an internal table as I should make use of this data and do Goods Receipt in SAP.
My XML file is very very complex and the child nodes in my XML file may occur ones or 10 times and change dynamically.
I want to know if XML to ABAP internal table is possible with DOM or does it need XSLT too.
I used the blog of Robert which uses DOM, but it I am unable to collect the data in internal table. The blog explains only how to wtite the out put to screen as element and value.
I want to know if XML to ABAP internal table is possible with DOM or do I need XSLT too? I am confused please help.
Any help will be highly appreciated.
Regards,
Jessica SamHello Jessica
Why not using the DOM itself for processing?
Below you see the post-processing coding which I use to add the interchange control number (ICN) into an EDI message (which at this stage is still an XML-EDI stream). This is done on SAP-XI yet on the ABAP stack so you could use this approach on your R/3 system as well.
method POSTPROCESSING.
* Post-Processing of outbound EDI invoices & dispatch advices
me->map_icn( ).
endmethod.
method MAP_ICN.
* define local data
DATA: lo_node TYPE REF TO if_ixml_node,
ld_name TYPE string,
ld_value TYPE string,
ld_error_code type MPG_ERRCODE,
** ld_control_number TYPE char13,
ld_rc TYPE i,
ld_msg TYPE string. " bapi_msg.
DATA: ld_interface TYPE string.
DATA: incode TYPE REF TO if_ixml_node_collection.
LOG-POINT ID zedi
SUBKEY mc_subkey_method_trace.
ld_error_code = md_clsname.
* Get next interchange control number (ICN)
me->md_next_number = me->get_next_number(
id_nrobj = me->md_nrobj " Object (SNRO)
id_nrnr = me->md_nrnr ). " Number Range
CALL METHOD zcl_edi_uk_counter=>calculate_modulo_n09
EXPORTING
id_input = me->md_next_number
receiving
rd_output = me->md_next_number.
* Build ICN according to naming conventions agreed with EDI customer
me->md_icn = me->generate_icn( me->md_next_number ).
ld_value = me->md_icn. " type conversion to string
CLEAR: incode,
lo_node.
incode = me->mo_document->get_elements_by_tag_name( mc_d_0020 ).
lo_node = incode->get_item( index = 0 ).
CALL METHOD lo_node->set_value
EXPORTING
value = ld_value
RECEIVING
rval = ld_rc.
IF ( ld_rc NE 0 ).
CONCATENATE 'Error [' mc_d_0020
']: Method SET_VALUE (IF_IXML_NODE)'
INTO ld_msg.
CONDENSE ld_msg.
me->mif_trace->trace2( message = ld_msg ).
RAISE EXCEPTION TYPE cx_mapping_fault
EXPORTING
* textid =
* previous =
error_code = ld_error_code
error_text = ld_msg.
** MESSAGE ld_msg TYPE 'A'.
ENDIF.
CLEAR: incode,
lo_node.
incode = me->mo_document->get_elements_by_tag_name( mc_d_0020_2 ). " element for ICN
lo_node = incode->get_item( index = 0 ).
CALL METHOD lo_node->set_value
EXPORTING
value = ld_value
RECEIVING
rval = ld_rc.
IF ( ld_rc NE 0 ).
CONCATENATE 'Error [' mc_d_0020_2
']: Method SET_VALUE (IF_IXML_NODE)'
INTO ld_msg.
CONDENSE ld_msg.
me->mif_trace->trace2( message = ld_msg ).
RAISE EXCEPTION TYPE cx_mapping_fault
EXPORTING
* textid =
* previous =
error_code = ld_error_code
error_text = ld_msg.
** MESSAGE ld_msg TYPE 'A'.
ENDIF.
* define local data
DATA: ls_record TYPE mpp_dynamic.
CLEAR: ls_record.
ls_record-namespace = mc_dynamic_namespace.
ls_record-name = mc_icn.
ls_record-value = ld_value.
mif_dynamic->add_record( ls_record ).
endmethod.
In your case you would need to do a DO...ENDDO loop until you parsed all required nodes.
NOTE: ME->MO_DOCUMENT is of TYPE REF TO IF_IXML_DOCUMENT.
Regards
Uwe
Maybe you are looking for
-
Ribbon Custom tab won't appear on custom list
Hi all! If anyone could be so kind and help me with the following. I have created a custom list in Visual Studio 2012 and i am trying to add a custom tab to that list. Below is the content of the elements file for the custom tab and respective contro
-
How can I get emails recieved on my iphone to be read on my mac?
I have only just got a new iphone 3g and any emails that I receive appear on my iphone but not on my mac. Is there anyway to copy them in to mail on the mac?
-
Ipad and Dolby surround plus Television
I use my I pad 2 to watch movies, we want to connect it to an Yamaha Htr 3085, I get sound but no picture on the TV, we use HDMI cable but it does not go through, the I pad brings the message this product is not authorised for video presentation. How
-
JTable JCombox popup on click in table cell
What is the recommended way of making a JComboBox that is in a JTable cell popup when the user clicks once anywhere in the cell? The popup is actually a calendar that works fine if the user clicks on the spot where the button shows up in the cell but
-
Upload PurchaseOrdertext in material master upto 132 characters
Hi all , I have written BDC for upload purchaseordertext as earlier have uploaded more than 132 to 250 characters in material master . but now it wont allow upto 132 characters . Give Solution AEAP . Thank u Swapnil