2013 Apr 18 10:17 AM
Hi Experts,
Is there anyway to turn this kind of basic abap code into abap object one?
READTABLE Internal INTO area WITH KEY
ytest = source_fields_rule-gl_account
BINARYSEARCH.
IF area-flag = 'N'.
CLEAR RESULT.
ENDIF.
IF area-flag = 'Y'.
IF area-tpr ISINITIAL.
RESULT = SOURCE_FIELDS_RULE-value.
ELSE.
RESULT = area-tpr.
ENDIF.
ENDIF.
Thanks.
Amine
2013 Apr 18 2:14 PM
Hi amine,
for oo programming please refer to google. You will find tons of learning material. What is you oo expertise/training level?
In your case, you can use a functional method importing source_fields_rule returning RESULT.
But your code is buggy as it is:
READTABLE ... BINARYSEARCH and no check for SY-SUBRC will cause unpredictable errors if no matching record is found.
Regards
Clemens
2013 Apr 18 12:30 PM
Hi Amine,
I don't understand your question. Is there a syntax check error in ABAP OO context?
2013 Apr 18 1:47 PM
Hi Uwe,
No there is no errors, but i would like to change it in an objects style not the basic abap....
I don't know if it's more clear
Amine
2013 Apr 19 9:54 AM
There is no "object style" ABAP. This code block will look exactly the same in ABAO OO (needs some "optimization" though, see Clemens' comment, but this is another story).
2013 Apr 19 10:15 AM
I taked account of Clemens remark.
Do you see any other optimization that i can add to my code?
Thanks.
Amine
2013 Apr 18 2:14 PM
Hi amine,
for oo programming please refer to google. You will find tons of learning material. What is you oo expertise/training level?
In your case, you can use a functional method importing source_fields_rule returning RESULT.
But your code is buggy as it is:
READTABLE ... BINARYSEARCH and no check for SY-SUBRC will cause unpredictable errors if no matching record is found.
Regards
Clemens
2013 Apr 18 3:22 PM