Application Development and Automation 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: 
Read only

Data download on Application Server

Former Member
0 Likes
561

Dear All,

Could u please help me in the following topic:

I have data records in the Internal Table in Report. I want to download that data on Application Server in the form of Text file(*.txt). what is the name of FM for this?

Thanks in advance.

Best Regards,

Prasad

5 REPLIES 5
Read only

Former Member
0 Likes
534

Hi,

Use OPEN DATASET.

take help from help.sap.com

Reward if useful!

Read only

Former Member
0 Likes
534

Hi

i am sending you a code

in which i had wrote the logic like this

data from file to internal table

internal table to application server

by seeing this you can understand very easyly

reward if usefull

if you want to put data into application server you ned to use this code

OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

*--- Display error messages if any.

IF sy-subrc NE 0.

MESSAGE e001(zsd_mes).

EXIT.

ELSE.

*---Data is downloaded to the application server file path

LOOP AT it_tab2 INTO wa_tab2.

TRANSFER wa_tab2 TO p_file.

ENDLOOP.

ENDIF.

*--Close the Application server file (Mandatory).

CLOSE DATASET p_file.

there is no FM for this

*&---------------------------------------------------------------------*
*& Report  ZSD_EXCEL_INT_APP
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZSD_EXCEL_INT_APP.

parameter: file_nm type localfile.

types : begin of it_tab1,
        f1(20),
        f2(40),
        f3(20),
       end of it_tab1.


data : it_tab type table of ALSMEX_TABLINE with header line,
       file type rlgrap-filename.

data : it_tab2 type it_tab1 occurs 1,
       wa_tab2 type it_tab1,
       w_message(100)  TYPE c.


at selection-screen on value-request for file_nm.

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
 EXPORTING
*   PROGRAM_NAME        = SYST-REPID
*   DYNPRO_NUMBER       = SYST-DYNNR
*   FIELD_NAME          = ' '
   STATIC              = 'X'
*   MASK                = ' '
  CHANGING
   file_name           = file_nm
 EXCEPTIONS
   MASK_TOO_LONG       = 1
   OTHERS              = 2
          .
IF sy-subrc <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


start-of-selection.

refresh it_tab2[].clear wa_tab2.

file = file_nm.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
  EXPORTING
    filename                      = file
    i_begin_col                   = '1'
    i_begin_row                   =  '1'
    i_end_col                     = '10'
    i_end_row                     = '35'
  tables
    intern                        = it_tab
 EXCEPTIONS
   INCONSISTENT_PARAMETERS       = 1
   UPLOAD_OLE                    = 2
   OTHERS                        = 3
          .
IF sy-subrc <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

loop at it_tab.

  case it_tab-col.

   when '002'.

    wa_tab2-f1 = it_tab-value.

   when '004'.

    wa_tab2-f2 = it_tab-value.

  when '008'.

    wa_tab2-f3 = it_tab-value.

 endcase.

 at end of row.

  append wa_tab2 to it_tab2.
 clear wa_tab2.
  endat.

endloop.

data : p_file TYPE  rlgrap-filename value 'TEST3.txt'.


OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
*--- Display error messages if any.
  IF sy-subrc NE 0.
    MESSAGE e001(zsd_mes).
    EXIT.
  ELSE.

*---Data is downloaded to the application server file path
    LOOP AT it_tab2 INTO wa_tab2.
      TRANSFER wa_tab2 TO p_file.
    ENDLOOP.
  ENDIF.

*--Close the Application server file (Mandatory).
  CLOSE DATASET p_file.

 loop at it_tab2 into wa_tab2.

  write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.

 endloop.

Read only

Former Member
0 Likes
534

Hi,

Use this simple one

OPEN DATASET APPLSERVER1 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

LOOP AT IT_DATA.

TRANSFER IT_DATA TO APPLSERVER1.

ENDLOOP.

CLOSE DATASET APPLSERVER1.

Please reward points if useful....

Read only

Former Member
0 Likes
534

Dear All,

Thanks for ur help. Sorry, but I want help again once - How to see/open the file stored on Application server path(TCode)?

Thanks in advance,

Prasad.

Read only

Former Member
0 Likes
534

Dear all,

Thanks...............my question is solved . Tcode is 'AL11'.

I am closing the thread.

Thanks again.

Prasad