2007 Jul 23 8:17 AM
Hi all,
I have an internal table which contains PLANT,MATNR and some other fields.
Now I have to get the material description for the matnr.
And I need to place the description in the internal table based on matnr.
Can u please help me regarding this.
Vkr.
2007 Jul 23 8:22 AM
<b>select single maktx from makt into table itab_mat
where matnr = matnr(selection)
and spras = sy-langu. </b>
You can select any number of fields from MAKT table...
Regards,
Pavan.
2007 Jul 23 8:22 AM
<b>select single maktx from makt into table itab_mat
where matnr = matnr(selection)
and spras = sy-langu. </b>
You can select any number of fields from MAKT table...
Regards,
Pavan.
2007 Jul 23 8:27 AM
Hi friends i know the SELECT stmt...
what i need is how to map that discription to my internal table based on MATNR.
VKR.
2007 Jul 23 8:29 AM
2007 Jul 23 8:32 AM
Hi ARJUN,
in mY internal table matnr is repeated.
how to display the same discription multiple times.
VKR.
2007 Jul 23 8:35 AM
Hi VKR,
Even if matnr is repeated the code will work fine..
Arjun
2007 Jul 23 8:24 AM
HI,
TRY LIKE THIS,
select single maktx from makt into table itab_mat
where matnr = matnr(selection) and spras = sy-langu.
IF HELPFUL REWARD SOME POINTS.
WITH REGARDS,
SURESH. ALURI
2007 Jul 23 8:27 AM
Let itab1 be the table u have....it has fields matnr , plant and maktx (mat desc)
then do the follwing.
data : begin of itab2 occurs 0,
matnr type makt-matnr,
maktx type makt-maktx,
end of itab2 .
check not itab1 is initial.
select matnr maktx from makt into table itab2
for all entries in itab1
where matnr = itab1-matnr .
loop at itab1.
read table itab2 with key matnr = itab1-matnr.
if sy-subrc = 0.
itab1-maktx = itab2-maktx.
mOdify itab1.
endif.
endloop.
2007 Jul 23 8:27 AM
hi,
tables : makt , marc.
data : begin of itab_marc,
matnr like marc-matnr,
werks like marc-werks,
end of itab_marc.
data : begin of itab_makt,
matnr like makt-matnr,
maktx like makt-maktx,
end of itab_makt.
data : begin of itab_final,
matnr like marc-matnr,
werks like marc-werks,
maktx like makt-maktx,
end of itab_final.
selection-screen : begin of block blk1 with frame title text-001.
parameters : p_matnr like marc-matnr.
selection-screen : end of block blk1.
select matnr maktx from makt into corresponding fields of itab_final where matnr = p_matnr.
loop at iatb_final.
write 😕 maktx.
endloop.
Reward with points if helpful.
2007 Jul 23 8:29 AM
Hi,
Initially first fetch descp for matnr for all the entries in internal table.
IF ITAB1[] IS NOT INITIAL.
SELECT MAKTX FROM MAKT
INTO TABLE ITAB2
FOR ALL ENTRIES IN ITAB1
WHERE MATNR EQ ITAB1-MATNR.
ENDIF.
IF SY-SUBRC EQ 0.
LOOP AT ITAB1 INTO WORK AREA1.
READ TABLE ITAB2 INTO WORK AREA1 WITH KEY MATNR = WORKAREA2-MATNR.
IF SY-SUBRC EQ 0.
APPEND ITAB1.
ENDIF
ENDLOOP.
Thanks
Srinivas
2007 Jul 23 8:39 AM
loop at itab.
select maktx into itab-maktx from makt client specified
where mandt = sy-mandt
and matnr = itab-matnr.
modify itab transporting maktx.
clear itab.
endloop.
2007 Jul 23 8:43 AM
sorry a small correction:
sort itab by matnr.
loop at itab.
at new matnr.
select single maktx into itab-maktx from makt client specified
where mandt = sy-mandt
and matnr = itab-matnr.
modify itab transporting maktx where matnr = itab-matnr.
endat.
clear itab.
endloop.
if the above doesnt work tyr this...
loop at itab.
select single maktx into itab-maktx from makt client specified
where mandt = sy-mandt
and matnr = itab-matnr.
modify itab transporting maktx.
clear itab.
endloop.
2007 Jul 23 9:19 AM
2007 Jul 23 10:32 AM
try the second one....it will work.....if not plz wait ill come back shortly
2007 Jul 23 11:00 AM
hi vkr try this ....sorry for the inconvenience.
data:wk_maktx like makt-maktx.
sort itab by matnr ascending.
loop at itab.
at new matnr.
select single maktx into wk_maktx from makt
where matnr = itab-matnr.
endat.
itab-maktx = wk_maktx.
modify itab.
clear itab.
endloop.
2007 Jul 23 11:29 AM
Hi VKR,
Here is the simple way to meet your requirement.
TABLES MAKT.
LOOP AT ITAB.
SELECT SINGLE *
FROM MAKT
WHERE MATNR EQ ITAB-MATNR.
ITAB-DESCRIPTION = MAKT-MAKTX.
MODIFY ITAB.
ENDLOOP.
Hope this helps you.
Reegards,
Rama chary.Pammi
2007 Jul 23 11:38 AM
hi VKR
try this i have tried it will definitely work.....
tables : makt,marc.
types : begin of ty_marc,
matnr type matnr,
werks type werks_d,
end of ty_marc.
types : begin of ty_makt,
matnr type matnr,
maktx type maktx,
end of ty_makt.
types : begin of ty_final,
matnr type matnr,
werks type werks_d,
maktx type maktx,
end of ty_final.
types : tt_marc type standard table of ty_marc,
tt_makt type standard table of ty_makt,
tt_final type standard table of ty_final.
data : wa_marc type ty_marc,
wa_makt type ty_makt,
wa_final type ty_final.
data : itab_marc type tt_marc,
itab_makt type tt_makt,
itab_final type tt_final.
selection-screen : begin of block blk1 with frame title text-001.
parameters : p_matnr like mara-matnr oblogatory.
selection-screen : end of block blk1.
select matnr werks from marc into table itab_marc where matnr = p_matnr.
if not itab_marc initial.
select matnr matkx from makt into table itab_makt where matnr = p_matnr.
endif.
loop at itab_mara into wa_mara.
wa_final-matnr = wa_mara-matnr.
wa_final-werks = wa_mara-werks.
append wa_final to itab_final.
clear wa_final.
endloop.
loop at itab_final into wa_final.
read table itab_final from wa_final with key matnr = wa_final-matnr.
if sy-subrc = 0.
wa_final-maktx = wa_makt-maktx.
modify itab_final from wa_final transporting maktx.
endif.
endloop.
loop at itab_final into wa_final.
write : wa_final-maktx.
endloop.
REWARD IF USEFUL....