Hello, i have a question about a routine. i was able to create an internal table and was able to populate it with the data i want but now the problem arises because i have multiple scenarios and according to those scenarios i have to populate my field. this is what my internal table looks like:
material | material type | Changed by | Return code | Division | ProfitCenter
100 | OR | 1324 | 2143 | USET | 85678
101 | NE | 3567 | 9076 | UKEN | 87562
Now I want to do a read statement in my field routine.
1st scenario: if material type is '1324' then assign value to result which is very simple
2nd scenario has 2 parts to it: if material type is '3567' AND if Division is 'USET', then assign a specific value to result
If material type is '3567' AND DIVISION is not equal to BLANK then assign a specific value to result.
Now, I can do multiple read statements like below. but i want to know if there is a way for me to use IF and ELSE statement to read statements?
READ TABLE imat WITH KEY
material = SOURCE_FIELDS-material
mattype = '1324'
INTO wmat. (work area)
IF SY-SUBRC = 0.
RESULT = wmat-zstype.
ENDIF.
READ TABLE imat WITH KEY
material = SOURCE_FIELDS-material
mattype = '3567'
division = 'USET'
INTO wmat.
IF SY-SUBRC = 0.
RESULT = wmat-zmtype.
ENDIF.
and so on.
Please let me know if there is a way for me to do IF ELSE loop and with in the loop i can do read statements?
Thanks.