Skip to Content

ABAP CDS BOPF Action to Copy object

Hi,

Can anyone help me out with a bit of sample code to define a copy action in a Bopf?

The not so helpful guide here https://help.sap.com/viewer/cc0c305d2fab47bd808adcad3ca7ee9d/7.5.6/en-US/208bd589387c411390dd8c5077561de5.html mentions how to setup the action in the CDS view, this is the easy part, the harder part is the actual code in the Bopf action.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    Aug 31, 2017 at 02:32 PM

    In case anyone reads this and has the same issue... the solution is to call the method

    io_modify->end_modify( abap_true ).

    and

    io_read->retrieve

    after doing the create

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 16, 2017 at 01:39 PM

    ok, so I figured out how to do a copy, not as simple as one might expect. anyway... My copy action works but the new record added to the table is not visible until the view is refreshed (F5)

    next question is does anyone know how to make the screen refresh automatically after performing the action?

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 03, 2017 at 06:16 AM

    Hi,

    When I am pressing "COPY" Action....New page is opening in display mode. How to make it editable ??

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 29, 2017 at 03:06 PM

    Hi Neil,

    After pressing Copy button on UI.. Record is immediately saved in DB.

    How to control in Copy action.

    Regards,

    Ashutosh

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 09 at 10:22 AM

    Hi Neil,

    I tried to call this methods, but it doesn't work. I called the end_modify and retrieve methods, but nothing happens.

    How did you implemented the copy function?

    My solution:

    1) Retrieve table

    2) loop over table

    3) create new entry with line

    4) endloop

    5) end_modify, retrieve

    Wenn I do the retrieve in the loop I get an short dump.

    Can you help me out here?

    Thank you.

    Best regards,

    Bettina

    Add comment
    10|10000 characters needed characters exceeded

    • Hi,

      The retrieve isn't done in the loop, it's after the loop.

      My code looks like this...

        METHOD /bobf/if_frw_action~execute.
      
          DATA ... blah blah blah
      
          io_read->retrieve
      
          LOOP AT ... do stuff here for new entry to be created
              io_modify->create
            ENDLOOP.
           
       io_modify->end_modify( abap_true ).
            io_read->retrieve
      
          ENDMETHOD.