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: 

Issue in Uploading file to application server

Former Member
0 Kudos

Hi folks,

I need to transfer data to excel file on application server but i am facing issues while doing so.

I am working on ECC6.0 system.

I am trying with this code and it giving dump error on transfer command.

w_file = '/usr/data/020//varun.xls'.

OPEN DATASET w_file for input in text mode encoding non-unicode.

LOOP AT T_MARD.

TRANSFER string to w_file.

endloop.

CLOSE DATASET w_file.

Please help.

Is there any other way to do so please let me know

13 REPLIES 13

kesavadas_thekkillath
Active Contributor
0 Kudos

w_file = '/usr/data/020//varun.xls'.

replace double slash with single one.

w_file = '/usr/data/020/varun.xls'.

rainer_hbenthal
Active Contributor
0 Kudos

Sometime its worth reading the dump. In this case it would tell you that you opened the file for input whereas transfer is for output.

0 Kudos

u r right rainer

0 Kudos

This is the dump error:-

Error analysis

An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_FILE_OPEN_MODE', was not

caught and

therefore caused a runtime error.

The reason for the exception is:

When accessing the file "/usr/data/020/varun.xls", the system recognized

that this file is

not open. Therefore, the file cannot be accessed.

0 Kudos

chnage it to output Mode

0 Kudos

HI,

Try to have the .DAT extension instead of .XLS and check for the subrc

OPEN DATASET w_file for input in text mode encoding non-unicode.
IF SY-SUBRC EQ 0.
LOOP AT T_MARD.

TRANSFER string to w_file.

endloop.

CLOSE DATASET w_file.
ENDIF.

0 Kudos

Hi Vikas Gupta,

Chk this code.Add this code to ur program lines.

OPEN DATASET file FOR INPUT IN TEXT MODE ENCODING DEFAULT .

IF SY-SUBRC EQ 0.

LOOP AT itab INTO wa_itab.

TRANSFER wa_itab TO file.

ENDLOOP.

CLOSE DATASET file.

ELSE.

" Display ur own message

ENDIF.

Regards,

Lakshman

0 Kudos

While transferring wa to the the file i am getting dump error-

For the statement

"TRANSFER f TO ..."

only character-type data objects are supported at the argument posit

"f".

In this case. the operand "f" has the non-character-type "MARD". The

current program is a Unicode program. In the Unicode context, the ty

'X' or structures containing not only character-type components are

regarded as non-character-type.

I am using this code-

OPEN DATASET w_file for output in text mode encoding non-unicode.

if sy-subrc eq 0.

LOOP AT T_MARD into wa_mard.

TRANSFER wa_mard to w_file.

*

endloop.

*

endif.

CLOSE DATASET w_file.

While passing the wa to the file it is giving error and when i tried with a string it doesnt give any error.

so is there any way to convert the wa into a string and pass it to the file?

0 Kudos

Hi,

This is because several fields in MARD are not of type 'C' or Character. Therefore in unicode you cannot directly pass the fields.

Pass the MARD data into a structure or work area with corresponding fields on type c and length as the output length of the particular field in MARD and ten transfer from that work area to the file.

Regards,

Ankur Parab

0 Kudos

Hi Got the solution :-

If the data to be transferred is having all characters then we can use this:-

OPEN DATASET w_file for output in text mode encoding non-unicode.

if sy-subrc eq 0.

LOOP AT T_MARD into wa_mard.

TRANSFER wa_mard to w_file.

endloop.

endif.

CLOSE DATASET w_file.

If all the data is not in char then - declare a char strinf of the table length.

Data: loc_string(300) type c.

OPEN DATASET w_file for output in text mode encoding non-unicode.

if sy-subrc eq 0.

LOOP AT T_MARD into wa_mard.

CALL FUNCTION 'HR_99S_COPY_STRUC1_STRUC2'

EXPORTING

p_struct1 = wa_mard

IMPORTING

p_struct2 = loc_string.

TRANSFER loc_string to w_file.

endloop.

endif.

CLOSE DATASET w_file.

Thanks for the help

Former Member
0 Kudos

dear used this funtion nolule to upload

ARCHIVFILE_CLIENT_TO_SERVER

kesavadas_thekkillath
Active Contributor
0 Kudos

declare a work area with character variables of equal size of your work area.

then move to the new one and transfer