‎2009 Oct 12 11:52 AM
Hi In code inspector i am getting messgae that before for all entries remove duplicate values.
How can I do the same for following code?
SELECT prctr FROM marc INTO TABLE gt_marc
FOR ALL ENTRIES IN gt_ekpo
WHERE werks EQ gt_ekpo-werks
AND matnr EQ gt_ekpo-matnr
AND prctr IN s_prctr.
SELECT pspnr FROM prps
INTO TABLE gt_prps
FOR ALL ENTRIES IN gt_ekpo
WHERE werks EQ gt_ekpo-werks
AND matnr EQ gt_ekpo-matnr
AND pspnr IN s_pspnr.
SELECT pstrm
eetrm
FROM prte INTO TABLE gt_prte
FOR ALL ENTRIES IN gt_prps
WHERE posnr EQ gt_prps-pspnr
AND pstrm IN s_pstrm
AND eetrm IN s_eetrm.
‎2009 Oct 12 11:56 AM
Hi oorvi,
Before using the table gt_ekpo, (For all entries in gt_ekpo), you can use the statement "DELETE ADJACENT DUPLICATES" on the table gt_ekpo, BY COMPARING the key fields. This will delete the duplicate entries of table gt_ekpo. This will improve the performance of the corresponding select statements.
Best Regards,
Ram.
‎2009 Oct 12 11:57 AM
Hi,
Try like this ,
sort gt_ekpo by matnr
delete adjacent duplicates from table gt_ekpo.
sort gt_prps by pspnr
delete adjacent duplicates from table gt_prps.
Now use for all entries
Regards,
Nagaraj
‎2009 Oct 12 12:00 PM
{
{color:blue}
hi friend
sort gt_ekpo by matnr werks ascending.
delete adjacent duplicates from gt_ekpo comparing matnr werks.
after that following ur code.
regards
surender
‎2009 Oct 12 12:09 PM
Before you use FOR ALL ENTRIES statement, you must two things.
<li>Check whether FOR ALL ENTRIES table has values or not . If you do not check, and it does not have values, it gives dump.
<li>Sort the internal tables before use
<li>You need to check Whether it has duplicate entries.
<li>Try the below way to use .
Thanks
Venkat.ODELETE ADJACENT DUPLICATES FROM gt_ekpo.
IF gt_ekpo[] IS NOT INITIAL.
SELECT prctr FROM marc INTO TABLE gt_marc
FOR ALL ENTRIES IN gt_ekpo
WHERE werks EQ gt_ekpo-werks
AND matnr EQ gt_ekpo-matnr
AND prctr IN s_prctr.
ENDIF.
DELETE ADJACENT DUPLICATES FROM gt_ekpo.
IF gt_ekpo[] IS NOT INITIAL.
SELECT pspnr FROM prps
INTO TABLE gt_prps
FOR ALL ENTRIES IN gt_ekpo
WHERE werks EQ gt_ekpo-werks
AND matnr EQ gt_ekpo-matnr
AND pspnr IN s_pspnr.
ENDIF.
IF gt_prps[] IS NOT INITIAL.
SELECT pstrm
eetrm
FROM prte INTO TABLE gt_prte
FOR ALL ENTRIES IN gt_prps
WHERE posnr EQ gt_prps-pspnr
AND pstrm IN s_pstrm
AND eetrm IN s_eetrm.
ENDIF.
‎2009 Oct 12 12:11 PM
Hi Friend ,
given below is the important point that we need to take care before using for all entries
1. Sort the table using the key field
SORT LT_BSIS BY BUKRS GJAHR BELNR. all are key field
2. delete the dublicate entries
DELETE ADJACENT DUPLICATES FROM LT_KUNNR COMPARING KUNNR. kunnr is the key field
3. Before using internal table with the table inwhich you have a data
check is initial or not
if initial that false
else true
IF NOT LT_BSIS IS INITIAL.
4. try to use all tha key field in for all entries if not using than pass all the key field is initial
C_AUGDT LIKE BSIS-AUGDT VALUE IS INITIAL,
pass in code
BSIS GE C_AUGDT
Thanks
Arun
‎2009 Oct 12 12:17 PM
Hi,
This is very simple before using any table as for all enteries,sort the same and use delete adjacenbt duplicate comparing the key fields.
eg:
sort gt_ekpo by werks matnr.
delete adjacent duplicate comparing werks.same for gt_prps as well.
This will definetly solve your problem.
Pooja