cancel
Showing results for 
Search instead for 
Did you mean: 

BRF+ Insert into table

dominik_ee
Advisor
Advisor
0 Kudos

Is it possible to insert new entries into a table?

I am getting a table as conext and doing some calculations with it. The result should be inserted into an yet empty table in brf+ and the filled table will then be the result data object of the function.

If not, is there any other option than calling the function from abap for every entry?

Regards,

Dominik

View Entire Topic
christianlechne
Active Contributor

Hi Dominik,

yes this is possible directly in BRFplus. How is the context table worked on in BRFplus? Is there a loop over it and you do some processing per line and then you want to append the line to the result data object or do you want to append the complete tabel to the result data object?

BR

Christian

P.S. There is also a way to call a BRFplus function module or a static class method from BRFplus but this is not needed in your case

dominik_ee
Advisor
Advisor
0 Kudos

Hi Christian,

i got a context table with the base data. I'm looping over all entries, processing some rules and then calculating a result for every entry. This result should then be inserted into a new table (no binding). The new table consists of the result and two key-elements. After the loop the new result table should be returned.

Regards,

Dominik

christianlechne
Active Contributor
0 Kudos

Hi Dominik,

here is a simple example:

I have a function which gets as input an input table (structure with two fields) and has a result table (structure with two fields)

In a rule set I have a rule that loops over the input table:

The decision table now changes Element 1 of the result data structure and I set the value of the second result data element to a fixed value (for the sake of the example). Then I have two option to fill the result table:

I can either Insert values into the table (= append):

Or I can modify existing entries

You get these options of handling the entries of a table as soon as you change/access a context/result data object of type table

So summarizing the typical workflow is:

  • Loop over the input (-> access to single line)
  • Change the element of the target structure or the complete structure itself
  • Insert/Change the target table from the structure you just filled

Hope that helps

BR

Christian

dominik_ee
Advisor
Advisor
0 Kudos

Thanks a lot!

BR

Dominik