2014 Aug 21 8:45 AM
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
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
2014 Aug 21 9:12 AM
2014 Aug 21 11:14 AM
Hi,
I could create file on the application server with the name which you have specified... I have Windows NT
2014 Aug 21 11:33 AM
Hi Abhijit,
Can you please explain how you have done this. It will be helpful if you can share the code.
Thanks,
HT
2014 Aug 21 12:33 PM
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.
2014 Aug 21 1:43 PM
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
2014 Aug 21 2:03 PM
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.
2014 Aug 21 2:40 PM
I am using Win 7 and in 4.0B system. There is no keyword ENCODING DEFAULT in 4.0B.
2014 Aug 22 5:42 AM
Can you check what is the syntax of OPEN DATA in your version? I am not sure if that really impacts the file name...
2014 Aug 22 6:47 AM
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.
2014 Aug 22 12:21 PM
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
2014 Aug 22 1:41 PM
There are many files in my appl. server with files with file name having larger than what I said.
2014 Aug 22 2:34 PM
2014 Aug 22 2:41 PM
Can you tell me where exactly I have to use the CONDENSE keyword?
2014 Aug 22 3:13 PM
2014 Aug 22 3:55 PM
2014 Aug 25 7:03 AM
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
2014 Aug 25 8:40 AM
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
2014 Aug 25 11:56 AM
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
2014 Aug 25 12:31 PM
Is there any specific reason why you want spaces before and after -?
2014 Aug 25 12:44 PM
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
2014 Aug 25 7:17 AM
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.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |