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

regarding file creation in application server

Former Member
0 Likes
906

my present programe is creating file in the application server i got a requirement that the file need to be created in the application server separately for each and every plant, know the file is creating for all plants in the application server, any suggestion how to compare the plants and create the files separetly in appli server.

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
866

if it is a itab..

use AT NEW WERKS.

The dynamically create your file name and place it.

my present programe is creating file in the application server i got a requirement that the file need to be created in the application server separately for each and every plant, know the file is creating for all plants in the application server, any suggestion how to compare the plants and create the files separetly in appli server.

7 REPLIES 7
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
867

if it is a itab..

use AT NEW WERKS.

The dynamically create your file name and place it.

Read only

0 Likes
866

DATA:WK_string TYPE STRING.
DATA:Wk_EXT(4) TYPE C value '.xls'.
DATA:WK_path TYPE STRING.

LOOP AT ITAB.
AT NEW WERKS.
concatenate '/METERID/' ITAB-werks Wk_EXT into wk_path.
CONDENSE wk_path.
open dataset WK_path for output in text mode encoding default.
if sy-subrc <> 0.
write:'ERROR while opening dataset !!!!!!'.
EXIT.
endif.
concatenate 'Part No' 'Description'
	into wk_string separated by cl_abap_char_utilities=>horizontal_tab.
condense wk_string.
transfer wk_string to WK_path.
ENDAT.
CLEAR wk_string.
CONCATENATE ITAB-MATNR itab-maktx into wk_string 
	separated by cl_abap_char_utilities=>horizontal_tab.
transfer wk_string to WK_path.
at end of werks.
clear wk_path.
close dataset p_pfile.
endat.

Hope this meets ur req...

Read only

0 Likes
866

Sorry i made a mistake...

DATA:WK_string TYPE STRING.

DATA:Wk_EXT(4) TYPE C value '.xls'.

DATA:WK_path TYPE STRING.

LOOP AT ITAB.

AT NEW WERKS.

concatenate '/METERID/' ITAB-werks Wk_EXT into wk_path.

CONDENSE wk_path.

open dataset WK_path for output in text mode encoding default.

if sy-subrc 0.

write:'ERROR while opening dataset !!!!!!'.

EXIT.

endif.

concatenate 'Part No' 'Description'

into wk_string separated by cl_abap_char_utilities=>horizontal_tab.

condense wk_string.

transfer wk_string to WK_path.

ENDAT.

CLEAR wk_string.

CONCATENATE ITAB-MATNR itab-maktx into wk_string

separated by cl_abap_char_utilities=>horizontal_tab.

transfer wk_string to WK_path.

at end of werks.

clear wk_path.

close dataset WK_path. "<----

endat.

endloop.

Read only

0 Likes
866

cl_abap_char_utilities=>horizontal_tab.

what is the use of this statement kesu.

Read only

0 Likes
866

This will just place the values in different columns in excel sheet or notepad file ( in the column seperator or tab seperator)

Read only

Former Member
0 Likes
866

Hello,

You can easily distinguish the plants ina Itab.


Sort Itab by werks.
data: wa like itab.
loop at itab.
wa = itab.
at new werks.
open data " Here give a file name for every plant.
"transfer to file
" CLose Dataset
endat.
endloop.

Hope this will solve ur issue.

Cheers,

Vasanth

Read only

Former Member
0 Likes
866

Rocky,

After you get all the data into final internal table.

LOOP AT i_final.

AT NEW plant.

OPEN DATASET v_datset FOR OUTPUT IN

TEXTMODE.

your logic here

CLOSE DATSET v_datset.

ENDAT

TRANSFER your same plant data to file.

ENDLOOP.

Note: for each fine name add your plant name.So that there will not no over writting of files.