Skip to Content
1
Dec 20, 2011 at 10:07 AM

TABLE_ILLEGAL_STATEMENT in modify statement

3458 Views

Hi,

I am getting a dump( TABLE_ILLEGAL_STATEMENT) in modify statement in a section of my code where I want to modify two fields named amt_plan and qty_plan into an internal table gt_final.

Thanks..

    SELECT objnr gjahr wrttp versn uspob wkg001 wkg002 wkg003 wkg004 wkg005 wkg006 wkg007 wkg008 wkg009
           wkg010 wkg011 wkg012 meg001 meg002 meg003 meg004 meg005 meg006 meg007 meg008 meg009 meg010
           meg011 meg012 FROM coss INTO TABLE gt_coss FOR ALL ENTRIES IN gt_afvc
           WHERE objnr = gt_afvc-objnr OR wrttp = 1 OR versn = 0 OR gjahr NE ''.

    LOOP AT gt_coss INTO gw_coss.
      READ TABLE gt_final INTO gw_final WITH KEY objnr = gw_coss-objnr.
      IF sy-subrc = 0.
        gw_final-amt_plan = gw_coss-wkg001 + gw_coss-wkg002 + gw_coss-wkg003 + gw_coss-wkg004
                            + gw_coss-wkg005 + gw_coss-wkg006 + gw_coss-wkg007 + gw_coss-wkg008
                            + gw_coss-wkg009 + gw_coss-wkg010 + gw_coss-wkg011 + gw_coss-wkg012.

        gw_final-qty_plan = gw_coss-meg001 + gw_coss-meg002 + gw_coss-meg003 + gw_coss-meg004
                            + gw_coss-meg005 + gw_coss-meg006 + gw_coss-meg007 + gw_coss-meg008
                            + gw_coss-meg009 + gw_coss-meg010 + gw_coss-meg011 + gw_coss-meg012.
*        APPEND gw_final TO gt_final.
        MODIFY gt_final FROM gw_final.
      ENDIF.
      CLEAR: gw_final, gw_coss.
    ENDLOOP.

Edited by: Paaavan on Dec 20, 2011 11:08 AM