03-02-2015 10:46 AM
Dear Friends,
I have a download report if plant 1000 & 1001 has same material , Description ,
It has to download the 2nd plant moving average price, 1st plant line has to delete from the file.Pls help me out.
Plant | Material Number | Description | Moving average price |
1000 | 1105001 | RYO | 12 |
1001 | 1105001 | RYO | 4000 |
Kabil
03-02-2015 11:11 AM
Hi,
I guess your requirement like this.
Suppose in your internal table 3 plant is there.
1001,1002,1003 with same material.
You want last means 1003,then you can
SORT IT_TAB descending by plant.
read table index 1.
Will it works? Try it.
Thanks
Gourav
03-02-2015 11:25 AM
Hi Kabil,
Its very simple use below logic.
Sort internal table.
Read internal table with the material number and check the next line has same material number and if so delete current line .
Loop At Itab.
Read itab with index ( sy-tabix + 1 ).
Check if current material num = next material num
IF sucess.
Delete current line.
END if.
ENDLOOP
at the end you will have only the data you need . Please let me know if this is useful.
03-02-2015 12:24 PM
AS you suggested , similar, i have different scenario also
My concern is i want to check and compare the material in a different plant if available i want to remove particular plant.
Kabil
03-02-2015 12:47 PM
SORT itab BY material mov_avg_price DESCENDING.
DELETE ADJASCENT DUPLICATES FROM itab COMPARING material.
03-02-2015 12:51 PM
Hi Sharath,
If the same plant have same kind of materials as shown below, in that case also it will be deleted.
Plant | Material Number | Description | Moving average price |
1000 | 1105001 | RYO | 12 |
1000 | 1105001 | RYO | 4000 |
Regards
Rajkumar Narasimman
03-03-2015 8:30 AM
We all are getting confuse . Let me have a clear idea on your requirement .
Can you please tell me your clear requirement with example?
03-04-2015 4:46 AM
Hi Dnyaneshwar,
My scenario is 4 plants has same materiall
Need to compare if 2001 & 2134 material code is available
it has to read the 2134 plant code material only , need to remove 2001 plant line
like wise same to 4000 & 4071 compare most the case 4 plants have same material
\
Plant | Material | MAP |
2001 | 11050010410 | 200 |
2134 | 11050010410 | 300 |
4000 | 11050010410 | 400 |
4071 | 11050010410 | 500 |
03-04-2015 4:54 AM
SORT itab BY plant DESCENDING material.
LOOP AT itab INTO itab_line.
lv_sytabix = sy-tabix + 1.
READ TABLE itab INTO itab_line_tmp INDEX lv_sytabix.
IF sy-subrc = 0 AND
itab_line-material(1) = itab_line_tmp-material(1).
lv_sytabix = lv_sytabix - 1.
DELETE itab INDEX lv_sytabix.
ENDIF.
ENDLOOP.
03-02-2015 12:38 PM
Hi Kabil,
kabil G wrote:
Plant | Material Number | Description | Moving average price |
1000 | 1105001 | RYO | 12 |
1001 | 1105001 | RYO | 4000 |
Use deletion indicator concept, add additional field in the structure del_ind.
types: begin of ty_final.
plant type plant,
--
---
del_ind type i, "Delettion indicator field.
end of ty_final.
sort it_final by plant matnr.
loop at it_final assiging <fs_final>
"Get the index value
l_index = sy-tabix.
"Add index value for comparing next value
l_index = l_index + 1.
"Check internal table
read it_final into wa_final
from l_index
with key plant = <fs_final>-plant and matnr = <fs_final>-matnr.
if sy-subrc = 0.
"Set the Deletion indicator
<fs_final>-del_ind = 1.
endif.
endloop.
delete it_final where del_ind = 1.
Regards
Rajkumar Narasimman