Skip to Content
3
May 02, 2019 at 02:17 PM

Is it okay to already make use of interface IF_SD_DOC_CATEGORY in NW 7.50 to query VBTYP?

619 Views Last edit May 03, 2019 at 06:04 AM 2 rev

Hi Folks,

I’m currently working on a small code-change (in NW 7.50 SP13) which involves selecting data from table VBFA based on VBTYP. In parallel, I’m reading some S/4HANA-Cookbooks related to the SD-simplifications, one of which is the extension of VBTYP from 1 to 4 characters (Note 2198647). In that Cookbook, interface IF_SD_DOC_CATEGORY is mentioned and I noticed that this is already available in our system. So, I quickly changed my code from literals to the corresponding associated types in that interface which gives me the same results as before when I run the program:

     SELECT DISTINCT vbfa_ls~vbeln   AS vbeln
                     vbfa_ls~vbtyp_n AS vbtyp_n_rg
                     vbfa_ls~vbtyp_v AS vbtyp_v_ls
                     vbfa_ls~vbelv   AS vbeln_ls
                     vbfa_tr~vbtyp_n AS vbtyp_n_tr
                     vbfa_tr~vbtyp_v AS vbtyp_v_tr
                     vbfa_tr~vbeln   AS vbeln_tr
                FROM vbfa AS vbfa_ls
                LEFT OUTER JOIN vbfa AS vbfa_tr
                  ON vbfa_tr~vbelv   EQ vbfa_ls~vbelv
                 AND vbfa_tr~vbtyp_n EQ IF_SD_DOC_CATEGORY=>SHIPMENT
*                 AND vbfa_tr~vbtyp_n EQ '8'   "Transport
                INTO CORRESPONDING FIELDS OF TABLE gt_vbfa_v
                 FOR ALL ENTRIES IN gt_main
               WHERE vbfa_ls~vbeln   EQ gt_main-vbeln
                 AND vbfa_ls~vbtyp_n EQ IF_SD_DOC_CATEGORY=>INVOICE
*                 AND vbfa_ls~vbtyp_n EQ 'M'   "Rechngung
                 AND vbfa_ls~vbtyp_v EQ IF_SD_DOC_CATEGORY=>DELIVERY.
*                AND vbfa_ls~vbtyp_v EQ 'J'.  "Lieferung

I just did a where-used on the interface and see that it gets used quite a bit in SAP-code but I don’t see any mentions yet in our custom-code.

So, I’m wondering if this is okay to already make use of in our own code and whether or not it would make things at least a little bit easier once we actually do a conversion to S/4HANA?

If this is something we can/should already use esp. for new code or changes to existing logic relying on VBTYP, I’ll get the word out to our developers to switch from literals and/or our own constants to these associated types from the interface. Come to think of it, I could perhaps also include this as an additional ATC-check as it's then something already fixable today and doesn't hinge on the system being on S/4HANA.

Thanks and Cheers

Bärbel

P.S.: I first put this question as a comment to Olga Dolinskaja's helpful blog post from 2017 about the custom code adaptation process, but then thought that it might perhaps be of wider interest and therefore converted it to this question.