How do I read this "standard" table in my Function Module?
I have a remote-enable Function Module (RFC). I am receiving two tables as part of the parameters. Table "A" is header information, and Table "B" is detail information. So for every 1 "A" header record, I may have 1 to many "B" detail records. I have a field we'll call "vendor_number" that is the common link between the two tables.
Here's what I want to do: I want to loop through table "A", and for each record, I want to do a READ on table "B", using the "ref_doc_no" from "A" as my key, to get the position of the first matching record. I hold onto the value of the table index and then start looping table "B", adding 1 to the saved table index each time to process all of the detail records.
Here's the problem: This worked great as an ABAP program. I had my "B" table declared with "ref_doc_no" as a non-unique key. But when I ported my code over to the RFC, it told me that the RFC could only deal with standard tables. I had to remove the "ref_doc_no" key declaration. So now when I try to activate, I get an error similar to this:
The declaration for the key field "another_field" is incomplete; however, "another_field" is contained in the key of table "B" and must be filled.
I don't understand that. I've not declared any keys for table "B". I don't understand why it's thinking I need to populate "another_field" (I don't even know what the value would be). My code to read the table (i.e. the line getting the error) is this:
Priming read on table (sets the initial sy-tabix index value)
READ TABLE it_incoming_invoice_line_item "table 'B'
WITH TABLE KEY ref_doc_no =
Is it possible for me to do some sort of direct read on a table in an RFC? The only alternative I can think of would be to have to loop through table "B" until I find the first occurrence of a match. Is that what I need to do?
Thanks everyone. Points, as always, awarded for helpful answers.
In this case have you thought about using LOOP with WHERE clause.
Loop at TABLEB where ref_doc_no = TABLEA-ref_doc_no.
This will loop only through so many entries which satisfy the condition.