cancel
Showing results for 
Search instead for 
Did you mean: 

RFC for Webservice scenario

shubhnam_singh
Participant
0 Kudos

Hi Experts,

We have a scenario, Web<-->PI<-->RFC. We have this RFC but I think we need a better structured RFC for web calls, i mean there would a 'reutrn' parameter expected which i don't see here:

---------------------------------------------------------------------------------------------------------------------------------------

function zpi_emp_master.

*"----------------------------------------------------------------------

*"*"Local Interface:

*"  IMPORTING

*"     VALUE(L_PERNR) LIKE  PA0001-PERNR

*"     VALUE(H_PERNR) LIKE  PA0001-PERNR

*"  TABLES

*"      IT_FINAL STRUCTURE  ZPI_EMP_MASTER OPTIONAL

*"----------------------------------------------------------------------

perform collect_data tables it_final

                     using l_pernr

                           h_pernr.

endfunction.

----------------------------------------------------------------------------------------------------------------------------------------


Please let me know what would be the best format for the scenario. I am a PI consultant and have never developed a rfc for such scenario, please help.


--

rgds

Shubhnam


Accepted Solutions (1)

Accepted Solutions (1)

iaki_vila
Active Contributor
0 Kudos

Hi Shubnam, There isnt a better structure to call a RFC. On the other hand, i can give you a few recommendations, for example the tables could be traspassed in the RFC export structure because the tables clausule is obsolete, you should create a table type based in a structure, and finally you can use the table type in the RFC.  Also, i usually create a parameter type bapireturn in order to point the RFC final result like bapi-type = 'S', bapi-code = 0 and bapi-message = 'Succes'. For increase the RFC cearity you should to try to offer similar interfaces in your RFCs. Regards.

shubhnam_singh
Participant
0 Kudos

HI Inaki,

Thanks for a prompt reply.

If possible please post some sample code for a synchronous rfc, very simple basic one so that i can send it to the ABAP team.

--

rgds

Answers (2)

Answers (2)

shubhnam_singh
Participant
0 Kudos

Hi experts,

I am marking this post answered and the first one to ans as the correct ans., tho all the ans r correct

thanks for ur interest and input.

--

rgds

markangelo_dihiansan
Active Contributor
0 Kudos

Hello Shubhnam,

The code above would work, but add 's suggestion.

Regards,

Mark

shubhnam_singh
Participant
0 Kudos

Hi Mark,

Thanks for the response.

In our another scenario using rfc adapter, we had an issue with the rfc only and in the end it was one line that resolved it

     submit ZPI004_SALES_ORDER and return.

I was assuming something on similar lines wud be needed.

--

rgds

ambrish_mishra
Active Contributor
0 Kudos

Hi Shubhnam,

Essentially, it is the ABAP code which needs to execute properly first.

Some questions you need to delve into:

Is your web service sending just one PERNR for RFC call or multiple ?

Does your RFC code, send a PERNR and return the master data based on BEGDA and ENDDA ?

Is there a possibility of multiple records for the same PERNR being fetched ?

Based on these questions, the RFC needs to be defined and developed.

Hope it helps!

Ambrish

shubhnam_singh
Participant
0 Kudos

Hi Ambrish,

How are you bro?

re the scenario, as in the definition, l_pernr and h_pernr are for the range and the tbl it_final is populated with the resulting records.

this FM works fine in the ECC but for webservices i am wondering if this is enough.

--

rgds

ambrish_mishra
Active Contributor
0 Kudos

Hi Shubhnam,

I'm good..thanks buddy!

Just test from message mapping with some valid data and see the output and then run an end to end test. At the end of the day, its just about populating the target message and sufficing the requirements of WSDL's response structure.

Hope it helps!

Ambrish