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: 

data to al11

Former Member
0 Kudos

hi gurus,

i am pulling data from the bseg with certain fields and i want that data to move it al11 to one of those directories

how can i do that pls suggest me in this regard and please proivde me step by step as am new to this programme

and your help is much appriciated.

regards,

jacob.

7 REPLIES 7

Former Member
0 Kudos

Hi,

To move the data to one of the directories in AL11 you have to use Dataset operations.

Goto ABAPDOCU transaction type in the following keyword:

Open , Tansfer, Close, Read and Dataset. To get the exact syntax of how to write data in application server directories.

Thanks & Regards,

Navneeth K.

former_member181995
Active Contributor
0 Kudos

Collect data in internal table than user open dataset commands.

for more help you may search like this:[Search results.|https://www.sdn.sap.com/irj/sdn/advancedsearch?query=uploaddatatoapplicationserver&cat=sdn_all]

Former Member
0 Kudos

Hi Jacob,

Transaction AL11 shows the directories in Application server, if you want to move the data to application server then look into OPEN DATASET, CLOSE DATASET, READ DATASET, TRANSFER DATASET.

Regards

Kumar M

Former Member
0 Kudos

Hello,

You will have to select the data from bseg table

loop at each record.

open dataset dsn

transfer to dsn

endloop.


REPORT  zbseg_tst                               .

TABLES bseg.

DATA  : BEGIN OF gt_bseg OCCURS 0.
        INCLUDE STRUCTURE bseg.
DATA  : END OF gt_bseg.

DATA dsn(100) TYPE c.


START-OF-SELECTION.
  SELECT * FROM bseg
  INTO TABLE gt_bseg.

END-OF-SELECTION.

  PERFORM download_file.


*&---------------------------------------------------------------------*
*&      Form download_file
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM download_file.

  DATA : lex_file_open TYPE REF TO cx_sy_file_open,
         lex_file_access TYPE REF TO cx_sy_file_access_error,
         lex_file_io TYPE REF TO cx_sy_file_io.

  DATA l_fsap(150) TYPE c.


  l_fsap = 'usr\zsap\'.


* Try to open the data set and catch the appropriate exception
  TRY.

      OPEN DATASET l_fsap FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

    CATCH cx_sy_file_open INTO lex_file_open.
      MESSAGE lex_file_open->errortext TYPE 'I'.
    CATCH cx_sy_file_access_error INTO lex_file_access.
      MESSAGE lex_file_access->filename TYPE 'I'.

  ENDTRY.

  IF sy-subrc = 0.
    LOOP AT gt_bseg.

      TRY.

          TRANSFER gt_bseg TO l_fsap.

        CATCH cx_sy_file_io INTO lex_file_io.
          MESSAGE lex_file_io->errortext TYPE 'I'.
        CATCH cx_sy_file_access_error INTO lex_file_access.
          MESSAGE lex_file_access->filename TYPE 'I'.

      ENDTRY.
    ENDLOOP.
  ENDIF.

  CLOSE DATASET l_fsap.

  CLEAR : l_fsap.


ENDFORM.                    " gui_download

regards,

Advait

Former Member
0 Kudos

Sample code

OPEN DATASET p_file1 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
  LOOP AT itab.
    TRANSFER itab TO p_file1.
  ENDLOOP.
CLOSE DATASET p_file1.

Former Member
0 Kudos

Hi

Try the sample code

Make sure the Directory you specify in "FILE" exists in AL11.

TYPES : BEGIN OF TY_BSEG,
        BUKRS TYPE BSEG-BUKRS,
        END OF TY_BSEG.

DATA : IT_BSEG TYPE TABLE OF TY_BSEG,
       WA_BSEG TYPE TY_BSEG,
       LINE    TYPE STRING.

DATA : FILE TYPE STRING VALUE 'E:\usr\sap\put\file.dat'.

SELECT BUKRS
FROM BSEG
INTO TABLE IT_BSEG UP TO 10 ROWS.

OPEN DATASET FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

LOOP AT IT_BSEG INTO WA_BSEG.

  TRANSFER WA_BSEG TO FILE.

ENDLOOP.

CLOSE DATASET FILE.

WRITE : 'Transfer complete'.

Regards

Edited by: Rajvansh Ravi on Oct 20, 2008 11:07 AM

Former Member
0 Kudos

Select the entries from BSEG into the internal table T_BSEG

then use this

OPEN DATASET FILE FOR OUTPUT IN BINARY MODE.

LOOP AT T_BSEG

TRANSFER T_BSEG TO application path.

ENDLOOP.