2009 Jun 08 8:03 AM
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
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
2009 Jun 08 8:07 AM
w_file = '/usr/data/020//varun.xls'.
replace double slash with single one.
w_file = '/usr/data/020/varun.xls'.
2009 Jun 08 8:08 AM
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.
2009 Jun 08 8:13 AM
2009 Jun 08 8:16 AM
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.
2009 Jun 08 8:17 AM
2009 Jun 08 8:21 AM
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.
2009 Jun 08 8:22 AM
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
2009 Jun 08 8:37 AM
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?
2009 Jun 08 9:39 AM
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
2009 Jun 08 10:40 AM
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
2009 Jun 08 8:13 AM
2009 Jun 08 8:15 AM
dear used this funtion nolule to upload
ARCHIVFILE_CLIENT_TO_SERVER
2009 Jun 08 9:33 AM
declare a work area with character variables of equal size of your work area.
then move to the new one and transfer
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |