Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

cl_xml_ducument with empty nodes

Former Member
0 Likes
766

I use cl_xml_document with

call method o_xml->create_with_data( dataobject = data_tab ).

to generate an xml document.

data tab is being created on basis of a deep structure. Whenever a deep structure is empty the resulting node is being neglected and won't show op in the xml document.

I do want the node to show up, any idea?

Up!

Edited by: axeleration on Oct 11, 2011 9:39 AM

2 REPLIES 2
Read only

Former Member
0 Likes
563

Hi,

Put a condition that whenever you encounter a empty deep structure. Fill the node with empty SPACE(s).

try this & let me know if this works for you.

Regards,

Rahul

Read only

Former Member
0 Likes
563

I've found the solution: instead of create_with_data using set_sata with parameter "control".

*    CALL METHOD o_xml->create_with_data( dataobject = <dat> ).
    DATA lf_retcode type sy-subrc.
    DATA ls_Control TYPE DCXMLSERCL. "OPTIONAL
    " don't leave empty parts away:
    ls_Control-INIT_TREAT = 'N'.

    CALL METHOD o_xml->set_data
      EXPORTING
*        name        = 'DATA'
*        alias       =
        dataobject  = gt_Rentob
*        parent_node =
         control     = ls_Control
      receiving
        retcode     = lf_retcode
        .

*    CALL METHOD o_xml->create_with_data
*      EXPORTING
**        name       = 'DATA'
*        dataobject = gt_Rentob
*      receiving
*        retcode    = lf_retcode.

" for testing only:
    CALL METHOD o_xml->display
*      EXPORTING
*        with_bdn = SPACE
        .