‎2008 Dec 04 3:50 PM
HI gurus
Is the following implementation in-correct. This for me should be creating invoices as the function module YSHELL_INCOMING is calling a bapi inturn...however I do not get any tables filled and there is no return in the return table.
DO 5 TIMES.
WRITE SY-INDEX TO V_TASK.
CALL FUNCTION 'YSHELL_INCOMING'
STARTING NEW TASK V_TASK
performing set_function1 on end of task
EXPORTING
HEADERDATA = G_INV_HEADER
TABLES
ITEMDATA = G_INV_ITEMDATA
ACCOUNTINGDATA = G_INV_ACCDATA
GLACCOUNTDATA = G_INV_GLDATA
WITHTAXDATA = G_INV_WITHTAXDATA
RETURN = G_INV_RETURN.
ENDDO.
form set_function1 using taskname.
receive results from function 'YSHELL_INCOMING'
IMPORTING
INVOICEDOCNUMBER = G_INVOICE
FISCALYEAR = G_FYEAR.
endform.
endform.
‎2008 Dec 04 4:20 PM
Hi Rich,
One question : Does my Z-function module have to RFC enabled to make this work .
‎2008 Dec 04 3:57 PM
Move Add
> TABLES
> RETURN = G_INV_RETURN
to the RECEIVE RESULTS section. Also add this to the aRFC-call and check sy-subrc, as there might be a technical problem with the aRFC:
> EXCEPTIONS
> communication_failure = 1
> system_failure = 2
> resource_failure = 3
> others = 4.
Thomas
P.S. you should also do a COMMIT WORK inside YSHELL_INCOMING
‎2008 Dec 04 3:59 PM
Pretty sure you need to WAIT till its done. Here is an example program using the WAIT.
report zrich_0001.
data: functioncall1(1) type c.
constants: done(1) type c value 'X'.
data: cstgdetail1 type bapicustomer_kna1.
parameters: p_kunnr1 type kna1-kunnr.
start-of-selection.
call function 'BAPI_CUSTOMER_GETDETAIL2'
starting new task 'FUNC1'
destination 'NONE'
performing set_function1_done on end of task
exporting
customerno = p_kunnr1.
* Receive remaining asynchronous replies
wait until functioncall1 = done.
write:/ cstgdetail1.
************************************************************************
* FORM FUNCTION1_DONE
************************************************************************
form set_function1_done using taskname.
receive results from function 'BAPI_CUSTOMER_GETDETAIL2'
importing
customergeneraldetail = cstgdetail1.
functioncall1 = done.
endform.
Regards,
Rich Heilman
‎2008 Dec 04 4:31 PM
Hi Rich , should my Z- Function Module be RFC enabled to make this work , I am receiving a short dump right now.
‎2008 Dec 04 4:20 PM
Hi Rich,
One question : Does my Z-function module have to RFC enabled to make this work .
‎2008 Dec 04 4:34 PM
In case Rich is out for lunch: yes
Also I strongly recommend you see my answer above. I am using aRFC and it works nicely.
Thomas
http://help.sap.com/saphelp_nw70/helpdata/EN/22/042592488911d189490000e829fbbd/frameset.htm
‎2008 Dec 04 5:06 PM
Thomas and Rich , thank you very much for your help , it seems to be working now , my function module was missing RFC enabled and few other tinkering .