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

application server file path name separated by apace

Bharath84
Participant
0 Likes
6,474

Hi All,

I am writing files on application server. Below is my fie path.

parameters: p_o_file  like rlgrap-filename default   '/xxx/tmp/app/outbound/1~lcxxxx~ACTUAL~periodfyyear~RR.txt'.

data : mnthyear(12) type c,

         year(6) type c.

case p_rpmax.

when '010'.

p_ryear = p_ryear - 1.

concatenate 'FY' p_ryear into year.

concatenate 'OCT' '-' year into mnthyear separated by space.

replace 'periodfyyear' with mnthyear into p_o_file.

In the report output I am getting the file name correctly.

Output File: /dev/tmp/app/outbound/1~LC1000~ACTUAL~OCT - FY2013~RR.txt

When checked in AL11, it is showing me the below file name

1~LC1000~ACTUAL~OCT

my file name is truncated after space.

Can we create a file name with spaces? Awaiting your replies.

Thanks,

Haritha

Is there any specific reason why you want spaces before and after -?

21 REPLIES 21
Read only

former_member201275
Active Contributor
0 Likes
6,432

No, on AL11 a filename cannot have a space.

Read only

Former Member
0 Likes
6,432

Hi,

I could create file on the application server with the name which you have specified... I have Windows NT

Read only

0 Likes
6,432

Hi Abhijit,

Can you please explain how you have done this. It will be helpful if you can share the code.

Thanks,

HT

Read only

0 Likes
6,432

Pl find snipet..

FORM save_file.
   DATA: lv_data TYPE string.

*Move complete path to filename
   gv_file = '1~LC1000~ACTUAL~OCT - FY2013~RR.txt'.

* Open the file in output mode
   OPEN DATASET gv_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
   IF sy-subrc NE 0.
     MESSAGE 'Unable to create file' TYPE 'I'.
     EXIT.
   ENDIF.

   LOOP AT gt_spfli INTO gwa_spfli.
     CONCATENATE gwa_spfli-carrid
                 gwa_spfli-connid
                 gwa_spfli-countryfr
                 gwa_spfli-cityfrom
                 gwa_spfli-airpfrom
                 gwa_spfli-countryto
                 gwa_spfli-cityto
                 gwa_spfli-airpto
                 gwa_spfli-arrtime
      INTO lv_data
      SEPARATED BY ','.
*TRANSFER moves the above fields from workarea to file  with comma
*delimited format
     TRANSFER lv_data TO gv_file.
     CLEAR: gwa_spfli.
   ENDLOOP.
* close the file
   CLOSE DATASET gv_file.

ENDFORM.

Read only

0 Likes
6,432

Hi Abhijit,

The file path on the selection will be in disable mode and the file name was declared as a default value.

I am having p_bukrs, p_year, p_monat on the selection scree.

For co.code lc1000, fy2014, P10, the file should be 1~LC1000~ACTUAL~OCT - FY2013~RR.txt

For co.code   lc2000, fy2014, P11, the file should be 1~LC2000~ACTUAL~NOV - FY2013~RR.txt

For co.code lc1000, fy2014, P05, the file should be 1~LC1000~ACTUAL~MAY - FY2014~RR.txt

The file name should be dynamic based on the input. I am able to get the file name without spaces on appl.server. If there are spaces in file name in appl server, it is truncating after the space.

Can we write dynamic file name separated by spaces in appl server?

Awaiting replies.

Thanks,

HT

Read only

0 Likes
6,432

I used you code and build the file and it updates it as well...

data : mnthyear(12) type c,
          p_ryear(4) type c value '2014',
          year(6) type c.

p_ryear = p_ryear - 1.

concatenate 'FY' p_ryear into year.

concatenate 'OCT' '-' year into mnthyear separated by space.

I replaced OCT with NOV just to check if the file gets created..



   gv_file = p_o_file.

* Open the file in output mode
   OPEN DATASET gv_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.


What is your operating system, it could be the restriction of the same.

Read only

0 Likes
6,432

I am using Win 7 and in 4.0B system. There is no keyword ENCODING DEFAULT in 4.0B.

Read only

0 Likes
6,432

Can you check what is the syntax of OPEN DATA in your version? I am not sure if that really impacts the file name...

Read only

0 Likes
6,432

Hi,


Below is the syntax:

OPEN DATASET p_o_file FOR OUTPUT IN TEXT MODE.

There is no addition ENCODING DEFAULT in 4.0B.

parameters: p_o_file  like rlgrap-filename default   '/xxx/tmp/app/outbound/1~lcxxxx~ACTUAL~periodyr~RR.txt'.


data : monthyr(12) type c.

constants : c_space(1) type c value ' '.

case p_rpmax.

when '001'.

p_ryear = p_ryear - 1.

concatenate 'JAN' c_space '-'  c_space 'FY' p_ryear into monthyr.

replace periodyr with monthyr into p_o_file.

when '002'.

p_ryear = p_ryear - 1.

concatenate 'FEB' c_space '-'  c_space 'FY' p_ryear into monthyr.

replace periodyr with monthyr into p_o_file.

when '003'.

p_ryear = p_ryear - 1.

concatenate 'MAR' c_space '-'  c_space 'FY' p_ryear into monthyr.

replace periodyr with monthyr into p_o_file.

endcase.

In AL11 it is giving me the below file name.

1~LC1000~ACTUAL~JAN

It is truncating after the spaces.

Read only

0 Likes
6,431

My version doesn't allow OPEN DATASET without IN TEXT MODE so I am not able to test anything...

Can you check if you can save a file with name larger than what it is saving now.. just forget abt spaces, check if the system is restricting you to that size.

Will CONDENSE command work for you?

Regards

Read only

0 Likes
6,431

There are many files in my appl. server with files with file name having larger than what I said.

Read only

0 Likes
6,431

Any luck with CONDENSE stmt?

Read only

0 Likes
6,431

Can you tell me where exactly I have to use the CONDENSE keyword?

Read only

0 Likes
6,431

CONDENSE p_o_file.

before open dataset

Read only

0 Likes
6,431

better add

CONDENSE p_o_file NO-GAPS.

Read only

0 Likes
6,431

I used CONDENSE p_o_file NO-GAPS. I am getting the below file name :

1~LC1000~ACTUAL~OCT-FY2013~RR.txt


But I need a single space before and after the "hyphen" symbol as below:

1~LC1000~ACTUAL~OCT - FY2013~RR.txt

Read only

0 Likes
6,431

Hi Haritha,

As you are saying you want a spaces before and after the '-' so your file name will be now

/xxx/tmp/app/outbound/1~lcxxxx~ACTUAL~JAN - FY2013~RR.txt

If this correct can you try this ..

data: file1(50) type c value '/xxx/tmp/app/outbound/1~lcxxxx~ACTUAL~',
        file2(10) type c value '~RR.txt'.


concatenate 'JAN' '-' 'FY' into mnthyear separated by space.
concatenate mnthyear p_ryear into mnthyear.
concatenate file1 mnthyear file2 into p_o_file.


I have done for January.


Let me know if it is working..


Regards


Read only

0 Likes
6,431

data : monthyr(8) type c,     

periodyr(12) type c,

case p_rpmax. 

when '010'.    

p_ryear = p_ryear - 1.   

concatenate 'OCT' '-' 'FY' into monthyr separated by space.   

concatenate monthyr p_ryear into periodyr.

Below is the filename in AL11. It is truncating after OCT

Read only

0 Likes
6,431

Is there any specific reason why you want spaces before and after -?

Read only

0 Likes
6,431

Another aspect could be that your version is not Unicode supported and I came across the below..

In Unicode programs file names containing spaces are permitted. If a file name is declared in a non-Unicode program that contains spaces, anything following the first space is dropped. In Unicode programs, spaces are treated as part of the name.


So I guess you will have to rethink of how to name the files.


Regards


Read only

VenkatRamesh_V
Active Contributor
0 Likes
6,431

Hi Haritha,

Hope it helpful.

data: lv_data TYPE string,
       lv_text1 TYPE string,
       lv_text2 TYPE string,
       lv_text3 TYPE string.

START-OF-SELECTION.

lv_data = '1~LC1000~ACTUAL~OCT-FY2013~RR.txt'.


SPLIT lv_data  at  '-' INTO  lv_text1 lv_text2.

CONCATENATE lv_text1 '-' lv_text2 INTO lv_text3 SEPARATED BY space.


WRITE lv_text3.



Regards,

Venkat.