‎2014 Nov 26 10:27 AM
Hi Friends,
the following logic Aim is to compare po and item number,and if it get matched,then it will check the description,and the description without space will be getting deleted
i HAVE USED STRING LENGTH functioN.Can you pls tell the elow code will be work fine for my expected output.If not,please modify the code.
If description contain spaces means,it does not do any deletion operation.Say for po:102 it contain same values in 2 records,but description also contain spaces,so,it should not perform deletion.
DATA:ITAB_src TYPE TABLE OF /BIC/AIPUoitmc00.
DATA:WRKAREA_SRC TYPE /BIC/AIPUoitmc00.
COUNT=0
LOOP AT ITAB_SRC INTO WRKAREA_SRC
LOOP AT ITAB1_SRC INTO WRKAREA1_SRC WHERE EBELN=WRKAREA_src-EBELN AND EBELP=WRKAREA_src-EBELP.
count=count+1
IF COUNT > 1
I=STRLEN(WRKAREA_SRC-PROD_DESCR);
J=STRLEN(WRKARE_SRC-PROD_DESCR);
IF(I>J)
DELETE WRKAREA_SRC
ELSE
DELETE WRKAREA1_SRC;
IF(I==J)
CONTINUE.
ENDIF.
ENDIF
ELSE IF COUNT >1
CONTINE
END LOOP
END LOOP
| PO | ITEM | DESC | |
| 100 | 1 | WASHING MACHINE | |
| 100 | 1 | WASHINMACHINE | |
| 101 | 1 | FRIDGE | |
| 102 | 2 | AC | |
| 102 | 3 | VACCUM CLEANER | |
| 102 | 3 | VACCUM CLEANER | |
Expected output:
| PO | ITEM | DESC | |
| 100 | 1 | WASHING MACHINE | |
| 101 | 1 | FRIDGE | |
| 102 | 2 | AC | |
| 102 | 3 | VACCUM CLEANER | |
| 102 | 3 | VACCUM CLEANER | |
‎2014 Nov 26 11:32 AM
Hi.
Try this:
COUNT = 0.
LOOP AT ITAB_SRC INTO WRKAREA_SRC.
LOOP AT ITAB1_SRC INTO WRKAREA1_SRC WHERE EBELN = WRKAREA_src-EBELN AND EBELP = WRKAREA_src-EBELP.
count = count + 1.
IF COUNT GT 1.
FI = STRLEN( WRKAREA_SRC-PROD_DESCR ).
FJ = STRLEN( WRKAREA1_SRC-PROD_DESCR ).
IF FI LT FJ.
DELETE TABLE ITAB1_SRC FROM WRKAREA_SRC.
ELSEIF FI EQ FJ.
CONTINUE.
ELSE.
DELETE TABLE ITAB1_SRC FROM WRKAREA1_SRC.
ENDIF.
ELSEIF COUNT EQ 1.
CONTINUE.
ENDIF.
ENDLOOP.
ENDLOOP.
Hope to help.
Bye
‎2014 Nov 26 11:38 AM
Whether,the code is correct,it will suits my logic??
Pls tell,if my logic will work correct.
‎2014 Nov 26 11:50 AM
Your logic it's quite correct. You have to adapt to my changes if you want your output.
Your logic suppose to delete those words with no spaces.
But if you put for example a third value as
PO ITEM DESCR
100 1 WASH
This will be deleted cause it's supposed that your description can be different only for a space. If you have description that are different for others circumstances, you should analyze better your needs.
Hope to help
‎2014 Nov 26 11:55 AM
Hi,
only one good thing in my condition is,if same po and item number is present,then same descriptions will be present:) one is with space and other is without space.
So,i need to delete without space record.
if both descriptions also contains space,it should not perform deletion
‎2014 Nov 26 1:04 PM
Well so your logic is correct cause if you'll have a field with one or more space, will remain only one description with space, others will be deleted.
Hope to help.
Bye