on 03-16-2009 3:40 PM
hi guys, I would like to know how to parse xml for an internal table. I explain myself.
Let's say you have a purchase order form where you have header data & items data. In my interactive form, the user can change the purchase order quantity at the item level. When I received back the pdf completed by mail, I need to parse the xml and get the po qty that has been entered.
This is how I do to get header data from my form
lr_ixml_node = lr_ixml_document->find_from_name( name = ''EBELN ).
lv_ebeln = lr_ixml_node->get_value( ).
How do we do to get the table body??
Should I used the same method (find_from_name) and passing the depth parameter inside a do/enddo?
thanks
Alexandre Giguere
Alexandre,
Here is an example. Suppose your internal table is called 'ITEMS'.
lr_node = lr_document->find_from_name('ITEMS').
lv_num_of_children = lr_node->num_children( ).
lr_nodechild = lr_node->get_first_child( ).
do lv_num_of_children times.
lv_num_of_attributes = lr_nodechild->num_children( ).
lr_childchild = lr_nodechild->get_first_child( ).
do lv_num_of_attributes times.
lv_value = lr_childchild->get_value( ).
case sy-index.
when 1.
wa_item-field1 = lv_value
when 2.
wa_item-field2 = lv_value.
endcase.
lr_childchild = lr_childchild->get_next( ).
enddo.
append wa_item to lt_item.
lr_nodechild = lr_nodechild->get_next( ).
enddo.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.