2012 Jul 12 11:26 AM
Dear All ,
I am working on an editable alv report . The requirement is to make a particular rows only editable based on a condition . I have seen the report BCALV_EDIT_02 and was able to understant that . In this report There is a code
LOOP AT gt_outtab.a
l_index = sy-tabix.
refresh lt_celltab.
if gt_outtab-seatsmax ge 300.
perform fill_celltab using 'RW'
changing lt_celltab.
else.
perform fill_celltab using 'RO'
changing lt_celltab.
endif.
*§2c.Copy your celltab to the celltab of the current row of gt_outtab.
INSERT LINES OF lt_celltab INTO TABLE gt_outtab-celltab.
MODIFY gt_outtab INDEX l_index.
ENDLOOP.
In the second loop pass the internal table gt_outtab-celltab gets refreshed , i.e the internal table has no record in it .
However In My Report I am getting a runtime error
You tried to insert an entry into table
"\PROGRAM=YSUV_ZSCH_ATT03\DATA=IT_ZSCH_ATT-FIELD_STYLE". However, updating
the unique table key "PRIMARY_KEY" resulted in a duplicate entry. The key
concerned may be either the primary key or a secondary key.
The key components of the duplicate entry have the values "{WERKS}"
could any one help me with that .
My Code is :
LOOP AT it_zsch_att INTO wa_zsch_att .
** FREE it_zsch_att-field_style.
l_index = sy-tabix .
REFRESH lt_field_style .
IF wa_zsch_att-lt_metric = '1.00' .
PERFORM fill_field_style USING 'RW'
CHANGING lt_field_style .
ELSE.
PERFORM fill_field_style USING 'RO'
CHANGING lt_field_style .
ENDIF .
INSERT LINES OF lt_field_style INTO TABLE it_zsch_att-field_style.
MODIFY it_zsch_att INDEX l_index.
** FREE it_zsch_att-field_style.
** CALL METHOD grid1->refresh_table_display .
ENDLOOP.
Thanks In advance .
Suvana Smith
Dear All ,
I am working on an editable alv report . The requirement is to make a particular rows only editable based on a condition . I have seen the report BCALV_EDIT_02 and was able to understant that . In this report There is a code
LOOP AT gt_outtab.a
l_index = sy-tabix.
refresh lt_celltab.
if gt_outtab-seatsmax ge 300.
perform fill_celltab using 'RW'
changing lt_celltab.
else.
perform fill_celltab using 'RO'
changing lt_celltab.
endif.
*§2c.Copy your celltab to the celltab of the current row of gt_outtab.
INSERT LINES OF lt_celltab INTO TABLE gt_outtab-celltab.
MODIFY gt_outtab INDEX l_index.
ENDLOOP.
In the second loop pass the internal table gt_outtab-celltab gets refreshed , i.e the internal table has no record in it .
However In My Report I am getting a runtime error
You tried to insert an entry into table
"\PROGRAM=YSUV_ZSCH_ATT03\DATA=IT_ZSCH_ATT-FIELD_STYLE". However, updating
the unique table key "PRIMARY_KEY" resulted in a duplicate entry. The key
concerned may be either the primary key or a secondary key.
The key components of the duplicate entry have the values "{WERKS}"
could any one help me with that .
My Code is :
LOOP AT it_zsch_att INTO wa_zsch_att .
** FREE it_zsch_att-field_style.
l_index = sy-tabix .
REFRESH lt_field_style .
IF wa_zsch_att-lt_metric = '1.00' .
PERFORM fill_field_style USING 'RW'
CHANGING lt_field_style .
ELSE.
PERFORM fill_field_style USING 'RO'
CHANGING lt_field_style .
ENDIF .
INSERT LINES OF lt_field_style INTO TABLE it_zsch_att-field_style.
MODIFY it_zsch_att INDEX l_index.
** FREE it_zsch_att-field_style.
** CALL METHOD grid1->refresh_table_display .
ENDLOOP.
Thanks In advance .
Suvana Smith
2012 Jul 12 11:41 AM
Hi,
Try to refresh the style tab of your itab.
i.e.
REFRESH lt_field_style , it_zsch_att-field_style.
IF wa_zsch_att-lt_metric = '1.00' .
PERFORM fill_field_style USING 'RW'
CHANGING lt_field_style .
ELSE.
PERFORM fill_field_style USING 'RO'
CHANGING lt_field_style .
ENDIF .
INSERT LINES OF lt_field_style INTO TABLE it_zsch_att-field_style.
MODIFY it_zsch_att INDEX l_index.
Try if this will work.
Regards,
jake
2012 Jul 12 1:59 PM
Hi Jake ,
I tried that but the output comes with a blank ALV Grid .
2012 Jul 13 2:48 AM
Try this:
LOOP AT it_zsch_att INTO wa_zsch_att .
l_index = sy-tabix .
REFRESH: lt_field_style , wa_zsch_att-field_style .
IF wa_zsch_att-lt_metric = '1.00' .
PERFORM fill_field_style USING 'RW'
CHANGING lt_field_style .
ELSE.
PERFORM fill_field_style USING 'RO'
CHANGING lt_field_style .
ENDIF .
INSERT LINES OF lt_field_style INTO TABLE wa_zsch_att-field_style.
MODIFY it_zsch_att from wa_zsch_att INDEX l_index.
ENDLOOP.
Regards,
Jake
2012 Jul 16 9:52 AM
Hi ,
The Problem is solved .
Actually The correct syntax would be without the work area in loop......endloop ,
i.e , The Correct syntax would be
loop at it_zsch_att . " And not loop at it_zsch_att into wa_zsch_att
********
********
endloop
Thanks ,
Suvana Smith
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |