cancel
Showing results for 
Search instead for 
Did you mean: 

Replace the header line in the o/p file

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks

Former Member
0 Kudos

Hi Srinivas,

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

Regards,

---Satish

Former Member
0 Kudos

Please suggest me