Skip to Content
avatar image
Former Member

Replace the header line in the o/p file

My scenarion is to generate a xml file,the xml file contains a header line <?xml version="1.0" encoding="utf-8"?>

and this lineis to be relaced with <XYZ>.

it is multi message mapping -- splitting of messages 1:n, i cannot add any extra fields to the target structure to pass the header

I wrote a abap mapping program and included that in the second step of my interface mapping.

the code for abap mapping is as below.

method IF_MAPPING~EXECUTE.
   data: lv_new_str  type string,
         lv_old_str type string,
         lv_string type string.
***Convert the XSTRING to STRING
CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
  EXPORTING
    im_xstring        = source
*   IM_ENCODING       = 'UTF-8'
 IMPORTING
   EX_STRING         = lv_string .
**Pass the Values
lv_old_str = '<?xml version="1.0" encoding="utf-8"?>'.
lv_new_str = '<!XYZ>.
REPLACE ALL OCCURRENCES OF lv_old_str in lv_string with lv_new_str.
***Convert the STRING to XSTRING.
CALL FUNCTION 'ECATT_CONV_STRING_TO_XSTRING'
  EXPORTING
    im_string         = lv_string
*   IM_ENCODING       = 'UTF-8'
 IMPORTING
   EX_XSTRING        = result
*   EX_LEN            = .
endmethod.

But iam not able to get the desired output.

Please suggest me how to make this work?

Thanks

Srinivas

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Mar 01, 2010 at 07:58 PM

    Please suggest me

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 01, 2010 at 08:39 PM

    Hi Srinivas,

    Can you please see the java mapping as given by suraj in this thread:

    how-do-i-remove-xml-encoding

    Regards,

    ---Satish

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 29, 2010 at 10:32 AM

    Thanks

    Add comment
    10|10000 characters needed characters exceeded