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: 

internal table to application server

Former Member
0 Kudos

Hi ,

actually i have uploaded data in to internal table i want to load that into application server table in to specfic path , i have never used this before so please find me steps urgent please

thanks

sridhar

8 REPLIES 8

Former Member
0 Kudos

Duplicate post, Please close this

Regards,

Ravi

former_member842213
Participant
0 Kudos

WS_upload is used to upload a file to application server.

If u want to pass a internal table contents ,u need not to pass the exporting parameter instead of that u can ve tables parameter.in that u ve to give ur internal table name

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

FILENAME =wsfile

FILETYPE = 'DAT'

TABLES

DATA_TAB = plant

EXCEPTIONS

CONVERSION_ERROR = 1

FILE_OPEN_ERROR = 2

FILE_READ_ERROR = 3

INVALID_TABLE_WIDTH = 4

INVALID_TYPE = 5

NO_BATCH = 6

UNKNOWN_ERROR = 7

OTHERS = 8.

IF SY-SUBRC <> 0.

WRITE: / 'Error Uploading', wsfile, SY-SUBRC.

STOP.

ENDIF.

Former Member
0 Kudos

DATA : FNAME TYPE STRING VALUE 'TEST1.TXT'.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = 'C:\VD.TXT'

tables

data_tab = IT_VENDOR.

Now ur datas will be available in internal table.

Using opendataset & transfer we will transfer it to application server as given below.

OPEN DATASET FNAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

LOOP AT IT_VENDOR INTO WA_VENDOR.

TRANSFER WA_VENDOR TO FNAME.

ENDLOOP.

CLOSE DATASET FNAME.

Now goto AL11 & see ur datas will be stored with name test1.txt.

Former Member
0 Kudos

if you have values for the file in the internal table , use this syntax.

OPEN DATASET FILENAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

LOOP AT ITAB INTO WA.

TRANSFER WA TO FILENAME.

ENDLOOP.

CLOSE DATASET FNAME.

HERE FILENAME IS THE NAME OF THE FILE TO BE CREATED IN YOUR APPLICATION SERVER WITH PATH.

ITAB IS THE INTERNAL TABLE WHICH CONTAINS THE VALUE FOR THE FILE.

THE ABOVE SYNTAX WILL AUTOMATICALLY CREATES FILE IN YOUR APPLICATION SERVER

0 Kudos

hi , i have never declared a workarea that is wa , then what is wa in the loop you are specifying ,

sridhar

0 Kudos

hi , i have never declared a workarea that is wa , then what is wa in the loop you are specifying ,

sridhar

0 Kudos

Hope this solve your problem,

If you are trying to download your internal table data to file in application server; then try the below,


* If you have a internal table with header line use this
* Say DATA: I_TAB LIKE TABLE OF <TABLE> WITH HEADER LINE>.
OPEN DATASET <FILENAME> FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC EQ 0.
LOOP AT I_TAB.
TRANSFER I_TAB TO <FILENAME>.
ENDLOOP.
CLOSE DATASET <FILENAME>.
ENDIF.

* If you have a internal table without header line use this
* Say DATA: I_TAB TYPE TABLE OF <TABLE>,
*                   W_TAB TYPE <TABLE>.
OPEN DATASET <FILENAME> FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC EQ 0.
LOOP AT I_TAB INTO W_TAB.
TRANSFER W_TAB TO <FILENAME>.
ENDLOOP.
CLOSE DATASET <FILENAME>.
ENDIF.

Regards

Kathirvel

0 Kudos

Hi,

Check this link to learn more about working with work areas:

http://help.sap.com/saphelp_erp2004/helpdata/en/fc/eb36a1358411d1829f0000e829fbfe/content.htm