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: 

Modify key in Hashed table

tarangini_katta
Active Contributor
0 Kudos

Hi All,

I have hashehed internal table like this.

data : it_zawcumsetz like hashed table of zawcumsetz with unique key

KTONR_OPUS ZZ_AWC WAERS_OPUS.

I am geeting entries in table.

LOOP AT it_zawcumsetz into wa_zawcumsetz.

IF wa_zawcumsetz-zz_awc IS INITIAL.

wa_zawcumsetz-zz_awc = 'X'. "New value is * for

ENDIF.

MODIFY TABLE it_zawcumsetz FROM wa_zawcumsetz.

ENDLOOP.

i want to modify key value in loop.

Rather than append from wa to another internal table is not possiable.

Can anybody please tell me how to solve this pblm.

Thanks,

3 REPLIES 3

Former Member
0 Kudos

Hi Katta.

If you created a hashed table just to improve the MODIFY inside the loop, change your itab to a standard table and use field symbol:

DATA: it_zawcumsetz TYPE TABLE OF zawcumsetz.

FIELD-SYMBOLS: <fs_zawcumsetz> LIKE LINE OF it_zawcumsetz.

LOOP AT it_zawcumsetz ASSIGNING <fs_zawcumsetz>.
  IF <fs_zawcumsetz>-zz_awc IS INITIAL.
    <fs_zawcumsetz>-zz_awc = 'X'.
  ENDIF.
ENDLOOP.

If you can't change to a standard table, maybe you can duplicate the itab, just for the loop:

DATA: it_std TYPE TABLE OF zawcumsetz.

FIELD-SYMBOLS: <fs_std> LIKE LINE OF it_std.

it_std = it_zawcumsetz.

LOOP AT it_std ASSIGNING <fs_std>.
  IF <fs_std>-zz_awc IS INITIAL.
    <fs_std>-zz_awc = 'X'.
  ENDIF.
ENDLOOP.

it_zawcumsetz = it_std.
REFRESH it_std.

Regards

Darley

Former Member