cancel
Showing results for 
Search instead for 
Did you mean: 

SD_SALESDOCUMENT_CREATE with RAP, draft-handling

Benedikt3
Participant
0 Kudos
1,085

Hi there,

we are on a brand new Hana 2022 System and i was tasked to develop an app to create Sales Documents.

As plenty of blogs states RAP is they way to go; t I tried my best to get it working.

  • Fiori Elements + Draft with V2 => way to much limitation for any real world scenario
  • Fiori Elements + no Draft with V4 => no create support at all from Fiori-Elements. No clue if this can be done by hand with deep create
  • UI5 + Draft with V4 => no documentation how draft is to be implemented
  • UI5 + no Draft; V2 => no example/documentation how deep create works in RAP e.g. Header + Items.
  • Fiori Elements + Draft with V4 => way to go?

Those two blogs guided me to use the later approach(early numbering)

YET there is one big question-mark.

The Key of the resulting object can only be overwritten during rap-create() but

SD_SALESDOCUMENT_CREATE

is calling internally

Statement "CALL FUNCTION .. IN UPDATE TASK" and this is not allowed within create().

Hence this can only be called during rap-SAVE() and rap-save() has no export parameter to map to a new ID. Hence Fiori Element UI get's confused and stay's on the draft-ID.

  1. Dose this mean RAP is not usable for any BAPI-Based( PM, SD, CS..) module which draws internal numbers? This would exclude all module I work with in the last 10 years.
  2. Any example out there for this scenarios?
  3. Did i miss something?
  4. Any way to switch off the "CALL FUNCTION .. IN UPDATE TASK" check in create (BAPI rollback could be called by hand somehow)?
  5. Is there any SNote "to give my functional consultant", telling us thats it's OK to switch on external numbering for modern implementations. This would solve this problem as we could draw the number in create() and call BAPi with test-flag beforehand

former_member14709
Contributor
0 Kudos

Following.

View Entire Topic
Benedikt3
Participant
0 Kudos

coming back to this after a bit of time

  • Fiori-Elements + V2 SEGW. We tried to add the missing features with JSON-Model and update changes with the same batch-group. But this template has very strange message handling. We could not make all cases work.
  • Freestyle + V4 SEGW -> there is a sap note - no recommended
  • Fiori-Elements + V2/V4 RAP. We checked a few possible workarounds e.g.
  • => use external numbering,
  • => User-Exit to supply Number within bapi over global-memory.
  • => Call BAPI in laster_numbering,
  • => Call BAPI as remote.
  • => Put new number in a message; parse it on ui-side; make navigation to newly create by hand
  • As all of them are hacks and legal documents should be numbered gap free. We abandoned RAP/ with and without draft.

To sum it up, we went for SEGW + V2 + local-JSON model with batch/single change set requests to get it working similar to SAP-GUI(Fill-out, Validate, save header + multiple child's)

As long a module is not GUID based and has internal numbering; RAP seams to be unusable.

Ramjee_korada
Active Contributor
0 Kudos

Below blogpost describes the issue "As long a module is not GUID based and has internal numbering; RAP seams to be unusable".
you have already mentioned it in the initial question.

https://blogs.sap.com/2022/03/13/abap-restful-application-programming-unmanaged-draft-for-non-guid-k....

Best wishes,

Ramjee