Hi,
this is going to be a simple answer and I am sure there are lots of links out there but I cant find them.
I have been asked to create an RFC that takes in data runs a query and then returns the records. In this example I have been asked to pass in a WERKS(Plant) field and then return all the associated LGORT(Stor Loc).
I have done some resaech and found that the table I need is T001L but I am having trouble getting the RFC to work correctly.
I have created an import field of WERKS and created a RETURN_VALUES (new structure). I have attached the simple code below.
However when I run this code only the last record is returned in the results. When I debug this it adds all the records to the structure but seems to be overwriting the value each time. Sure this is something to do with loops. Maybe I shouldn't be using a structure - perhaps an internal table?
One more note is that this will be executed from a remote system.
FUNCTION Z_MDM_LU_STOR_LOCS. *"---------------------------------------------------------------------- *"*"Local interface: *" IMPORTING *" VALUE(PLANT) TYPE WERKS *" EXPORTING *" VALUE(RETURN_VALUES) LIKE ZMDM_STORLOC STRUCTURE ZMDM_STORLOC *"---------------------------------------------------------------------- SELECT LGORT FROM T001L INTO RETURN_VALUES-LGORT WHERE WERKS LIKE PLANT. ENDSELECT. ENDFUNCTION.