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

Initializing Internal Table

Former Member
0 Likes
734

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
Read only

Former Member
0 Likes
676

you can use this to get the default value as _

CLEAR grid-D1  WItH '_'.

5 REPLIES 5
Read only

Former Member
0 Likes
676

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

Read only

Former Member
0 Likes
676

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.

Read only

Former Member
0 Likes
677

you can use this to get the default value as _

CLEAR grid-D1  WItH '_'.

Read only

Former Member
0 Likes
676

Hi ,

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

Regards

Arun

Read only

RaymondGiuseppi
Active Contributor
0 Likes
676

Try

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

Regards