04-05-2009 6:17 PM
Hi frnds,
I have an internal table which holds some data.
I want to download this data into application server.I have written the code as
data : l_file like rlgrap-filename value '/usr/sap/tmp/file1.txt'.
open dataset l_file for output in text mode encoding default.
loop at it_output into wa_output.
transfer wa_output to l_file.
endloop.
close dataset l_file.
In this case i am getting dump as
" The current statement is only defined for character-type data objects."
Please suggest what need to be done.
regards,
satish
04-05-2009 6:29 PM
Hi Satish,
SAP only allows to download String/ Character format data to the application server.
As I assume you might have some QUAN or CURR fields in the wa_output work area - hence trying to transfer them to the AS is causing the dump.
WRITE the QUAN, CURR fields into a character field. Concatenate all wa_output fields into a string variable and transfer this to the application server.
Hope this helps.
Regards,
Aditya
04-06-2009 4:45 AM
Hello
You may use method
CL_ABAP_CONTAINER_UTILITIES=>FILL_CONTAINER_C
This method "converts" structured variables (in your case WA_OUTPUT) into a string variable which you then can transfer to your file.
Regards
Uwe
04-06-2009 4:53 AM
HI,
You can try this FM.. this will resolve your problem
DATA : l_string(2000) TYPE C.
CALL FUNCTION 'HR_99S_COPY_STRUC1_STRUC2'
EXPORTING
P_STRUCT1 = wa_output
IMPORTING
P_STRUCT2 = l_string.
transfer l_string to l_file.
04-06-2009 4:55 AM
please declare file type as string
data : l_file type string value '/usr/sap/tmp/file1.txt'.
open dataset l_file for output in text mode encoding default.
loop at it_output into wa_output.
transfer wa_output to l_file.
endloop.
close dataset l_file.
if helpful ponts
04-06-2009 5:09 AM
Hi
Try this program.
&----
*& Report ZTRIAL_DATASET *
*& *
&----
*& *
*& *
&----
REPORT ztrial_dataset .
TYPES : BEGIN OF st_mara,
matnr TYPE mara-matnr,
mbrsh TYPE mara-mbrsh,
END OF st_mara.
DATA : it_mara TYPE TABLE OF st_mara,
wa_mara TYPE st_mara.
app_ser(30).
SELECT matnr mbrsh FROM mara INTO TABLE it_mara UP TO 20 ROWS.
OPEN DATASET 'APP_SER' IN TEXT MODE FOR OUTPUT ENCODING DEFAULT.
LOOP AT it_mara INTO wa_mara.
TRANSFER wa_mara TO 'APP_SER'.
ENDLOOP.
CLOSE DATASET 'APP_SER'.
**********************************************
*run T-Code AL11
*click home
*click app_ser.
Thanks
Anto
04-06-2009 5:12 AM
Hi Sathish,
Make yourself comfortable with File Handling Concepts.
To know the concept clearly use SAPHelp www.help.sap.com
Or
Type DATASET in your SE38 editor and press F1.
You will get wonderful explanation along with good examples which will make u comfortable in learning it as quickly as possible......
Good Luck!!!
04-06-2009 5:29 AM