Application Development 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: 

replace code value.

Former Member
0 Kudos

I have parameter "v_code" with single values.

and I have one internal table itab_data with

below records.

Code Bizcode GLcode date Amount.

200 001A 12345678 20050202 100

790 001A 12345678 20050202 200

200 001A 12345678 20050202 300

790 011A 12345678 20050203 300

200 011A 12345678 20050203 300

790 011A 12345678 20050203 300

if i set value 200 to parameter and exec,it should replace

all the records of code field within the internal table itab_Data itself.

200 001A 12345678 20050202 100

200 001A 12345678 20050202 200

200 001A 12345678 20050202 300

200 011A 12345678 20050203 300

200 011A 12345678 20050203 300

200 011A 12345678 20050203 300

my code wont work.? it hangs.why.

loop at itab_data.

if itab_data-bukrs <> v_code.

move v_code to itab_data-bukrs.

endif.

append itab_Data.

endloop.

ambichan.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Ambichan,

Try this one...

loop at itab_data.
  if itab_data-bukrs ne v_code.
    itab_data-bukrs = v_code.
    modify itab.  
  endif.
endloop.

Regards,

Anand Mandalika.

3 REPLIES 3

Former Member
0 Kudos

Hi,

Replace APPEND itab_data with MODIFY itab_data.

Regards

Message was edited by: Shehryar Khan

Former Member
0 Kudos

Hi Ambichan,

Try this one...

loop at itab_data.
  if itab_data-bukrs ne v_code.
    itab_data-bukrs = v_code.
    modify itab.  
  endif.
endloop.

Regards,

Anand Mandalika.

0 Kudos

Hi,

I think this is even better:

itab_data-bukrs = v_code.

        modify itab_data 
          from itab_data 
  transporting bukrs where ( bukrs ne v_bukrs ).

Regards,

Anand Mandalika.