Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3458

Re: Remove double date rows in assortment table

$
0
0

Hi Priyabrat.


1. First Fetch the Data from the Database using a Select Query


SELECT * from zassortment 

INTO           lt_zassortment

WHERE      location = s_loc

AND           product = s_prd

AND          startdatefrom  GE SY-DATUM

AND          startdateto      LE SY-DATUM.


2. Next Sort your internal Table


SORT IT_ASSORTMENT BY Location Product Storedatefrom  Storedateto.


3. Now Loop through your Internal Table ( You will need 2 work areas )


READ IT_ASSORTMENT INTO LS_PRIMARY INDEX 2.


LOOP AT IT_ASSORTMENT INTO LS_SECONDARY.

IF LS_SECONDARY-LOCATION EQ LS_PRIMARY-LOCATION

ANDLS_SECONDARY-PRODUCT EQ LS_PRIMARY-PRODUCT.

* - Same Location and Same Product So we need to delete the SECONDARY RECORD.

     DELETE TABLE IT_ASSORTMENT FROM LS_SECONDARY.

ELSE.

     MOVE LS_SECONDAY INTO LS_PRIMARY.

ENDLOOP.


------- ***----------


This is just another approach to try out -- you will need to write it properly to make it function.

Also this will only delete records from your  internal table not from the underlying database.

To delete you can delete that also using the proper statements.

 

-------------------

 

Hope this helps.

 

-------

Linkin Pereira



Viewing all articles
Browse latest Browse all 3458

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>