‎2008 Dec 02 5:52 AM
Hi all,
tables mara.
types: begin of t_mara,
matnr type matnr,
mtart type mtart,
end of t_mara.
data: gt_mara type standard table of t_mara,
wa type t_mara.
select-options : smatnr for mara-matnr.
wa-matnr = smatnr.
wa-mtart = 'FERT'.
modify table gt_mara from wa.
wa-matnr = smatnr.
wa-mtart = 'HALB'.
modify table gt_mara from wa.
break-point.
write ' MAra details'.
this is piece of code for modifying is not working.
Will anybody let me know how to modify the data into gt_mara.
‎2008 Dec 02 5:53 AM
Hi,
Refer below code
LOOP AT it_crmm_territory INTO wa_crmm_territory.
l_index = sy-tabix.
CLEAR : wa_crmm_territory_v.
READ TABLE it_crmm_territory_v INTO wa_crmm_territory_v WITH KEY terr_guid = wa_crmm_territory-terr_guid.
IF sy-subrc EQ 0.
wa_crmm_territory-valid_from = wa_crmm_territory_v-valid_from.
wa_crmm_territory-valid_to = wa_crmm_territory_v-valid_to.
wa_crmm_territory-guid = wa_crmm_territory_v-guid.
ENDIF.
MODIFY it_crmm_territory FROM wa_crmm_territory INDEX l_index
TRANSPORTING guid valid_from valid_to.
CLEAR : wa_crmm_territory.
ENDLOOP.
Regards,
Prashant
‎2008 Dec 02 6:04 AM
hi,
use like this:
MODIFY gt_mara from wa TRANSPORTING matnr mtart.
‎2008 Dec 02 6:09 AM
hi,
wa-matnr = smatnr.
wa-mtart = 'FERT'.
modify table gt_mara from wa.
wa-matnr = smatnr.
wa-mtart = 'HALB'.
modify table gt_mara from wa.
for this code modify is correct
but make it sure that in mara table all u r primary keys are used.
check with matnr = smatnr is available or not or in that format it can be given.
here u r updating the internal table na it's better to use read statement and modify.
‎2008 Dec 02 6:14 AM
Hi,
MODIFY TABLE gt_mara FROM wa. This statement changes / modifies the content of the table gt_mara which matches the key values in wa. Here since the table does not have any values it is not putting any values into it.
Regards,
Vadi
‎2008 Dec 02 6:15 AM
Hi,
Looking at ur code, i got an impression that u r trying to modify single record twice,
like
wa-matnr = smatnr.
wa-mtart = 'FERT'.
modify table gt_mara from wa. // here mtart holds FERT for smatnr.
wa-matnr = smatnr.
wa-mtart = 'HALB'.
modify table gt_mara from wa.// here mtart holds HALB for smatnr.
May be i dont know u r passing different values for smatnr, but here i cant find any read or loop,
so i am wondering, if smatnr holds say 100 material for this record , u r updating with FERT then to the same record u r updating with HALB. otherwise, i think u might use append , may be i am wrong but its a suggestion..
in order to avoid that use read or loop...
and also use Transporting in Modify as other frnds told...
It should work.
Rgds.,
subash.
‎2008 Dec 02 6:17 AM
‎2008 Dec 02 6:24 AM
Hi all,
Still i am not able to modify it.
It could be more appreciable if you change the piece of code and send back.
tables mara.
types: begin of t_mara,
matnr type matnr,
mtart type mtart,
end of t_mara.
data: gt_mara type standard table of t_mara with key matnr,
wa type t_mara.
select-options : smatnr for mara-matnr.
wa-matnr = smatnr.
wa-mtart = 'FERT'.
modify gt_mara from wa index sy-tabix.
break-point.
write ' Mara details'.
‎2008 Dec 02 6:25 AM
Hi,
Do not use MODIFY.
Use APPEND statement.
append wa to gt_mara.
Cheers
‎2008 Dec 02 6:27 AM
hi,
smatnr is an select option, here u r assigning an internaltable to an field..
u do this way...
wa-matnr = smatnr-low .
wa-mtart = 'FERT'.
modify table gt_mara from wa.
wa-matnr = smatnr-high.
wa-mtart = 'FERT'.
modify table gt_mara from wa.
it should definitely work.
Rgds.,
subash
‎2008 Dec 02 6:28 AM
hi varisetty,
use modify satetment like this..
DATA: v_idx TYPE sy-tabix. "Index variable
v_idx = sy-tabix.
MODIFY gt_mara INDEX v_idx FROM wa
TRANSPORTING matnr
mtart.
it will definitely solve your problem..
Regards,
Nikita Jain
‎2008 Dec 02 6:42 AM
Hi,
check out this example and see.
tables mara.
types: begin of t_mara,
matnr type matnr,
mtart type mtart,
end of t_mara.
data: gt_mara type standard table of t_mara,
wa type t_mara.
select-options : smatnr for mara-matnr.
wa-matnr = smatnr-low.
wa-mtart = 'FERT'.
if gt_mara is initial.
append wa to gt_mara.
else.
modify table gt_mara from wa.
endif.
wa-matnr = smatnr-high.
wa-mtart = 'HALB'.
modify gt_mara from wa TRANSPORTING matnr mtart
where matnr eq smatnr-low.
break-point.
write ' MAra details'.
Rgds.,
subash
‎2009 Dec 14 12:54 PM
‎2009 Dec 14 12:57 PM
After more than a year? And hope this is the final thanks for today.