Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function module in abap hr

Former Member
0 Likes
430

Hi friends

i am new to abap.....i was given a funtion module to work on.. here i am sending the req...can any one plz tell how to write code for the following:

This is recivel of IBG bank account number. only 2 banks hsbc(Bank code = 7232)

lenght 4 and ocbc(bank code = 7339)lenght 3.

Importing parameters criteria:

Field Name Data element datatype type description

-


IM_Bankkey bankl char(15) import bank key

IM_bankactno bankn char(18) import bank acc no

Exporting Parameters:

Field Name Data element datatype type description

-


ex_ibgbankacct n/a char(16) epxort return parameter

e_errormsg n/a char(20) export return parameter

Now the logic:

Extract bank code from im_bankkey

extract 4 characters of im_bankkey into im_bankcd and process the following step

if ocbc bank(bank code = 7339) and hsbc bank (Bank code = 7232)

then truncate the 1st 2nd 3rd digits of im_bankacctno

ex_ibgbankacct = truncated im_bankacctno.

else

ex_ibgbankacct = im_bankactno

end if(end of chk for bank code)

ex_ibgbankact = extract from 1st to 16 character of ex_ibgbankacct.

plz help me to write the code????

2 REPLIES 2
Read only

Former Member
0 Likes
399

Hi Purnima,

Try the code like below.

FUNCTION ztest440.

*"----


""Local Interface:

*" IMPORTING

*" REFERENCE(IM_BANKKEY) TYPE BANKL

*" REFERENCE(IM_BANKACTNO) TYPE BANKN

*" EXPORTING

*" REFERENCE(EX_IBGBANKACCT) TYPE CHAR16

*" REFERENCE(E_ERRORMSG) TYPE CHAR20

*"----


DATA : im_bankcd TYPE char4.

im_bankcd = im_bankkey+0(4).

IF im_bankcd EQ '7339' OR

im_bankcd EQ '7232'.

ex_ibgbankacct = im_bankactno+3(15).

ELSE.

ex_ibgbankacct = im_bankactno+0(16).

ENDIF.

ENDFUNCTION.

Hope this will resolve your problem.

Reward if it is helpfull..

Read only

0 Likes
399

thnaks a lot...