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: 

XML to SAP IDOC Upload

former_member191468
Participant
0 Kudos

Hi All,

I have tired all the sources like SDN.sap.com, Servicemarket place and other websites. But i did not get any details or straight answer. So i am posting the below question.

We have the below requirement.

We are going to get XML file and we need to upload the XML file into SAP IDOC.

Is there any way to upload the XML to Sap IDOC.

Kindly provide your suggestion on this.

Regards

Anil Kumar K

6 REPLIES 6

Former Member
0 Kudos

hi,

XML file should be converted to Text file format. Using XI we can do it.. because of this concept only XI came into picture..direct XML file Reading is not posible in sap. smart forms can convert into XML format

and that XML file once again we can read and convert it Smartforms.

in ur case u should have some midleware like Typco or XI like that ..

~linganna

uwe_schieferstein
Active Contributor
0 Kudos

Hello Anil

If your XML file is an XML-IDoc then you can use fm IDOC_XML_FROM_FILE.

See also:

Regards

Uwe

Former Member
0 Kudos

hi,

What you can do is create and internal table. export all data from your xml file to that internal table and the call the function module for importing to inbound idoc( forgot which fm it is).

hope this helps

cheers

Former Member
0 Kudos

Hi,

First we have to change the XML file to text file. Then after we have to send the data to the particular idoc..It wil update the data in the database. Earlier I have worked on same requirement , you give me your id ..so that i will forward the code....

Regards,

jayan.

Former Member
0 Kudos

Hi,

Have you tried with FM "CFG_API_CONVERT_XML_TO_IDOC"?

Thanks,

Asit Purbey.

Former Member
0 Kudos

Hi,

Actually earlier i have done for same requirement..i have taken XML data from FTP server and changes to text data and send it to IDOC....

iam sending the code for for changing text file...

OPEN DATASET gv_local FOR INPUT IN BINARY MODE . " ENCODING DEFAULT .

IF sy-subrc = 0.

DO.

READ DATASET gv_local INTO gs_x MAXIMUM LENGTH 1.

IF sy-subrc = 0.

APPEND gs_x TO gt_x.

ELSE.

EXIT.

ENDIF.

ENDDO.

CLOSE DATASET gv_local.

ELSE.

MESSAGE e000(zsd) WITH 'File could not be opened'.

EXIT.

ENDIF.

CLEAR: xstring.

LOOP AT gt_x INTO gs_x.

CONCATENATE xstring gs_x INTO xstring

IN BYTE MODE.

CLEAR: gs_x.

ENDLOOP.

REFRESH: gt_xmlparse[],

lt_return.

CALL FUNCTION 'SMUM_XML_PARSE'

EXPORTING

xml_input = xstring

TABLES

xml_table = gt_xmlparse

return = lt_return.