Lesson of the day
May 16th, 2010
Always use variable when trying to modify table, or else you’ll get randomly unexpected results.. well, at least that’s what happened to me with SAP/R3 4.6D.
For example, you’ve got a transparent table you wish to manipulate named: ZTXXX.
Create a variable named WA_ZTXXX.
DATA: WA_ZTXXX LIKE ZTXXX.
CLEAR WA_ZTXXX.
SELECT SINGLE * INTO WA_ZTXXX
FROM ZTXXX
WHERE [CONDITION].
IF SY-SUBRC EQ 0.
WA_ZTXXX-FIELD1 = ‘Blabla’.
WA_ZTXXX-FIELD2 = ‘Blibli’.
MODIFY ZTXXX FROM WA_ZTXXX.
ENDIF.
Wow! Nice Idea. Thx for posting.