Application Development and Automation 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: 
Read only

Need Sample code to Download the data to Application Server

Former Member
0 Likes
1,056

Hi ,

Can somebody send me the sample code to Download the Data to Application Server as an XML file.

Best Regards

Bhagat.

10 REPLIES 10
Read only

Former Member
0 Likes
983

USE TRANSACTION <b>CG3Z</b>

Read only

0 Likes
983

Kishan,

I need the sample code which actually uploads the data to Application sever.

If possible send me.

Best Regards

Bhagat.

Read only

0 Likes
983

hi bhagat,

parameters: P_DSNI(75) TYPE C DEFAULT

'/usr/local/sapdata/amit.dat' LOWER CASE.

data: begin of itab occurs 0,

pernr(8),

sp1(1) value ',',

werks(4),

sp2(1) value ',',

persg(1),

sp3(1) value ',',

persk(2),

end of itab.

start-of-selection.

OPEN DATASET P_DSNI FOR OUTPUT IN LEGACY TEXT MODE.

PERFORM FETCH_DATA.

&----


*& Form FETCH_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM FETCH_DATA .

SELECT * FROM PA0001 WHERE PERNR IN S_PERNR.

MOVE-CORRESPONDING PA0001 TO ITAB.

TRANSFER ITAB TO P_DSNI.

APPEND ITAB.

ENDSELECT.

CLOSE DATASET P_DSNI.

ENDFORM. " FETCH_DATA

This will help u out.

pls change the table names and file to be downloaded to AServer accordingly..

pls reward points..

amit

Read only

Former Member
0 Likes
983

Hi,

Convert the XML xstring data to string and transfer the same to appserver file. Some thing like this,

CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'

EXPORTING im_xstring = xml_xstring

IMPORTING ex_string = xml_string.

Or you can create XML in XSTRING output stream by:

lo_ostream = o_streamfactory->create_ostream_xstring( string = li_xml_xstring ).

Then:

open dataset dsn for output in binary mode .

if sy-subrc = 0.

transfer li_xml_xstring to dsn.

endif.

close dataset dsn.

Reward points if this Helps.

Manish

Read only

0 Likes
983

parameters: d1 type localfile default '/usr/sap/TST/SYS/Data1.csv'.

data: begin of itab occurs 0,

fld1(20) type c,

fld2(20) type c,

fld3(20) type c,

end of itab.

data: wa(2000) type c.

upload internal table using fm gui_upload.

after that use internal table for upload data into application server.u can upload xml file also using this fm.

start-of-selection.

open dataset d1 for input in text mode.

if sy-subrc = 0.

do.

read dataset d1 into wa.

if sy-subrc <> 0.

exit.

endif.

split wa at ',' into itab-fld1 itab-fld2 itab-fld3.

append itab.

enddo.

endif.

close dataset d1.

Read only

0 Likes
983

I need to upload the data to Application server. The out put should be XML file.

Can you send sample code for this ?

Reward points are assured.

Best Regards

Bhagat.

Read only

0 Likes
983

Hello Bhagat,

Try using the function module SCMS_DOWNLOAD.

Manoj

Read only

0 Likes
983

u can download the XML too via same code i sent to you

Read only

Sathish
Product and Topic Expert
Product and Topic Expert
0 Likes
983

check out this FM SCWN_NOTE_DOWN_LOAD_XML

Read only

Former Member
0 Likes
983

refer to upload xml file to internal table using gui_upload