Skip to Content
0

Problem with modify statement in sap abap

Mar 03, 2017 at 05:04 PM

29

avatar image

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Prasad Patil Mar 06, 2017 at 10:15 AM
0

Here the index seems to be an issue. Modify statement does not have an index at which the table needs to get modified. Either identify the index of the row in the table where modify needs to be done or use field symbols to modify the table contents.

Share
10 |10000 characters needed characters left characters exceeded