Skip to Content
0
Dec 18, 2013 at 06:04 PM

Urgent solution needed...

30 Views

Hi ABAP Gurus,

I have a requirement in APO to build a Z report to delete the duplicate profile .The standard transaction exists for the same is : /SAPAPO/MSDP_FCST2

Deletion duplicate profile assignment, I need to delete the duplicate records, based in following order :

1. If there are one or many rows other than Manual Assignment and Interactive Planning values in Job/Transaction Field, for a particular LocNo._ProductNo. combination, it should be deleted first.

2. Still if there are one or many rows of Manual Assignment and Interactive Planning values in Job/Transaction Field for a particular LocNo._ProductNo. combination, rows having Manual Assignment value should be deleted.

3. And if still there are one or many values of Interactive Planning values in Job/Transaction Field for a particular LocNo._ProductNo. combination, latest row based on created date should be kept and all old rows should be deleted.

**********************************************************************************************************************************************************************************

IF lt_selid[] IS NOT INITIAL.

SELECT

pareaid

selid

seltext

jobnr

cdat

ctime

autor

FROM /sapapo/dp_fcst2

INTO TABLE lt_dp_fcst2

FOR ALL ENTRIES IN lt_selid

WHERE selid = lt_selid-selid.

ENDIF.

ENDIF.

ENDFORM.

*&---------------------------------------------------------------------*

*& Form DELETE_DATA

*&---------------------------------------------------------------------*

FORM delete_data .

DATA lv_count1 TYPE i.

IF lt_dp_fcst2 IS NOT INITIAL.

LOOP AT lt_dp_fcst2 INTO ls_dp_fcst2.

*****************************************************

Sample code needed after this to proceed

******************************************************