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: 

Initializing Internal Table

Former Member
0 Kudos

I've been using an internal table as follows,

DATA: BEGIN OF grid OCCURS 0,

D1 VALUE '_', " the value stored is an underscore

D2 VALUE '_',

END OF grid.

In the program, the values of D1 and D2 will change. Depending on some condition, I want to reset the values of D1 and D2 to initial values (i.e. Underscore). CLEAR statement initializes the values to ' ' (space). Kindly guide me with the same.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

you can use this to get the default value as _

CLEAR grid-D1  WItH '_'.

5 REPLIES 5

Former Member
0 Kudos

Hi,

the problem will not get solved using Clear or REFRESH statement as both will set the values to blank.

In ur case u hv to manually set the values as '_'.

e.g.

loop at grid.

grid-D1 = '_'.

grid-D2 = '_'.

Modify grid index sy-tabix.

endloop.

Regards,

Himanshu

Former Member
0 Kudos

hi,


data: wa_grid like line of it_grid.

wa_grid-d1 = '_'.
wa_grid-d2 = '_'.

instead of using clear statement.. clear it_grid.

  move wa_grid to it_grid.

Regarsd

sailaja.

Former Member
0 Kudos

you can use this to get the default value as _

CLEAR grid-D1  WItH '_'.

Former Member
0 Kudos

Hi ,

You can use the modify command with the addition TRANSPORTING to acheive this,

Regards

Arun

raymond_giuseppi
Active Contributor
0 Kudos

Try

  LOOP AT grid.
    CLEAR grid-d1  WITH '_'.
    CLEAR grid-d2  WITH '_'.
    MODIFY grid TRANSPORTING d1 d2.
  ENDLOOP.

Regards