‎2008 Feb 04 10:25 AM
Hi Experts,
How will the following code work....
lv_date = ls_billing-bill_date.
CONDENSE lv_date.
lv_bill_date = lv_date(8).
lv_billplan_date = lv_bill_date.
lv_billplan_date+6(2) = '01'.
lv_billfrom_date = lv_billplan_date.
Please explain me with an example.
Regards,
Sangeeta.
‎2008 Feb 04 11:25 AM
hi sangeeta,
suppose lv_billplan_date = 20080128 28th january in yyyymmdd format..
now lv_billplan_date+6(2) will travle 6 places in lv_billplan_date
and reach to '1' after this it has 2 more places to traverse that is '28' DAY, so the code is hardcoding and changing it forcibly to '01' ..
so the output will be 20080101 [date is changed to 1st january]
hope it helps
Reward points if useful
Rohan Malik
‎2008 Feb 04 11:18 AM
Hi,
if the date is
20080204
then it will return
yyyymmdd
20080201
it is hardcoding the day of the month as 01
the last two characteres are replaced with 01
regards,
Venkatesh
‎2008 Feb 04 11:24 AM
Hi,
take for example:
lv_date = ' 2007010'.
condense will remove the gaps
and lv_date = '2007010'.
lv_bill_date = 2007010
lv_billplan_date = lv_bill_date = 2007010
lv_billplan_date+6(2) = 01
lv_billfrom_date = lv_billplan_date = 20070101.
if u chk out this code in debug mode evrthing will be clear..
reward appropriate points.
regards,
Mansi
‎2008 Feb 04 11:25 AM
hi sangeeta,
suppose lv_billplan_date = 20080128 28th january in yyyymmdd format..
now lv_billplan_date+6(2) will travle 6 places in lv_billplan_date
and reach to '1' after this it has 2 more places to traverse that is '28' DAY, so the code is hardcoding and changing it forcibly to '01' ..
so the output will be 20080101 [date is changed to 1st january]
hope it helps
Reward points if useful
Rohan Malik
‎2008 Feb 04 11:32 AM
lv_date = ls_billing-bill_date. "for example internal table field has value ' 20080204'
"with some leading spaces or trailing spaces
CONDENSE lv_date. "here date value will condense i.e. removes
"any leading or trailing spaces.
lv_bill_date = lv_date(8). "assigning date value i.e. 20080204 to lv_bill_date
lv_billplan_date = lv_bill_date. "assigning lv_bill_date to lv_billplan_date
lv_billplan_date+6(2) = '01'. "changing date as staring date of
"month i.e. 20080204 to 20080201
lv_billfrom_date = lv_billplan_date. "assigning lv_billplan_date to lv_billfrom_date
‎2008 Feb 04 11:34 AM
for exp Is_billing-bill_date = '20080402'
1. now lv_date will be '20080402'
2.
3.lv_bill_date is eight characters of lv_date ie '20080402'.
4. lv_billplan_date is 20080402
5.lv_billplan_date+6(2) is 02 that is replace by 01.
6. lv_billfrom_date is 200080401.
so the date field is changed 02 to 01.
Thnks
Regards
Narsim