cancel
Showing results for 
Search instead for 
Did you mean: 

Delete Data Package records by comparing with internal table

Former Member
0 Kudos

Hi Guys,

I am loading data from an ODS to Cube.

I am trying to read the Data Package in start routine and compare the records with an internal table.

I want to delete the records in the data package when the Order field in data package matches with Order in internal table and the field type is EXT. if it is INT it should load that record into Cube with a prod num which is pulled from mapping table

When I load just the records where the Orders are of field type EXT it is working. Those records are excluded during laod into Cube.

But when I am loading whole data at once they are also loading into cube which I dont want.

Looks like the DELETE DATA_PACKAGE command is being executed only once.

can somebody please help me with this code?

READ TABLE itab_prod WITH KEY

order = DATA_PACKAGE-/BIC/ZORDER

sys = 'CLT80'.

IF SY-SUBRC = 0.

IF itab_prod-ftype = 'EXT'.

DELETE DATA_PACKAGE.

MODIFY DATA_PACKAGE.

ELSE.

IF itab_prod-ftype = 'INT'.

SELECT SINGLE prd_no INTO prodnum

FROM ZPRODUCT

WHERE S_PL = prod.

IF SY-SUBRC = 0.

DATA_PACKAGE-/BIC/ZPRODNO = prodnum.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

Modify DATA_PACKAGE.

ENDLOOP.

If the Order in the Data Package exits in Mapping and table and the field type of that Order in mapping table is EXT that record should be excluded.

Thanks in advance.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks.

Former Member
0 Kudos

DATA: wa_area like line of data_package.

DATA: v_index1 type sy-tabix.

LOOP AT DATA_PACKAGE into wa_area.

v_index1 = sy-tabix.

READ TABLE itab_prod WITH KEY

order = wa_area-/BIC/ZORDER

sys = 'CLT80'.

IF SY-SUBRC = 0.

IF itab_prod-ftype = 'EXT'.

clear wa_area.

ELSE IF itab_prod-ftype = 'INT'.

SELECT SINGLE prd_no INTO prodnum

FROM ZPRODUCT

WHERE S_PL = prod.

IF SY-SUBRC = 0.

wa_area-/BIC/ZPRODNO = prodnum.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

Modify DATA_PACKAGE from wa_area index v_index1.

ENDLOOP.

Former Member
0 Kudos

Hi Raj,

I tried your code. It gives error saying that Field DATA_PACKAGE is unknown. its pointing to the DATA definitions where wa_area is defined. Is there anything i am missing.

Thanks for your reply.