Skip to Content
avatar image
Former Member

Pretty printing to a xml file created by abap code.

Hi guys.

I created a XML file into the FB03 Tcode using an internal table type SOLI with XML content, I used the next FM:

CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
  EXPORTING
    buffer                = my_text64
  tables
    binary_tab            = it_content.

Convert my binary content:

CALL FUNCTION 'SO_CONVERT_CONTENTS_BIN'
    EXPORTING
      it_contents_bin = it_content
    IMPORTING
      et_contents_bin = it_content.

Get folder:

CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
    EXPORTING
      region                = 'B'                 
    IMPORTING
      folder_id             = wa_fol_id
    EXCEPTIONS
      communication_failure = 1
      owner_not_exist       = 2
      system_failure        = 3
      x_error               = 4
      OTHERS                = 5.

Insert the object:

CALL FUNCTION 'SO_OBJECT_INSERT'
      EXPORTING
        folder_id                  = wa_fol_id
        object_type                = 'EXT'
        object_hd_change           = wa_obj_data
      IMPORTING
        object_id                  = wa_obj_id
      TABLES
        objhead                    = ltd_objhead
        objcont                    = it_content

And finally attached to BO (FB03)

CALL FUNCTION 'BINARY_RELATION_CREATE_COMMIT'
     EXPORTING
        obj_rolea      = wa_target_bo
        obj_roleb      = wa_note
        relationtype   = 'ATTA'

When I open my XML file don't have format like a XML, how I can to put pretty printer like this, without iXML?

<?xml version="1.0"?>
<Company>
  <CompanyName>SAP</CompanyName>
  <Employee Type="FT">
     <EmployeeName>James</EmployeeName>
     <EmployeeNumber>007</EmployeeNumber>
  </Employee>
</Company>

And my XML file display characters like this:

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers