2006 Jul 17 8:30 AM
Hi,
for one of my tasks I'm dealing with XML export. After short investigation of the postings in the forum I found an acceptable solution:
The issue is that I need an XML file like this:
<plant>
<material>
<purchases>data</purchases>
<purchases>data</purchases>
<purchases>data</purchases>
...
<sales>data</sales>
<sales>data</sales>
<sales>data</sales>
...
</material>
<next material>
...
</next material>
</plant>
So here are the questions:
1. Is it possible (and how) to define such deep structured type where for each record (means material) there is at least 1 internal table connected to that record? That would let me use a record-2-DOM conversion and a standard DOM-2-XML renderer.
2. Could anyone please provide a very simple and short example?
Of course, I could write my own XML renderer and achieve what I need (without using DOM, simply write to file all the desired XML tags while looping at my *nested* tables), but if there is a way to define such a structured type and further to fill it with data, it would help me learn a little bit more about abap opportunities and would save me a bit more time to create a renderer.
Many thanks in advance.
Regards,
Ivaylo Mutafchiev
2006 Jul 17 10:53 AM
Hi,
You can declare deep structure as below
TYPES : BEGIN OF ty_address,
house(10) TYPE c,
street(10) TYPE c,
END OF ty_address.
TYPES : BEGIN OF ty_itab,
name(10) TYPE c,
age TYPE i,
address TYPE ty_address OCCURS 0,
END OF ty_itab.
DATA : i_address TYPE STANDARD TABLE OF ty_address,
i_itab TYPE STANDARD TABLE OF ty_itab.
DATA : wa_address TYPE ty_address,
wa_itab TYPE ty_itab.
CLEAR : wa_address,
wa_itab.
wa_address-house = 'House1'.
wa_address-street = 'Street1'.
APPEND wa_address TO i_address.
wa_address-house = 'House2'.
wa_address-street = 'Street2'.
APPEND wa_address TO i_address.
wa_itab-name = 'Test'.
wa_itab-age = 10.
wa_itab-address[] = i_address[].
APPEND wa_itab TO i_itab.
Also check structure BSPL_GRID_FIELDCAT field CELL_COLOR
Hi,
for one of my tasks I'm dealing with XML export. After short investigation of the postings in the forum I found an acceptable solution:
The issue is that I need an XML file like this:
<plant>
<material>
<purchases>data</purchases>
<purchases>data</purchases>
<purchases>data</purchases>
...
<sales>data</sales>
<sales>data</sales>
<sales>data</sales>
...
</material>
<next material>
...
</next material>
</plant>
So here are the questions:
1. Is it possible (and how) to define such deep structured type where for each record (means material) there is at least 1 internal table connected to that record? That would let me use a record-2-DOM conversion and a standard DOM-2-XML renderer.
2. Could anyone please provide a very simple and short example?
Of course, I could write my own XML renderer and achieve what I need (without using DOM, simply write to file all the desired XML tags while looping at my *nested* tables), but if there is a way to define such a structured type and further to fill it with data, it would help me learn a little bit more about abap opportunities and would save me a bit more time to create a renderer.
Many thanks in advance.
Regards,
Ivaylo Mutafchiev
2006 Jul 17 10:53 AM
Hi,
You can declare deep structure as below
TYPES : BEGIN OF ty_address,
house(10) TYPE c,
street(10) TYPE c,
END OF ty_address.
TYPES : BEGIN OF ty_itab,
name(10) TYPE c,
age TYPE i,
address TYPE ty_address OCCURS 0,
END OF ty_itab.
DATA : i_address TYPE STANDARD TABLE OF ty_address,
i_itab TYPE STANDARD TABLE OF ty_itab.
DATA : wa_address TYPE ty_address,
wa_itab TYPE ty_itab.
CLEAR : wa_address,
wa_itab.
wa_address-house = 'House1'.
wa_address-street = 'Street1'.
APPEND wa_address TO i_address.
wa_address-house = 'House2'.
wa_address-street = 'Street2'.
APPEND wa_address TO i_address.
wa_itab-name = 'Test'.
wa_itab-age = 10.
wa_itab-address[] = i_address[].
APPEND wa_itab TO i_itab.
Also check structure BSPL_GRID_FIELDCAT field CELL_COLOR
2006 Jul 17 3:34 PM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |