Monday, July 15, 2013

mathematic operand.

well, continuing from the last post of me,
i'm continuing my post, this time i'd like to explain 2 of my basic programs in abap programing.

as usuall you should enter the object navigator page,
creating new object, assign the package, and input the request.
in my case, my coding is look like this.
and this is my coding

FUNCTION Z_35_FM_CALCULATION.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(IM_OPERAND1) TYPE  I
*"     VALUE(IM_OPERAND2) TYPE  I
*"     VALUE(IM_OPERATOR) TYPE  C
*"  EXPORTING
*"     VALUE(EX_RESULT) TYPE  I
*"----------------------------------------------------------------------

CASE im_operator.
WHEN '+'.
ex_result = im_operand1 + im_operand2.
WHEN '-'.
ex_result = im_operand1 - im_operand2.
WHEN '*'.
ex_result = im_operand1 * im_operand2.
WHEN '/'.
ex_result = im_operand1 / im_operand2.
ENDCASE.




ENDFUNCTION.

and when it successfull, it should look like


and about the second programs,
logicaly it has different function, on the second one i put the function on the other file and the variable on the other hand. so it's a little bit like linking.
here's my coding, oh and also you have to create the functioning module first. and import or export.

the star sign means it's read as a comment, and will NOT be executed.
and if it succesfull it should be something like this.

see, the result is a little bit different from the last one.
well, thats it for now,
thanks for visiting.
cheers.

No comments:

Post a Comment