07-17-2008 9:29 AM
Hi Experts,
check the following code and help me to fetch the record with the particular date.
As u see in my code i have used ATNEW endat statement ,its difficult for me to fetch the dates within this atnew statement.
how to fetch the date inside this atnew loop.
SELECT SINGLE * FROM cdhdr WHERE objectclas = 'KRED'
AND objectid = w_lfa1-lifnr
AND udate IN c_date.
IF sy-subrc EQ 0.
SELECT * FROM cdpos INTO TABLE w_cdpos
WHERE objectclas = 'KRED'
AND objectid = w_lfa1-lifnr
AND tabname = 'LFBK'
AND chngind EQ 'I' .
IF sy-dbcnt GT 1 .
SORT w_cdpos BY changenr ASCENDING .
CLEAR w_result .
w_result-lifnr = w_lfa1-lifnr .
w_result-fname = 'BANK' .
w_result-ddtext = text-001 .
LOOP AT w_cdpos.
ws_cdpos = w_cdpos .
AT NEW changenr .
IF w_result-value_old IS INITIAL .
w_result-value_old = ws_cdpos-tabkey+13(57) .
ELSE .
w_result-value_new = ws_cdpos-tabkey+13(57) .
ENDIF .
ENDAT .
AT END OF changenr .
IF w_result-value_old IS NOT INITIAL
AND w_result-value_new IS NOT INITIAL .
selecting CDHDR with the key only to find the udate
SELECT SINGLE * FROM cdhdr WHERE objectclas = 'KRED'
AND objectid = w_lfa1-lifnr
AND changenr = ws_cdpos-changenr
AND udate IN c_date.
w_result-udate = cdhdr-udate .
APPEND w_result .
w_result-value_old = w_result-value_new .
CLEAR w_result-value_new .
ENDIF .
ENDAT .
ENDLOOP.
ENDIF .
ENDIF.
07-17-2008 10:44 AM
Hi,
Since you are copying the workarea content to another as below
ws_cdpos = w_cdpos ,
Use WS_CDPOS contents to check with in the AT NEW statement.
Rgds,
Hema
07-17-2008 10:44 AM
Hi,
Since you are copying the workarea content to another as below
ws_cdpos = w_cdpos ,
Use WS_CDPOS contents to check with in the AT NEW statement.
Rgds,
Hema
07-17-2008 10:55 AM
hi,
use like this....
delcrae another workarea ws_cdpos1 same as ws_cdpos.
LOOP AT w_cdpos.
ws_cdpos1 = w_cdpos .
AT NEW changenr .
IF w_result-value_old IS INITIAL .
w_result-value_old = ws_cdpos1-tabkey+13(57) .
ELSE .
w_result-value_new = ws_cdpos1-tabkey+13(57) .
ENDIF .
ENDAT .
this will solve your problem....
07-17-2008 10:58 AM