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: 

how to create a Dir and files within it?

Former Member
0 Kudos

Hi all ,

I need to create a Dir and some sample files within it for some testing purpose,can any body tell me how to do it?(I follow al11 GUI options but its giving some error)

Or

Is there any FM by which we can do it directly to application server????

Its urgent requirement..

Thanx in advance

9 REPLIES 9

Former Member
0 Kudos

to create a file in appl server you have to use open dataset and close data set..

see the sample code

REPORT zanid_test MESSAGE-ID zz .

*

parameters: FULLPATH(128) obligatory lower case

default 'E:\usr\sap\put\file.txt'.

*you change the appl sever path as per your config.

DATA : BEGIN OF list_asc OCCURS 0,

msg(300) TYPE c,

END OF list_asc.

*

start-of-selection.

*---populating data

list_asc-msg = 'abcdefghijkl'. "your sample data

append list_asc.

list_asc-msg = 'faagoaagiagig'. "your sample data

append list_asc.

*

OPEN DATASET fullpath FOR OUTPUT IN TEXT MODE.

LOOP AT LIST_ASC.

TRANSFER LIST_ASC-MSG TO fullpath.

CLEAR LIST_ASC-MSG.

ENDLOOP.

CLOSE DATASET fullpath.

now if you go to appl server , you will find that file in that specified path..

to create a directory yu can go to transaction AL11 and click the 'konfigurieren'button, you then you can specify the directory attibutes to create a directory

and to load a file from your loacl pc to appl server you can use transaction CG3Y also, instead of the abap code.

plz rewrad points if it helps you.

0 Kudos

How would I be able to get this file on the application server on to the presntaion server through the program directly. I have used open and closed data set to get the data on my application server but I need to get it from the application server to the prsesnation serevr directly through my program so that it can be easily seen by the users.

    when 'X'.                      "X is application server
*         TRANSLATE p_err USING '\/'." correct slash for unix
      open dataset p_err2 for output in text mode encoding default.
      if sy-subrc = 0.
        loop at t_err into s_dls.
          transfer s_dls to p_err2.

          if sy-subrc ne 0.
            message i010(ad) with p_err2 'Download Failed'.
          endif.
        endloop.
        close dataset p_err2.

Is theer a way to use transaction CG3Y in my program by calling it and giving the application server file name as source file name and presention serevr file name in my destination file and it will directly run and bring in the file on the application serevr, or is sther any other way wherin I can bring in that application server file on to presentaion server file directly through my program.

Thanaks

0 Kudos

u can use this fm C13Z_APPL_TO_FRONT_END

кu03B1ятu03B9к

0 Kudos

How do I use this function module and where in my code part so that it automatically comes to a particular file location , never used it before.

      open dataset p_err2 for output in text mode encoding default.
      if sy-subrc = 0.
        loop at t_err into s_dls.
          transfer s_dls to p_err2.

          if sy-subrc ne 0.
            message i010(ad) with p_err2 'Download Failed'.
          endif.
        endloop.
        close dataset p_err2.
                 .
        
      else.

Thanks

0 Kudos

And can I set this in the background itself so wafter the job is done it automatically transfers all the file there in the P drive after getting it from the application server.

andreas_mann3
Active Contributor
0 Kudos

Hi,

look here

regards Andreas

former_member188685
Active Contributor
0 Kudos

Hi

Go to Al11 and in that you can see a tab Configure.

There you can create the Directory and say Add button

and then Save .

and after that Using

Open Data set ds1 for Output.

will create the File if it is not there .

you can specofy the path in which you can create the files.

you are telling it for Testing Purpose then Go for Dir_TMP

there you can create and test.

Regards

vijay

0 Kudos

Hi,

or try that:

DATA: COMMAND(200).

DATA: BEGIN OF TABL OCCURS 0,

LINE(255),

END OF TABL.

command = 'mkdir /home/testdir1'.

CALL 'SYSTEM' ID 'COMMAND' FIELD COMMAND ID 'TAB' FIELD TABL-SYS.

regards Andreas

abdul_hakim
Active Contributor
0 Kudos

Hi

OPEN DATASET statement helps you to create a file..

NOTE:The file will be created at the appln server level..

Regards,

Abdul