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: 

File canu0092t see in al11 dir/ tempt

Former Member
0 Kudos

Hi,

I created filename z001 in sap and its already running, but when I log to AL11 dir temp, I can’t see z001. I already used open dataset but its not working. Can you please give me detailed sample program? Thanks.

3 REPLIES 3

kiran_k8
Active Contributor
0 Kudos

Hi Barbie Do you wanna try this.

Depending on the operating system of the application server(s) it's a MD or makedir command - on Unix or Windows level, not in SAP.

(It's also possible via a C-function call).

*works on UNIX server.

data: unixcom like rlgrap-filename.

data: begin of tabl occurs 500,

line(400),

end of tabl.

dir = unixcom = 'mkdir mydir'. "command to create dir

"to execute the unix command

call 'SYSTEM' id 'COMMAND' field unixcom

id 'TAB' field tabl[].

Say thanks to sdn.

K.Kiran.

Former Member
0 Kudos

data : it_mara like table of mara with header line,

v_rec(60),

TAB(3) value ' ',

coma type c value ','.

*****************************creating file on application server************************

select matnr

mtart

ernam

matkl

meins from mara

into corresponding fields of

table it_mara.

open dataset 'matdet.txt' in text mode encoding default for output.

if sy-subrc <> 0.

exit.

endif.

loop at it_mara.

concatenate it_mara-matnr it_mara-mtart it_mara-ernam into v_rec separated by coma.

transfer v_rec to 'matdet.txt'.

  • transfer it_mara to 'matdet.txt'.

endloop.

if sy-subrc = 0.

message i000(bctrain) with 'File created on application server'.

endif.

close dataset 'matdet.txt'.

////////after running this goto al11 transaction and search it in home directory...

*****************Reading application server file into internal table**************************

*

open dataset 'matdet.txt' in text mode encoding default for input.

if sy-subrc <> 0.

exit.

endif.

do.

read dataset 'matdet.txt' into v_rec.

if sy-subrc <> 0.

exit.

endif.

split v_rec at TAB into it_mara-matnr it_mara-mtart it_mara-ernam.

append it_mara.

clear it_mara.

enddo.

close dataset 'matdet.txt'.

loop at it_mara.

write : / it_mara-matnr ,

it_mara-mtart ,

it_mara-ernam.

endloop.

Message was edited by:

Premalatha G

Former Member
0 Kudos

Hi,

Check the sy-subrc by putting break point into in your Code.

Example code.

DATA : V_COUNTR LIKE EDIDS-COUNTR,

FNAME(255) TYPE C VALUE '/data/sapdata/eu_ums/astdetails'.

CONSTANTS : C_COMMA TYPE C VALUE ','.

Here take all the data into final internal table.After that assign the column names to internal table in first row by below code.

I_FINAL-DOCNUM = 'IDOCNO'.

I_FINAL-STATXT = 'ERROR TEXT'.

I_FINAL-STAPA1 = 'ERROR DETAILS'.

I_FINAL-QMNUM = 'NOTIFICATION'.

I_FINAL-ZASSETCLASS = 'ASSETCLASS'.

I_FINAL-ZDATACODE = 'DATACODE'.

I_FINAL-ZMFRCODE = 'MANUFACTURER'.

I_FINAL-ZMODELCODE = 'MODELCODE'.

I_FINAL-ZSERNO = 'SERIALNO'.

*

INSERT I_FINAL INDEX 1.

CLEAR I_FINAL.

*

IF SY-BATCH = 'X'.

LOOP AT I_FINAL.

CONCATENATE

I_FINAL-DOCNUM

I_FINAL-STATXT

I_FINAL-STAPA1

I_FINAL-QMNUM

I_FINAL-ZASSETCLASS

I_FINAL-ZDATACODE

I_FINAL-ZMFRCODE

I_FINAL-ZMODELCODE

I_FINAL-ZSERNO

into I_DISPLAY-REC SEPARATED BY C_COMMA.

APPEND I_DISPLAY.

CLEAR I_DISPLAY.

ENDLOOP.

OPEN DATASET FNAME FOR OUTPUT IN TEXT MODE.

LOOP AT I_DISPLAY.

TRANSFER I_DISPLAY TO FNAME.

ENDLOOP.

CLOSE DATASET FNAME.

Don't forget to reward if useful...