Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

modify statement

Former Member
0 Likes
1,250

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.

13 REPLIES 13
Read only

former_member386202
Active Contributor
0 Likes
1,214

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

Read only

Former Member
0 Likes
1,214

hi,

use like this:

MODIFY gt_mara from wa TRANSPORTING matnr mtart.

Read only

mahaboob_pathan
Contributor
0 Likes
1,214

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.

Read only

i048168
Product and Topic Expert
Product and Topic Expert
0 Likes
1,214

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

Read only

Former Member
0 Likes
1,214

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.

Read only

Former Member
0 Likes
1,214

MODIFY gt_mara from wa INDEX sy-tabix.

Read only

0 Likes
1,214

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'.

Read only

Former Member
0 Likes
1,214

Hi,

Do not use MODIFY.

Use APPEND statement.


append wa to gt_mara.

Cheers

Read only

Former Member
0 Likes
1,214

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

Read only

Former Member
0 Likes
1,214

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

Read only

Former Member
0 Likes
1,214

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

Read only

Former Member
0 Likes
1,214

thanks

Read only

0 Likes
1,214

After more than a year? And hope this is the final thanks for today.