‎2009 Aug 11 7:17 PM
Hi All,
I am facing an issue with the Concatenate statement in my program:
Data : w_date type sy-datum,
w_date1 type sy-datum,
W_OPTION_1(60) TYPE C.
w_date1 = sy-datum.
w_date = sy-datum - 40.
CONCATENATE 'ERDAT between' w_date 'and' w_date1 INTO W_OPTION_1 SEPARATED BY SPACE.
write : / w_option_1.
The output comes as :
I want these dates in quotes as below.
ERDAT BETWEEN '20090702' AND '20090811'
Can anyone help pls.
Thanks alot.
Edited by: Rob Burbank on Aug 11, 2009 2:21 PM
‎2009 Aug 11 7:29 PM
Hi
U can't do it by only one step, before cancateniting all in W_OPTION_1 u need to concatenate the dates in a distinctit step:
DATA : W_DATE TYPE SY-DATUM,
W_DATE1 TYPE SY-DATUM,
W_OPTION_1(60) TYPE C.
DATA: W_DATE_A(10),
W_DATE1_A(10).
W_DATE1 = SY-DATUM.
W_DATE = SY-DATUM - 40.
CONCATENATE '''' W_DATE '''' INTO W_DATE_A.
CONCATENATE '''' W_DATE1 '''' INTO W_DATE1_A.
CONCATENATE 'ERDAT between'
W_DATE_A
'and'
W_DATE1_A
INTO W_OPTION_1 SEPARATED BY SPACE.
WRITE : / W_OPTION_1.Max
‎2009 Aug 11 7:20 PM
Hi,
Assign a text-element as apostrophe ( ' ) and then use it in the concatenate statement like
Data : w_date type sy-datum,
w_date1 type sy-datum,
W_OPTION_1(60) TYPE C.
w_date1 = sy-datum.
w_date = sy-datum - 40.
CONCATENATE 'ERDAT between' text-001 w_date text-001 'and' text-001 w_date1 text-001 INTO W_OPTION_1 SEPARATED BY SPACE.
write : / w_option_1.
Now you will get the desired output.
Regards,
Vik
‎2009 Aug 11 7:21 PM
Welcome to SCN.
Please read the rules of engagement and do not use expressions like ASAP. Everyone's problem is important.
Rob
‎2009 Aug 11 7:23 PM
‎2009 Aug 11 7:22 PM
Try this way
Please read the forum rules
Constants: c_quot(4) type c value ''''. " For value '
CONCATENATE 'ERDAT between' c_quot w_date c_quot 'and' c_quot w_date1 c_quot INTO W_OPTION_1 SEPARATED BY SPACE.
a®
‎2009 Aug 11 7:28 PM
Hi ..
CONCATENATE 'ERDAT between' c_quot w_date c_quot 'and' c_quot w_date1 c_quot INTO W_OPTION_1 SEPARATED BY SPACE.
this doesn't work as it returns
ERDAT between ' 20090702 ' and ' 20090811 '.
I dont want space between the quote and the date.
‎2009 Aug 11 7:29 PM
Hi
U can't do it by only one step, before cancateniting all in W_OPTION_1 u need to concatenate the dates in a distinctit step:
DATA : W_DATE TYPE SY-DATUM,
W_DATE1 TYPE SY-DATUM,
W_OPTION_1(60) TYPE C.
DATA: W_DATE_A(10),
W_DATE1_A(10).
W_DATE1 = SY-DATUM.
W_DATE = SY-DATUM - 40.
CONCATENATE '''' W_DATE '''' INTO W_DATE_A.
CONCATENATE '''' W_DATE1 '''' INTO W_DATE1_A.
CONCATENATE 'ERDAT between'
W_DATE_A
'and'
W_DATE1_A
INTO W_OPTION_1 SEPARATED BY SPACE.
WRITE : / W_OPTION_1.Max
‎2009 Aug 11 7:44 PM
‎2009 Aug 11 7:40 PM
Then
data : v_text1(15) type c, v_text2(15) type c.
Constants: c_quot(4) type c value ''''. " For value '
write : w_date to v_text1.
write : w_date1 to v_text2.
concatenate c_quot v_text1 c_quot to v_text1. condense v_text1 no-gaps.
concatenate c_quot v_text2 c_quot to v_text2. condense v_text2 no-gaps.
CONCATENATE 'ERDAT between' v_text1 'and' v_text2 INTO W_OPTION_1 SEPARATED BY SPACE.
a®
‎2009 Aug 11 7:46 PM
hi,
try this code.
Data : w_date type sy-datum,
w_date1 type sy-datum,
W_OPTION_1(60) TYPE C,
lv_str1(10) type c,
lv_str2(10) type c.
w_date1 = sy-datum.
w_date = sy-datum - 40.
concatenate '''' w_date'''' into lv_str1.
concatenate '''' w_date1 '''' into lv_str2.
CONCATENATE 'ERDAT between' lv_str1 'and' lv_str2 INTO W_OPTION_1 SEPARATED BY SPACE.
.
write : / w_option_1.