Skip to Content
0
Former Member
Feb 01, 2007 at 10:28 AM

Please help in finding the error in this code

30 Views

Dear Friends,

I am trying to make the value of 'Shift' on the basis of BLDAT CPUDT & CPUTM of MKPF but I am doing something wrong. Kindly have a look at the following code, especially the IF..ELSEIF section and help me in finding the error.

Regards,

Alok.

SELECT MBLNR MJAHR BKTXT BUDAT BLDAT CPUDT CPUTM USNAM

INTO CORRESPONDING FIELDS OF TABLE I_MKPF1

FROM MKPF

WHERE

BUDAT EQ S_BUDAT AND

TCODE2 EQ 'MFBF'.

********************************************************ALOK 01.02.07

LOOP AT I_MKPF1.

I_MKPF-MBLNR = I_MKPF1-MBLNR.

I_MKPF-MJAHR = I_MKPF1-MJAHR.

I_MKPF-BKTXT = I_MKPF1-BKTXT.

I_MKPF-BUDAT = I_MKPF1-BUDAT.

I_MKPF-BLDAT = I_MKPF1-BLDAT.

I_MKPF-CPUDT = I_MKPF1-CPUDT.

I_MKPF-CPUTM = I_MKPF1-CPUTM.

I_MKPF-USNAM = I_MKPF1-USNAM.

IF ( ( I_MKPF1-CPUTM >= '090000' AND I_MKPF1-CPUTM < '160000' )

AND ( I_MKPF1-BLDAT = I_MKPF1-CPUDT ) ).

I_MKPF-SHIFT = 'A'.

ELSEIF ( ( I_MKPF1-CPUTM >= '090000' AND I_MKPF1-CPUTM <= '110000' )

AND ( I_MKPF1-BLDAT <> I_MKPF1-CPUDT ) ).

I_MKPF-SHIFT = 'C'.

ELSEIF ( ( I_MKPF1-CPUTM >= '160000' AND I_MKPF1-CPUTM < '000000' )

AND ( I_MKPF1-BLDAT = I_MKPF1-CPUDT ) ).

I_MKPF-SHIFT = 'B'.

ENDIF.

APPEND I_MKPF.

CLEAR I_MKPF.

ENDLOOP.