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

itab problem

Former Member
0 Likes
601

Hi experts,

I have created my itab like this..for ALV grid


data: begin of gt_stage occurs 0.  
        include structure zbitstge.
data: field_style type lvc_t_styl.
data: end of gt_stage.

data: ls_stylerow type lvc_s_styl,
      lt_styletab type lvc_t_styl.

iam trying to inserting the styles for fields to modify..


      loop at gt_stage.
        ls_stylerow-fieldname = 'KOSTL'.
        ls_stylerow-style = gv_grid->mc_style_enabled.
        append ls_stylerow to gt_stage-field_style.
        modify gt_stage.
      endloop. 

Iam able to inesrt few fields bofre KOSTL. But it comes to KOSTL iam getting following error.

"Error inserting into or changing a sorted table

You tried to insert or change a line at position 4 in the internal

table "\PROGRAM=ZBIPSTGE\DATA=GT_STAGE-FIELD_STYLE" (of the kind SORTED_TABLE).

This violated the sort sequence of the table, which was laid down when

the table was declared. "

What is the meaning of this error? Where iam doing wrong?

reward guraranteed

thanks

kaki

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
578

Hi,

Try this..

loop at gt_stage.

ls_stylerow-fieldname = 'KOSTL'.

ls_stylerow-style = gv_grid->mc_style_enabled.

<b> append ls_stylerow to lt_styletab.

gt_stage-field_style[] = lt_styletab[].</b>

modify gt_stage.

<b> refresh lt_styletab.</b>

endloop.

Thanks,

Naren

4 REPLIES 4
Read only

Former Member
0 Likes
578

Hi Kaki,

In the case of sorted tables, you have to maintain sort sequence. So you have to insert in the correct sort order. Otherwise try using 'insert' statement instead of append. That might work.

Regards,

Aravind

Read only

Former Member
0 Likes
579

Hi,

Try this..

loop at gt_stage.

ls_stylerow-fieldname = 'KOSTL'.

ls_stylerow-style = gv_grid->mc_style_enabled.

<b> append ls_stylerow to lt_styletab.

gt_stage-field_style[] = lt_styletab[].</b>

modify gt_stage.

<b> refresh lt_styletab.</b>

endloop.

Thanks,

Naren

Read only

Former Member
0 Likes
578

Hi,

If it is sorted table try this..

loop at gt_stage.

ls_stylerow-fieldname = 'KOSTL'.

ls_stylerow-style = gv_grid->mc_style_enabled.

<b>INSERT ls_stylerow INTO TABLE lt_styletab.</b>

<b>gt_stage-field_style[] = lt_styletab[].</b>

<b>modify gt_stage.

refresh lt_styletab.</b>

endloop.

Thanks,

Naren

Read only

0 Likes
578

Hi Arvind & Narendra,

I got it with insert statement...

Points alloted to both of u.

Thanks

kaki