Application Development 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: 

How to read xml file and place it into an internal table...

Former Member
0 Kudos

hello all,

can any one help me in - how to read xml data file (placed in application server) and placing the same into an internal table (remove the xml tags or say fetching the xml data without xml tags).

6 REPLIES 6

Former Member
0 Kudos

Hi,

I think you need to perform lot of string operations to achieve this functionality.

Regards,

Sujatha

b_deterd2
Active Contributor
0 Kudos

Hi,

Search this forum for statement CALL TRANSFORMATION.

Regards,

Bert

Former Member
0 Kudos

As Sujatha suggests....Only the string operations would work to get results...

Thanks,

Santhosh

Former Member
0 Kudos

Hi,

*Use the function module TEXT_CONVERT_XML_TO_SAP.

Regards,

Narendra

Former Member
0 Kudos

Hi Murashali,

use this.

TYPES: BEGIN OF day,

name TYPE string,

work(1) TYPE c,

END OF day.

DATA: BEGIN OF week,

day1 TYPE day,

day2 TYPE day,

day3 TYPE day,

day4 TYPE day,

day5 TYPE day,

day6 TYPE day,

day7 TYPE day,

END OF week.

DATA xml_string TYPE string.

DATA result LIKE week.

week-day1-name = 'Monday'. week-day1-work = 'X'.

week-day2-name = 'Tuesday'. week-day2-work = 'X'.

week-day3-name = 'Wednesday'. week-day3-work = 'X'.

week-day4-name = 'Thursday'. week-day4-work = 'X'.

week-day5-name = 'Friday'. week-day5-work = 'X'.

week-day6-name = 'Saturday'. week-day6-work = ' '.

week-day7-name = 'Sunday'. week-day7-work = ' '.

CALL TRANSFORMATION ...

SOURCE root = week

RESULT XML xml_string.

CALL TRANSFORMATION ...

SOURCE XML xml_string

RESULT root = result.

Regards,

Vijay

former_member218674
Contributor
0 Kudos

Hello,

Try this way:

1. Load XML file using open dataset and read it into string variable.

2. Use identical call transformation to transform xml string into ABAP internal table.

Refer to SAP help on DATASET and CALL TRANSFORMATIONS.

Thanks,

Augustin.