Skip to Content
0
Former Member
Mar 19, 2008 at 11:35 AM

Fetch records from internal table

44 Views

HI

I HAVE ONE INTERNAL TABLE ITAB_ERR. THIS HAS RECORDS AND I AM FETCHING DATA FROM ISEG AS WELL.

WHAT I WANT IS I NEED TO FETCH THE RECORDS FROM

ITAB_ERR WHOSE RECORDS DO NOT MATCH WITH ISEG TABLE RECORDS.

I HAVE WRITTEN FOLLOWING CODE BUT IT DOES NOT FETCH THE RECORDS FROM ITAB_ERR THAT DOES NOT MATCH WITH ISEG RECORDS i.e. ITAB_ERR HAS SOME RECORDS WHICH ARE NOT THERE IN ISEG AND I NEED TO FETCH THOSE RECORDS FROM ITAB_ERR.

PLEASE LOOK AT MY CODE AND CORRECT OR SUGGEST CORRECTIONS.

ITAB_ERR[] = ITAB_UPD[]. (ITAB_ERR HAS RECORDS)

SELECT *

FROM ISEG INTO CORRESPONDING FIELDS OF TABLE WA_ITAB_ISEG

where werks eq zptf_phyinv_hed-zwerks and zldat eq itab-zldat and budat eq itab-zbldat.

  • WA_ITAB_ISEG HAS RECORDS.

clear sy-subrc.

sort itab_err by zmatnr1.

LOOP AT WA_ITAB_ISEG.

loop at itab_err INTO ITAB_DEL

where ZWERKS <> WA_ITAB_ISEG-WERKS

and ZLDAT <> WA_ITAB_ISEG-ZLDAT

and ZBLDAT <> WA_ITAB_ISEG-BUDAT

and ZMATNR1 <> WA_ITAB_ISEG-MATNR

and ZCHARG1 <> WA_ITAB_ISEG-CHARG

and ZLGORT <> WA_ITAB_ISEG-LGORT.

IF SY-subrc = 0.

move-corresponding ITAB_err to itab_del2.

append itab_del2.

CLEAR SY-SUBRC.

ENDIF.

ENDLOOP.

ENDLOOP.

THANX

ROCKY

Edited by: Alvaro Tejada Galindo on Mar 19, 2008 7:04 PM