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

Kindly review the RFC Function Module code....?

Former Member
0 Likes
748

Hi Gurus,

I have to write a RFC Function Module...I have written the code for that...please review it and tell me if this is fine...

TABLES: ZTFICO_GL_ITY_MP......?can i use it like this...

DATA: B_RESULT TYPE c.

SELECT SINGLE * FROM ZTFICO_GL_ITY_MP WHERE ZZITY = BSEG-ZZITY

AND HKONT = BSEG-HKONT

AND END_DT > BKPF-BUDAT.

IF SY-SUBRC <> 0.

B_RESULT = B_FALSE.

MESSAGE E033(ygrfxx) WITH BSEG-ZZITY BSEG-HKONT BKPF-BUDAT.

ENDIF.

ENDFUNCTION.

Please give suggestions...Points will be rewarded..

Cheers: Sam

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
698

Hi,

Basic rule donot use Error message inside the RFC

aRs

7 REPLIES 7
Read only

former_member194669
Active Contributor
0 Likes
699

Hi,

Basic rule donot use Error message inside the RFC

aRs

Read only

0 Likes
698

Thanks for the reply....then how can i do this....please suggest...

Cheers:Sam

Read only

0 Likes
698

Hi,

use "raise exceptions"

aRs

Read only

0 Likes
698

Ho can i do it...i am new to this...can u help me with the code or provide steps to do it...

also can i declare tables in the RFC FM the way i have done....

Cheers:

sam

Read only

former_member194669
Active Contributor
0 Likes
698

Hi,

For Exceptions

SE37--> after giving fm name > change> choose exceptions tab-->enter MATERIAL_NOT_FOUND then in description enter Material not found

In code

instead of

MESSAGE E033(ygrfxx) WITH BSEG-ZZITY BSEG-HKONT BKPF-BUDAT.

write as

raise exception MATERIAL_NOT_FOUND

If you want to send the your message out then insert a RETURN table in the Tables Tab

and fill it with your message.

Tables declaration:-->

You can declare but in the TOP include of the main program.

aRs

Read only

0 Likes
698

How can i insert the return table and send messages out...can u provide some sample code....

Kindly help...

Cheers: Sam

Read only

0 Likes
698

Hi,

Insert BAPIRET1 as RETURN table in function module Tables Tab

then

data : begin of bapireturn occurs 0.

include structure bapiret1.

data : end of bapireturn.

clear bapireturn.

  • process field return-type.

bapireturn-type = type.

  • process field id, number

bapireturn-id = cl.

bapireturn-number = number.

  • process message variables

bapireturn-message_v1 = par1.

bapireturn-message_v2 = par2.

bapireturn-message_v3 = par3.

bapireturn-message_v4 = par4.

append bapireturn.

please check fm APAR_EBPP_DELETE_BANK

aRs