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: 

regarding downloading data into application server

Former Member
0 Kudos

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

7 REPLIES 7

Former Member
0 Kudos

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

uwe_schieferstein
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

babu_kilari4
Active Contributor
0 Kudos

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!!!

Former Member
0 Kudos

Hi,

Check this link. May be this is useful

Regards,

Anki Reddy