Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to achive saving draft BO entity ?

Attila
Active Participant
0 Kudos

Dear Community Members,

we would like to use Business Objects in OData service. Since the OData service is based on REST protocol, we've no session memory between user interactions during updating the values through the UI. It means as soon as the user push the edit button, we need to keep the saved instance of the BO, but in addition save the changes done by the user, without memory in ABAP, so have no possibility to simply reset the changes.

This kind of Draft management is done using a darft flag as key in our tables. When user push the Edit button, we copy the active version(without draft flag) and set the draft flag in the copied  table entries. All changes of the user is done on the draft version, and when the User push save, we delete the current active version, and remove the draft flag from the entries updated by teh user.

Do you know, how to cover this draft management requirement using BOPF, where the backend data is managed by BO, and have to be saved after each change, and both active and temporary version have to be managed ? My idea would be to copy the instance when the user push the edit button. To support this for example, Is there a default copy operation provided by the BOPF API ? Might not this is the best solution, just an idea. If you have better suggestion, just tell me

Thank you,Attila

1 ACCEPTED SOLUTION

hardyp180
Active Contributor
0 Kudos

In my 7.5 system I can see the class /BOBF/CL_LIB_DRAFT which contains the four methods to handle saving documents as drafts and then moving the draft to the active object.

How to use this in a BOPF definition escapes me. I can only presume this has not yet been released for us "customers"

8 REPLIES 8

cyclingfisch_
Active Contributor
0 Kudos

Hi Attila,

As BOPF becomes the framework for S4 HANA ABAP development and Fiori the UI technology for S4, SAP built the functionality you descriped. Maybe somebody from SAP can give you some insights on how they designed it.

Cheers,

Martin

0 Kudos

Hi Martin,

I've already heard about it, that the Draft management will be implemented or is implemented in one of the SPs of 7.50. We are on 7.40, therefore not having several features like the above mentioned and have to manage manually. I'll ask someone about product roadmap whether this already delivered, and access a developer/trial version(available is 750 sp1) or a live system on higher level to check how this is implemented.

Thanks for your proposal Martin

Attila

hardyp180
Active Contributor
0 Kudos

In my 7.5 system I can see the class /BOBF/CL_LIB_DRAFT which contains the four methods to handle saving documents as drafts and then moving the draft to the active object.

How to use this in a BOPF definition escapes me. I can only presume this has not yet been released for us "customers"

0 Kudos

Hi Attila, Martin and Paul,

at SAP we are currently experimenting with draft management. In 7.50 SP2 you might find the above mentioned classes. However, this was our first version and is already outdated and therefore not documented. It will be deleted with upcoming versions.

Unfortunately we have to wait a bit more for a native draft support in the ABAP stack...

@Attila: You are totally right. Without draft it is hard to perform backend logic (validations, determinations, field-control), without beeing able to persist (incomplete, inconsistent) data in the backend. Copying active to draft data is definitely a good starting point. Without a native BOPF support or even an E2E support from client to backend this is pretty hard. But unfortunately also a lot of other questions have to be answered (What about locks? What about locks if this data is already used in a non-Fiori world? Who cleans up the drafts (garbage collector)? How to achieve a good performance with regards to "state"?).

Our ideas about Edit() and activate() are, that they are performed on one dataset, but do return a different one. This can be done in BOPF but also on a higher level, as long as this is not integrated.

Last year at TechEd we saw, how a draft app could look like. At TechEd this year we want to give a lab preview on how to build draft apps in the future....

Best regards,

Marcel

Attila
Active Participant
0 Kudos

Hi Marcel,

does it mean, that the feature described in DEV106 presentation of TechEd , which reference the interface /bobf/if_lib_draft is obsolete ?

Thank you for the information shared, this is very valueable for us, to take design decisions for our next BOPF based custom apps.

Attila

P.S.:

Paul, thanks for your info also.

What I've done actually at customer side on 7.4, that I've explicitly defined actions to create and activate draft version of the document (copying all the document data manually) in combination with alternative keys, which consist of the draft flag and the business key(like Document Number) of my object. So that the alternative key can be used in the GW entity, to differentiate between the active and draft version.

This is working fine so far, but as mentioned by Marcel, no native BOPF support, therefore I've to spend lot of time to copy content of the reusable dependent objects like text collection and attachment folder. What I did for locking, that I save the draft_user also, and when accessing documents, first I check for drafts using the alternative keys.  

0 Kudos

Hi Attila,

yes, the slides in DEV106 were a lab preview about the current ideas around the draft at this time, especially the BOPF exits for draft / active handling as described in the slides will change. Please do not use them productively.

Best regards,

Marcel

Former Member
0 Kudos

Hi Marcel,

Could you please suggest which session in the upcoming SAP TechEd 2016 discusses about Draft management in Fiori apps ? I am just curious to attend this session. Thank you.

Regards

Prabaharan Asokan

0 Kudos

Hi Prabaharan,

I suggest DEV109.

Kind Regards,

Ivo