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

file upload from presentation server to application server

Former Member
0 Likes
1,555

Hi Experts,

I need to upload a xml file from presentaion server to appication server in PI system.I do not have transaction CG3Z,and Function module C13Z_FRONT_END_TO_APPL in my PI system.

Please advise me how to achieve this, provide me sample code...if any..btw am XI guy

Rewards will be guaranteed for proper answers...:-)

7 REPLIES 7
Read only

Former Member
0 Likes
1,080

Use the code below:

Please reward if useful.

-


OPEN DATASET P_FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.

**********P_FILE is your application server path.

IF SY-SUBRC = 0.

LOOP AT IT_DATA.

TRANSFER IT_DATA TO P_FILE.

                    • IT_DATA is your internal table

ENDLOOP.

PERFORM WRITE_REPORT. " Writes the Output Report

ELSE.

WRITE:/ TEXT-001. " Error Opening Dataset.

ENDIF.

Edited by: Sachin123 on May 22, 2008 6:02 AM

Read only

0 Likes
1,080

Hi Sachin,

Thanks for your quick reply,what should i write in the internal table IT_DATA,is it specific to the fields which the file contains?

am not much familier with ABAP code.Please send me the code which can meet my requirement to upload file from presentation server to application server exactly as CG3Z.

Many Thanks,

raju

Read only

Former Member
0 Likes
1,080

Hi Raju,

How about this FM: C13Z_FILE_DOWNLOAD_ASCII

Regards,

Aravinda Sarma M.

Read only

Former Member
0 Likes
1,080

Hi,

Reward if helpful.

Thanks.

Read only

Former Member
0 Likes
1,080

Hi,

The FM which transfers a file from

Presentation - > Application Server is :

ARCHIVFILE_CLIENT_TO_SERVER

You just need to mention filename with complete path.

Regards

Kiran Sure

Read only

0 Likes
1,080

Hi Kiran,

Thanks for the quick reply...

I have tried with the FM "ARCHIVFILE_CLIENT_TO_SERVER

",

The path given : local hard drive path

Target path : application server( PI system) path

But am getting the error in opening the file , no such file or directories.

please let me know target path is for application server.

Read only

0 Likes
1,080

Try this .....this will help u

tables: zdms_mst_knvv,

knvp,

knbk,

bnka.

data: begin of it_mst_knvv occurs 0,

kunnr like knvp-kunnr,

vkorg like knvv-vkorg,

vtweg like knvv-vtweg,

spart like knvv-spart,

kdgrp like knvv-kdgrp,

end of it_mst_knvv .

data: begin of it_knvp occurs 0,

kunnr like knvp-kunnr,

end of it_knvp .

data: begin of it_knbk occurs 0,

kunnr like knbk-kunnr,

bankl like knbk-bankl,

bankn like knbk-bankn,

bvtyp like knbk-bvtyp,

koinh like knbk-koinh,

end of it_knbk .

data: begin of it_bnka occurs 0,

bankl like bnka-bankl,

banka like bnka-banka,

brnch like bnka-brnch,

end of it_bnka .

data: begin of it_kna1 occurs 0,

kunnr like kna1-kunnr,

name1 like kna1-name1,

end of it_kna1 .

data: begin of it_download occurs 0,

string(239),

end of it_download.

data: f1(2),

f2(2),

f3(2),

f4(2).

data: it_textno like zdms_textno occurs 0,

wa_textno like line of it_textno .

data : gv_filenum like zdms_textno-filenumber ,

gv_path like zdms_textno-path,

gv_filenumc(10) type c .

  • DATA: gv_file1 type string.

data: gv_file1 type dxfile-filename,

it_temp type standard table of dxrawdata.

data : w_server type msxxlist-name value 'r3prod_EEP_05'.

start-of-selection.

select kunnr

vkorg

vtweg

spart

kdgrp

from zdms_mst_knvv

into table it_mst_knvv .

if not it_mst_knvv[] is initial.

select kunnr

from knvp

into table it_knvp

for all entries in it_mst_knvv

where kunnr eq it_mst_knvv-kunnr

and vkorg eq '1000'

and vtweg eq '25'

and spart eq '00'

and parvw eq 'AG'.

endif.

if not it_knvp[] is initial.

select kunnr

name1

from kna1

into table it_kna1

for all entries in it_knvp

where kunnr eq it_knvp-kunnr.

endif.

if not it_knvp[] is initial.

select kunnr

bankl

bankn

bvtyp

koinh

from knbk

into table it_knbk

for all entries in it_knvp

where kunnr = it_knvp-kunnr.

endif.

if not it_knbk[] is initial.

select bankl

banka

brnch

from bnka

into table it_bnka

for all entries in it_knbk

where bankl = it_knbk-bankl.

endif.

it_download-string = 'BANK' .

append it_download .

clear it_download .

it_download-string = '{' .

append it_download .

clear it_download .

loop at it_knvp.

clear: it_knbk,

it_bnka,

it_kna1.

read table it_kna1 with key kunnr = it_knvp-kunnr.

read table it_knbk with key kunnr = it_knvp-kunnr.

if sy-subrc = 0.

read table it_bnka with key bankl = it_knbk-bankl.

endif.

if ( it_knbk-bankl ne '' and it_knbk-kunnr ne '' and it_knbk-bankn ne '').

IF it_bnka-banka EQ ''.

f1 = ' ~'.

ELSE.

f1 = '~'.

ENDIF.

IF it_kna1-name1 EQ ''.

f2 = ' ~'.

ELSE.

f2 = '~'.

ENDIF.

IF it_knbk-bvtyp EQ ''.

f3 = ' ~'.

ELSE.

f3 = '~'.

ENDIF.

IF it_knbk-koinh EQ ''.

f4 = ' ~'.

ELSE.

f4 = '~'.

ENDIF.

CONCATENATE 'bank'

'~'

'001'

'~'

it_knbk-bankl

'~'

it_knbk-kunnr

'~'

it_knbk-bankn

'~'

it_bnka-banka

f1

it_kna1-name1

f2

it_knbk-bankl

'~'

it_knbk-bvtyp

f3

it_knbk-koinh

f4

';'

INTO it_download-string.

APPEND it_download.

CLEAR it_download.

ENDIF.

ENDLOOP.

it_download-string = '}' .

APPEND it_download .

CLEAR it_download .

CLEAR: gv_filenum ,

gv_filenumc,

gv_file1 ,

wa_textno .

SELECT SINGLE filenumber path

FROM zdms_textno

INTO (gv_filenum, gv_path)

WHERE filename EQ 'dms_' .

MOVE gv_filenum TO gv_filenumc .

SHIFT gv_filenumc LEFT DELETING LEADING '0'.

  • if gv_filenum < 10 .

  • concatenate '0' gv_filenumc into gv_filenumc .

  • endif.

CONCATENATE gv_path 'dms_'

gv_filenumc

'.txt'

INTO gv_file1 .

*************************************Commented By Anbu****************************************************

*Downloading the file to Application Server**

*open dataset gv_file1 for output in text mode ENCODING DEFAULT .

*

  • loop at it_download.

  • transfer it_download-string to gv_file1.

  • endloop.

  • LOOP AT it_download.

  • move it_download TO it_temp.

  • ENDLOOP.

it_temp[] = it_download[].

CALL FUNCTION 'dx_file_write'

EXPORTING

filename = gv_file1

server = w_server

pc = ''

TABLES

data_tab = it_temp

EXCEPTIONS

no_file_on_server = 1

no_data_on_server = 2

gui_download_failed = 3

no_authority = 4

OTHERS = 5.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

*************************************Ended By Anbu****************************************************

CLOSE DATASET gv_file1.

IF sy-subrc = 0.

wa_textno-filename = 'dms_' .

wa_textno-filenumber = gv_filenum + 1 .

wa_textno-path = gv_path.

MODIFY zdms_textno FROM wa_textno .

ENDIF.

Plz reward

Regards

Anbu