‎2008 Jan 22 5:30 PM
hi all,
i have a itab in whch data is like this
matnr werks mfgnr
40 21 10
40 22 10
40 23 10
40 24 12
40 25 13
40 26 15
50 21 18
50 22 18
50 23 18
50 24 18
50 25 18
50 26 18
50 27 18
but in output i want to print only those mat where the mfgnr is not the same across all plants.that is output should be like this
matnr werks mfgnr
40 21 10
40 22 10
40 23 10
40 24 12
40 25 13
40 26 15.
output should not print any value of mat 50 as it is having same mfgnr for all palnts
mat 40 and 50 are entered in selection screen.
can anybody help.
<REMOVED BY MODERATOR>
thanks
sarabjit
Edited by: Alvaro Tejada Galindo on Jan 22, 2008 12:34 PM
‎2008 Jan 22 8:25 PM
table two variable for matnr and mfgnr
code:
data: v_matnr like makt-matnr,
v_mfgnr like makt-mfgnr.
data: lin1 like i, lin2 like i.
sort itab by matnr mfgnr.
read table itab index 1.
v_matnr = itab-matnr.
v_mfgnr = itab-mfgnr.
loop at itab.
at new matnr
lin1 = sy-tabix.
endat.
at end matnr.
lin2 = sy-tabix.
endat.
if v_matnr <> matnr or v_mfgnr <> mfgnr
//read data from table itab line lin1 to lin2.
endif.
endloop.
Logic should be like this. add more statement to run it.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Jan 22, 2008 4:17 PM
‎2008 Jan 22 5:39 PM
Hi
SORT ITAB BY MATNR WERKS MFGNR.
LOOP AT ITAB.
AT NEW MATNR.
FL_PRINT = SPACE.
FL_CHECK = 'X'.
ENDAT.
IF FL_CHECK = 'X'.
LOOP AT ITAB TRANSPORTING NO FIELDS
WHERE MATNR = ITAB-MATNR
AND WERKS <> ITAB-WERKS
AND MFGNR <> ITAB-MFGNR.
EXIT.
ENDLOOP.
IF SY-SUBRC = 0.
FL_PRINT = 'X'.
ENDIF.
CLEAR FL_CHECK.
ENDIF.
CHECK FL_PRINT = 'X'.
WRITE: ITAB-MATNR, ITAB-WERKS, ITAB-MFGNR.
ENDLOOP.Max
Edited by: max bianchi on Jan 22, 2008 6:42 PM
‎2008 Jan 22 6:11 PM
can u plz explain what is fl_print and fl_check in the code
thanks for reply. i m working on code suggested by you
thanks
ur suggested code is printing all the value of mat 40 and 5 but in my case i only reqiured to print the for mat 40 as it is having different values of mfgnr not mat 50 itis having same value of mfgnr all the way
any other suggestions plz
thanks
Edited by: sarabjit kaur on Jan 22, 2008 12:43 PM
‎2008 Jan 22 8:06 PM
FL_PRINT = SPACE.
FL_CHECK = 'X'.
fl_print and fl_check are simply local variables which used by check the condition where new matnr is fired by at new matnr commond.
‎2008 Jan 22 8:25 PM
table two variable for matnr and mfgnr
code:
data: v_matnr like makt-matnr,
v_mfgnr like makt-mfgnr.
data: lin1 like i, lin2 like i.
sort itab by matnr mfgnr.
read table itab index 1.
v_matnr = itab-matnr.
v_mfgnr = itab-mfgnr.
loop at itab.
at new matnr
lin1 = sy-tabix.
endat.
at end matnr.
lin2 = sy-tabix.
endat.
if v_matnr <> matnr or v_mfgnr <> mfgnr
//read data from table itab line lin1 to lin2.
endif.
endloop.
Logic should be like this. add more statement to run it.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Jan 22, 2008 4:17 PM