Skip to Content
0
Former Member
Mar 03, 2017 at 05:04 PM

Problem with modify statement in sap abap

85 Views Last edit Mar 02, 2017 at 09:44 AM 2 rev

The following code has problem with modifying the internal table. Once I debug the code the changes done in the line GW_PRODUCT-START_DATE = SY-DATLO.

GW_PRODUCT-FLAG = 'T'. is get assigned but the changes cannot be modified in the internal table. Once I put loop at internal table to print the contents the old value only printed not the modified value.

Can you please tell me what is the error in the code?

SELECT * FROM Z304_DEMO INTO TABLE GT_PRODUCT.

SORT GT_PRODUCT BY END_DATE DESCENDING.

READ TABLE GT_PRODUCT INTO GW_PRODUCT INDEX 1.

IF GW_PRODUCT-END_DATE < SY-DATLO.

GW_PRODUCT-END_DATE = SY-DATLO.
GW_PRODUCT-FLAG = 'T'.
MODIFY TABLE GT_PRODUCT FROM GW_PRODUCT.

ELSEIF GW_PRODUCT-END_DATE > SY-DATLO.

GW_PRODUCT-START_DATE = SY-DATLO.
GW_PRODUCT-FLAG = 'T'.
MODIFY TABLE GT_PRODUCT FROM GW_PRODUCT.
ENDIF.