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

Sorted table dump in ALV lineformat

pedrocavaco
Participant
0 Likes
2,818

Hi,

Recently I noticed a "strange" dump during some developments.

Here is the detail:


***CODE***

<The code>



lv_day = 1.

WHILE lv_day < lv_datum+6(2).

SHIFT lv_day LEFT DELETING LEADING '0'.

CONCATENATE 'DAY' lv_day INTO lv_fname.

ls_lineformat-fieldname = lv_fname.
ls_lineformat-style = cl_gui_alv_grid=>mc_style_disabled.
APPEND ls_lineformat TO lsx_output-lineformat.
MODIFY gtx_output FROM lsx_output TRANSPORTING lineformat.

lv_day
= lv_day + 1.

ENDWHILE
.

***DECLARATIONS***

<Just to some context>

ls_lineformat TYPE lvc_s_styl,


lv_fname TYPE lvc_fname,

lv_day TYPE numc2,


lsx_output LIKE LINE OF gtx_output,


gtx_output TYPE STANDARD TABLE OF ty_lpca_mdpd,

TYPES:BEGIN OF ty_lpca_mdpd.
INCLUDE TYPE ty_t_lpca_mdpd.
TYPES: cellcolor      TYPE lvc_t_scol,
lineformat    
TYPE lvc_t_styl,
linecolor
(4)   TYPE c,
edit TYPE c.
TYPES: END OF ty_lpca_mdpd
.

***DUMP***

<The problem>


So far what I noticed was that as long as the creation of DAY1; DAY2; DAY3; ... DAY9; DAY10 stays without a 0 prefix on the number, we get the dump, otherwise if we comment the SHIFT lv_day LEFT DELETING LEADING '0'. and by doing that we get something like DAY01; DAY02; DAY03 ...  DAY09; DAY10 we don't get the dump.

It's strange to me the management which leads the dump, it's supposed?

Thank you for some kind of enlightenment.

Hi,

Recently I noticed a "strange" dump during some developments.

Here is the detail:


***CODE***

<The code>



lv_day = 1.

WHILE lv_day < lv_datum+6(2).

SHIFT lv_day LEFT DELETING LEADING '0'.

CONCATENATE 'DAY' lv_day INTO lv_fname.

ls_lineformat-fieldname = lv_fname.
ls_lineformat-style = cl_gui_alv_grid=>mc_style_disabled.
APPEND ls_lineformat TO lsx_output-lineformat.
MODIFY gtx_output FROM lsx_output TRANSPORTING lineformat.

lv_day
= lv_day + 1.

ENDWHILE
.

***DECLARATIONS***

<Just to some context>

ls_lineformat TYPE lvc_s_styl,


lv_fname TYPE lvc_fname,

lv_day TYPE numc2,


lsx_output LIKE LINE OF gtx_output,


gtx_output TYPE STANDARD TABLE OF ty_lpca_mdpd,

TYPES:BEGIN OF ty_lpca_mdpd.
INCLUDE TYPE ty_t_lpca_mdpd.
TYPES: cellcolor      TYPE lvc_t_scol,
lineformat    
TYPE lvc_t_styl,
linecolor
(4)   TYPE c,
edit TYPE c.
TYPES: END OF ty_lpca_mdpd
.

***DUMP***

<The problem>


So far what I noticed was that as long as the creation of DAY1; DAY2; DAY3; ... DAY9; DAY10 stays without a 0 prefix on the number, we get the dump, otherwise if we comment the SHIFT lv_day LEFT DELETING LEADING '0'. and by doing that we get something like DAY01; DAY02; DAY03 ...  DAY09; DAY10 we don't get the dump.

It's strange to me the management which leads the dump, it's supposed?

Thank you for some kind of enlightenment.

4 REPLIES 4
Read only

roberto_vacca2
Active Contributor
0 Likes
2,370

Hi..

Hands up! It's an illegal statement Well I suppose that if your key is a char key, you have to use 01,02,03 because sort makes a lexicographical order and you need 0 or you'll have something like

1, 10, 11, 12,13,...19, 2, 21...etc...

Hope to help.

Read only

Former Member
2,370

The reason it is giving dump is that append always try to insert the record at the end and it is viaolating you sort order for sorted table lsx_output-lineformat.

Use INSERT ls_lineformat INTO TABLE lsx_output-lineformat.


R

Read only

0 Likes
2,370

Rudra has right.

lvc_t_styl is sorted table. Append-statement is invalid for sorted tables. Use insert-statement instead.

Read only

pedrocavaco
Participant
0 Likes
2,370

Thank you all for your responses, worked like a charm.