08-10-2009 1:52 PM
Hi All
LOOP AT la.
LOOP AT itab.
IF la-begda0(6) = itab-month0(6).
if la-subty = 1000 or la-subty = 1001 or la-subty = 2000 or la-subty = 4000.
a1 = la-begda+6(2).
a2 = 'EL'.
PERFORM leaves USING a1 a2.
endif. endif.
endloop. endloop.
form leaves using
p_a1 like sy-datum
p_a2 type c .
DATA: a1 LIKE sy-datum, a2 TYPE c.
a1 = p_a1.
a2 = p_a2.
if a1+6(2) = '06'.
itab-a6 = a2.
MODIFY itab.
ENDIF.
endform
when the value of a1 pass to form p_a1 and i checked the value of a1 with single qoute or with out qoute . it doesn't come true.
assume that the value is 06.
regards
Ammad
08-10-2009 2:00 PM
Hi,
Try like this
DATA: a1 LIKE sy-datum, a2 TYPE c.
LOOP AT la.
LOOP AT itab.
IF la-begda+0(6) = itab-month+0(6).
if la-subty = 1000 or la-subty = 1001 or la-subty = 2000 or la-subty = 4000.
a1 = la-begda+6(2).
a2 = 'EL'.
PERFORM leaves USING a1 a2.
endif. endif.
endloop. endloop.
form leaves using a1 a2
DATA: p_a1 LIKE sy-datum, p_a2 TYPE c.
p_a1 = a1.
p_a2 = a2.
if p_a1+6(2) = '06'.
itab-a6 = p_a2.
MODIFY itab.
ENDIF.
endform
Regards,
Vik
08-10-2009 2:00 PM
Hi,
Try like this
DATA: a1 LIKE sy-datum, a2 TYPE c.
LOOP AT la.
LOOP AT itab.
IF la-begda+0(6) = itab-month+0(6).
if la-subty = 1000 or la-subty = 1001 or la-subty = 2000 or la-subty = 4000.
a1 = la-begda+6(2).
a2 = 'EL'.
PERFORM leaves USING a1 a2.
endif. endif.
endloop. endloop.
form leaves using a1 a2
DATA: p_a1 LIKE sy-datum, p_a2 TYPE c.
p_a1 = a1.
p_a2 = a2.
if p_a1+6(2) = '06'.
itab-a6 = p_a2.
MODIFY itab.
ENDIF.
endform
Regards,
Vik
08-10-2009 2:05 PM
p_a1 is of type sy-datum thats why .... change it to type c of 2 characters.
08-10-2009 2:08 PM
you are assigning
a1 = la-begda+6(2)
. That means that only two chars are being transferred to a1. Then you are comparing
if a1+6(2) = '06
searching the seven and eight position of a two position variable. Instead of doing that, compare
if a1 = '06'.
That shoud work.
08-10-2009 2:12 PM
Hi
The code will work only on the 6th of any month( YYYYMMDD )
Because a1 = la-begda+6(2). Will return the day in a1
So if its 6th it will work else the condition will fail.