Skip to Content

CDS - BOPF - Update Table - Selected Fields Only

Hi all,

I have successfully created a CDS view with annotations and made it BOPF proof.
I selected only a few records out of my Z_TABLE and added writeActivePersistence to this Table.

When I now SAVE my edited data it clears all the other fields that are not selected by the CDS.

Is there any option to just SAVE the data that has been changed? LIke you can do within a Determination.

 io_modify->update(
        EXPORTING
          iv_node               = is_ctx-node_key
          iv_key                = <ls_cust>-key
          iv_root_key           = <ls_cust>-root_key
          is_data               = REF #( <ls_cust>-node_data )
          it_changed_fields     = VALUE #(
            ( FIELD1 )
            ( FIELD2 )
            ( ... )
          )
        ).

A second option is to select all the fields within my 2 CDS ( I and Consuming CDS), but what if a new field is added to the Z-table and a developer forgets to add it within the CDS aswell, then this field is always cleared by the fiori app.
Is there an option to select all ( * ) using the annotations? "@Search.defaultSearchElement: true

Add a comment
10|10000 characters needed characters exceeded

  • I think the determination looks like it is going to work out for you.. You just to select that complete record and do the corresponding from incoming data to db record and update it the api. This will eliminate your manual adding of fields everytime via cds on every update..
    Still wondering why the BOPF api is clearing the other fields though.. Probably you are in the old version? or is the design was like that..?

  • Hi,

    The BOPF logic works like this.

    Consider a Table with 3 fields A, B and C.

    In your BOPF( CDS ), you have exposed A and B.

    Now, on save, BOPF will have a Structure which is of the Type of your Table. That means there will be a structure with fields A,B,C. Lets call this Structure 'Table Structure'.

    There would be another structure that represents the BOPF which will only have field A and B since only those 2 are know to BOPF. Lets call this "Combined Structure".

    During save, BOPF will perform a Move-Corresponding from Combined Structure to Table Structure. Here, It moves only field A and B to the Table Structure and field C would now be empty.

    This table structure is then used to save to DB.

    Hence, C will be cleared

    One way is to redefine the Save and you handle the Save without allowing BOPF to do it.

    or bring all the fields or use the Draft Framework where you have a better control over Save.

    Regards,

    Pratheek

Related questions

0 Answers

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.