Skip to Content
0
Former Member
Jan 28, 2009 at 10:16 AM

retirval problem for the old-new values from cdhdr,cdpos

119 Views

hi all.

i want to get the old and new values from cdhdr and cdpos table but not getting the output as the if condition of read statement" if i_cdhdr-objectid = itemp-kunnr." is not getting executed.what could be the mistake and how can i resolve.plz suggest

loop at it_knb1.

itemp-kunnr = it_knb1-kunnr.

itemp-kunnr1 = it_knb1-kunnr.

append itemp.

endloop.

if not itemp[] is initial.

select * from cdhdr

into table i_cdhdr

for all entries in itemp

where OBJECTCLAS = 'DEBI'

and OBJECTID = itemp-kunnr

and tcode = 'VD02'.

select * from cdhdr

appending table i_cdhdr

for all entries in itemp

where OBJECTCLAS = 'DEBI'

and OBJECTID = itemp-kunnr

and tcode = 'XD02'.

endif.

if not i_cdhdr[] is initial.

select * from cdpos into table i_cdpos

for all entries in i_cdhdr

where OBJECTCLAS = i_cdhdr-OBJECTCLAS

and OBJECTID = i_cdhdr-OBJECTID

and TABNAME = 'KNVV'

and ( FNAME = 'ZTERM' ).

endif.

loop at it_knb1 where kunnr = it_kna1-kunnr.

read table itemp with key kunnr1 = it_knb1-kunnr.

if sy-subrc = 0.

loop at i_cdhdr.

if i_cdhdr-objectid = itemp-kunnr.

it_final-username = i_cdhdr-username.

clear i_cdpos.

read table i_cdpos with key OBJECTCLAS = i_cdhdr-OBJECTCLAS

OBJECTID = i_cdhdr-OBJECTID

FNAME = 'ZTERM'.

if sy-subrc = 0.

it_final-zterm_old = i_cdpos-value_old.

it_final-zterm_new = i_cdpos-value_new.

endif.

endif.

endloop.

endif.

endloop.