08-13-2007 12:17 PM
Hi All,
I have a requirement in which I have to save the data of a deep structure. The structure has the below complexity
1) One of the fields of the structure is a table type of another structure, say A.
2) For the structure A, there is a field, which is again table type.
What is the best and easiest way of downloading this data to a file and then uploading it again.
Is there any option using cluster database or XML (I have no idea about XML, so I dont know if it is possible using xml or not).
Any help in this regard will be highly appreciated.
Thanks,
Anand
08-13-2007 12:26 PM
Hi
You will have to use a loop inside a loop, i.e
loop at table1 into wa_tabl1
loop at table2 into wa_table2
your code
endloop
endloop.
Thanks ®ards
Preeti
<b>
Reward points for useful answers</b>
08-13-2007 12:44 PM
Hi,
You can write a custom program to download this complex struc to a file.
yOu can desing some some file structure which will hold data in this format.
For example :-
Here in this file each new record begins with level_1.
Level 2 will be data for one of the field in level 1 which have table structure.
Now since since its a table we can have any nummber of level_2 records for each level one
record.
LEVEL_1 DATA1 DATA2 DATA3 DATA4 DATA5 DATA6 DATA7 DATA8
LEVEL_2 DATA5_1 DATA5_2 DATA35_3 DATA5_4
LEVEL_2 DATA5_3_1 DATA5_3_2 DATA5_3_3
LEVEL_1 DATA1 DATA2 DATA3 DATA4 DATA5 DATA6 DATA7 DATA8
LEVEL_2 DATA5_1 DATA5_2 DATA35_3 DATA5_4
LEVEL_2 DATA5_3_1 DATA5_3_2 DATA5_3_3
LEVEL_1 DATA1 DATA2 DATA3 DATA4 DATA5 DATA6 DATA7 DATA8
LEVEL_2 DATA5_1_1 DATA5_1_2 DATA35_1_3 DATA5_1_4
LEVEL_2 DATA5_2_1 DATA5_2_2 DATA35_2_3 DATA5_2_4
Let me know if u understand this design..
Writing code for this won't be big deal..
Enjoy SAP.
Pankaj Singh.
08-13-2007 1:35 PM
Hi Pankaj,
Thanks for the reply. I understood the design.
But is there any other way using which I can directly load the data into a file with minimal effort, the same way we do Export and Import to cluster database?
Thanks,
Anand
08-13-2007 2:58 PM
Hi All,
I am able to find a solution using XML.
It is the simplest way I can think of.
Any structure (deep, complex etc), can be easily transformed into XML using Serialization by the standard SAP Provided transformation ID.
Suppose MY_DEEP_STRUCT_TAB is a table, that I would like to store in a file for later use. Use the below code
Data mystr type string.
call TRANSFORMATION id
source root = MY_DEEP_STRUCT_TAB
RESULT XML mystr.
*
This will transform the structure to xml format, stored in string mystr.
Now the string can be saved in a local file.
Afterwards if one wants to retrieve the data. Read the local file into a string and use the below deserialization to retrieve the data into the structure.
call TRANSFORMATION id
SOURCE XML mystr
result root = MY_DEEP_STRUCT_TAB.