cancel
Showing results for 
Search instead for 
Did you mean: 

S/4HANA VBRK/VBRP new field DRAFT

ennowulff
Active Contributor
0 Kudos

Hey there!

there is the sap note 2768887 that describes how to deal with the new field DRAFT in VBRK and VBRP.

As of S/4HANA 1709, the database tables for Billing Documents, VBRK and VBRP, also contain Draft document versions. These document versions are marked via the new Boolean fields VBRK-DRAFT and VBRP-DRAFT.

Draft Document Versions must be distinguished from regular document versions.
Draft Document Versions must not be referenced anywhere and must not be used for any form of reporting etc.

The readiness check finds the following join:

    SELECT nast~kschl,
           nast~datvr,
           nast~uhrvr,
           nast~usnam,
           nast~vstat,
           entry~*,
           esr~send_request_id,
           esr~mail_address,
           esr~route_id,
           esr~doc_format,
           esr~dlv_channel,
           vbrk~vbeln,
           vbrk~vkorg,
           vbrk~vtweg,
           vbrk~spart,
           vbrk~netwr,
           vbrk~waerk,
           vbrk~fkdat,
           vbrk~kunrg,
           vbrk~kunag,
           kna1~kunnr,
           kna1~name1,
           vbpa~kunnr AS kunre
      FROM nast
      JOIN /inw/einv_entry AS entry
       ON entry~einv_id = nast~/inw/einv_entry_id
      LEFT JOIN ZZ_ESR as esr "temp left join
      on entry~einv_id = esr~einv_id
      JOIN  vbrk
        ON  nast~objky = vbrk~vbeln
       and vbrk~draft  = @space
      JOIN  knvp
        ON  knvp~vkorg = vbrk~vkorg
       AND  knvp~vtweg = vbrk~vtweg
       AND  knvp~spart = vbrk~spart
       AND  knvp~kunnr = nast~parnr
       AND  knvp~parvw = nast~parvw
      JOIN  kna1
        ON  kna1~kunnr = knvp~kunnr
      LEFT JOIN vbpa
        ON  vbpa~vbeln = vbrk~vbeln
        AND vbpa~posnr = '000000'
        AND vbpa~parvw = 'RE'
      WHERE vbrk~vbeln IN @selection-fakt_nr
      AND   vbrk~fkart IN @selection-fkart
      AND   nast~vstat IN @selection-vstat
      AND   nast~kschl IN @selection-kschl
      AND   nast~erdat IN @selection-erdat
      AND   nast~eruhr IN @selection-eruhr
      AND   nast~usnam IN @selection-usnam
      AND   entry~status_tech IN @selection-st_tech
      AND   entry~status_dispatch IN @selection-st_dispatch
      AND   esr~dlv_channel IN @selection-channel
      INTO TABLE @DATA(fetched_rows).

All I have to do is to restrict the selection so that entries with DRAFT = space are selected.

Both variants do not work and the check still insists that there is some work to do:

Change 1:

    SELECT nast~kschl,
...
      JOIN  vbrk
        ON  nast~objky = vbrk~vbeln
       and vbrk~draft  = @space
...
      INTO TABLE @DATA(fetched_rows).

Change 2:

    SELECT nast~kschl,
...
      WHERE vbrk~vbeln IN @selection-fakt_nr
...
      AND   vbrk~draft = @space 
      INTO TABLE @DATA(fetched_rows).

Any ideas why this check still produces a finding?

Thanks
~Enno

Sandra_Rossi
Active Contributor
0 Kudos

It's that old weird behavior of LEFT JOIN on a table with INNER JOIN which makes the inner join behave like a left join.

(in your case, VBPA)

Accepted Solutions (0)

Answers (0)