on 02-02-2014 11:58 PM
Hello, i need a little help with abap code in transformation at field routine. I have written a code successfully but now i need to modify a little bit. i am reading another dso and populating the field which works fine. now i want to test three fields coming from source and if those three are blank i want the result to be automatically '0'. here is what i have done but getting errors:
IF SOURCE_FIELDS-ZMARG1
SOURCE_FIELDS- ZMARG2
SOURCE_FIELD-ZMARG3 NE '0'.
READ TABLE IT_ZPUR WITH KEY
MATERIAL = SOURCE_FIELDS-MATNR
INTO WA_ZPUR.
IF SY-SUBRC = 0.
RESULT = WA_PUR-/BIC/ZPUR_ZCHY1.
ENDIF.
ELSEIF.
RESULT = '0'.
I keep getting "Statement Source_Fields-ZMARG2 not defined".
Please help.
Thanks.
Hi Venkat,
In my opinion the coding should look as follows:
IF NOT SOURCE_FIELDS-ZMARG1 IS INITIAL AND
NOT SOURCE_FIELDS-ZMARG2 IS INITIAL AND
NOT SOURCE_FIELDs-ZMARG3 IS INITIAL.
READ TABLE IT_ZPUR WITH KEY MATERIAL = SOURCE_FIELDS-MATNR
INTO WA_ZPUR.
IF SY-SUBRC = 0.
RESULT = WA_PUR-/BIC/ZPUR_ZCHY1.
ENDIF.
ELSEIF.
RESULT = '0'.
ENDIF.
Best regards,
Sander
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Whatever Sander van Willigen suggested seems to be correct.The only correction you need to do in the code given is remove the
.
after ELSEIF
This should give you no syntax error.
Please check the same.
Regards,
AL
Hi Venkat,
Check this code;
IF ( SOURCE_FIELDS-ZMARG1 ne 0 AND SOURCE_FIELDS-ZMARG2 ne 0 AND SOURCE_FIELDs-ZMARG3 ne 0 ).
READ TABLE IT_ZPUR WITH KEY MATERIAL = SOURCE_FIELDS-MATNR
INTO WA_ZPUR.
IF SY-SUBRC = 0.
RESULT = WA_PUR-/BIC/ZPUR_ZCHY1.
ENDIF.
ELSE.
RESULT = '0'.
ENDIF.
Best regards,
Sakthi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.