Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Category) in S/4HANA
Cookbook for Field Length Extension of VBTYP (Sales Document Category) in S/4HANA...................... 1
Overview ........................................................................................................................................ 2
Constants........................................................................................................................................ 2
Identify affected Objects and Source Code ...................................................................................... 3
Adaption of DDIC Elements ............................................................................................................. 4
Views: ......................................................................................................................................... 4
Data Elements ............................................................................................................................. 4
Tables and Structures .................................................................................................................. 4
Adaption of Source Code ................................................................................................................ 5
Classes, Includes, Functions, Reports........................................................................................... 5
Interfaces .................................................................................................................................... 6
External Interfaces (BAPIs, RFC Function Modules, IDOCs) .............................................................. 7
BAPIs........................................................................................................................................... 7
Released RFC Function Modules ................................................................................................ 12
IDOCs ........................................................................................................................................ 12
Overview
This cookbook describes the adaption of custom code related to the field length extension of the
sales document category (data element VBTYP) in S/4HANA.
The sales document category has been extended from Char1 to Char4 in S/4 HANA.
Technically, all usages of the data element VBTYP (Char1) and its derivations like VBTYP_V, VBTYP_N,
and so on, have been replaced by the new data element VBTYPL (Char4), or derivations of the new
data element, such as VBTYPL_V or VBTYPL_N.
The data element VBTYP and its derivations are deprecated, but still exist technically with the old
length Char1.
All usages of the deprecated data elements in custom code have to be adopted as described in this
cookbook.
The field length extension of the sales document category has been implemented in all of S/4HANA.
There are a few single components left that still dont fully support VBTYP with length 4, for example,
ATP here, VBTYP with Length = 1 is still used for reasons of compatibility with APO.
In some tables, such as VBRK, a field VBTYP_EXT with length Char4 was introduced in SAP ERP 6.0
EhP7. This additional field was used to support additional code values for the sales document
category, for example, f001, f002, f003, f004, in component Commodity Management.
In S/4HANA, this additional field has been eliminated from all tables. All code values are stored in the
original table field for VBTYP, which is now longer in SAP S/4HANA.
During the conversion to S/4HANA, the content of both fields is merged automatically into the
extended field VBTYP.
Constants
The constants in the include RVVBTYP have been replaced by a constant in class:
IF_SD_DOC_CATEGORY. For combinations of VBTYP values, the constants are collected as methods
in class CL_SD_DOC_CATEGORY_UTIL. Take a look at the attached Excel document for a detailed list
of the constants and the corresponding replacement.
Microsoft Excel
Worksheet
Data Elements
Before you adapt a DDIC Element, first adapt the referenced implementations (Classes,
Reports, Functions, Includes).
This reduces the number of syntax errors.
If a data element has the domain VBTYP with Length 1 assigned to it, reassign the data
element to the domain VBTYPL with Length 4.
New
VBTYPL
VBTYPL_N
VBTYPL_V
ii. New:
r_vbtyp = cl_sd_doc_category_util=>rg_any_sales( ).
select * from tvkk where vbtyp in r_vbtyp.
LV45LF0S)
POSNV EQ I_POSNV
VBTYP_N CA VBTYP_AUFT
VBTYP_N NA VBTYP_RETOUR
STUFE
EQ 0.
ii. New:
LOOP
AND
AND
AND
AND
Interfaces
Replace constants with the constants from IF_SD_DOC_CATEGORY.
Note: If the constant in an interface is redundant, it can be removed and the consumer can use the
corresponding constant in: IF_SD_DOC_CATEGORY
BAPIs
Outbound Reading data from a BAPI:
Take a look at the following BAPI as an example:
BAPI_BILLINGDOC_GETDETAIL
The export parameter BILLINGDOCUMENTDETAIL is of type BAPIVBRKOUT.
Structure BAPIVBRKOUT contains the field SD_DOC_CAT (SD Document Category).
In S/4HANA, the structure has been extended with field SD_DOC_CAT_LONG.
SAP S/4HANA:
If you call the BAPI from within or from outside the S/4HANA system, you need to consider the
following:
Field SD_DOC_CAT_LONG (Char4) always contains the correct value for the SD document
category.
Field SD_DOC_CAT (Char1) contains the value for the SD document category in all cases
where the code value fits into the length Char1. This ensures compatibility for all short code
values.
If the code value of the SD document category is longer than Char1, the field SD_DOC_CAT
(Char1) is empty.
This applies, for example, for the code values f001, f002, f003, and f004.
It will also apply in future releases, when additional code values will be delivered by SAP.
If you are interested in one or several concrete code values of short length (Char1), you can
still use the field SD_DOC_CAT.
If you are interested in at least one code value with a length that is bigger than Char1, or if
you want to treat all possible values generically, you have to adapt the BAPI call and use the
new field SD_DOC_CAT_LONG.
S/4HANA:
If you call the BAPI from within or from outside the S/4HANA system, you have to consider the
following:
If the field REF_DOC_CA_LONG (Char4) is filled with a valid code value by the caller, it will be
carried over into the document persistency.
If the Field REF_DOC_CA_LONG (Char4) is empty and the field REF_DOC_CA (Char1) is filled
with a valid code value by the caller, the value from REF_DOC_CA will be carried over.
If both fields REF_DOC_CA and REF_DOC_CA_LONG are both filled, the values must be
identical. If they are not, the BAPI returns an error message and does not process the
document.
If your code passes only dedicated values with a short length (Char1), you may still use the
field REF_DOC_CA.
If you need to pass at least one code value with a length bigger than Char1, or if you want to
treat all possible values generically, you have to adapt the access and use the new field
REF_DOC_CA_LONG.
BAPI*X Structures
In most cases, a related BAPI*X structure exists for BAPI structures used in BAPIs that expose
functionality in order to change existing data. The change BAPI contains a pair of parameters, one
with the BAPI structure and a related one with the BAPI*X structure.
For each attribute field in the BAPI structure, the related BAPI*X structure contains a field with the
same name, but with data type BAPIUPDATE (Char1).
This procedure was introduced to enable the identification of cases in which a field value should be
changed to the initial field value, and to distinguish this case from the case in which a field value has
not been specified.
The value X in a field of the BAPI*X structure indicates that the value of the corresponding field in
the parameter typed with the BAPI structure should be applied as a change.
The value SPACE in a field of the BAPI*X structure indicates that no change of the corresponding field
in the parameter typed with the BAPI structure should be applied.
This is the standard behavior of change BAPIs according to the BAPI guidelines.
Fields added to a specific structure BAPI<struc> in S/4HANA are also reflected in the related structure
BAPI<struc>X.
Example: Structure BAPISDHD1X
Structure BAPISDHD1
[There are some differences for the key fields, therefore the number of fields is different.]
The implementation of a change BAPI using parameters with structures BAPISDHD1 and BAPISDHD1X
takes the field pair REFDOC_CAT/REFDOC_CAT_LONG into account if at least one of the two fields in
the structure BAPISDHD1X is filled with X.
This way, new BAPI calls can work with the new field REFDOC_CAT_LONG in the structure
BAPISDHD1X as usual (according to the BAPI guideline).
On the other hand, existing calls that are adapted to the new field REFDOC_CAT_LONG of
BAPISDHD1 still work if the original field REFDOC_CAT in the structure BAPISDHD1X is marked with
the value X. This slightly more robust and error tolerant for callers, because the two fields
REFDOC_CAT and REFDOC_CAT_LONG are treated as a common field pair in the implementation of
the BAPI anyway.
Remark:
BAPI structures for certain Business Objects are often reused for function modules that read data,
and for function modules that change data. Some of the structure fields that are supported and filled
in the read function are not considered in the changing function, for example, because the field value
IDOCs
Enhancements of IDOC segments in S/4HANA have been implemented in a compatible manner,
similar to the extension of BAPIs.
The handling of the field pair in IDOCs is also very similar to the handling of a field pair in a BAPI
structure.
Example:
IDOC type SALESORDER_CREATEFROMDAT2
The IDOC type is generated from BAPI_SALESORDER_CREATEFROMDAT2.
The BAPI contains the BAPI structure BAPISDHD1.
The BAPI structure has been enhanced with the additional fields SD_DOC_CAT_LONG and
REFDOC_CAT_LONG.
In the IDOC segments, the BAPI structure is mapped to a corresponding segment structure.
The ALE container is a generic restricted character field with 1000 characters.
In case the length of the segment structure exceeds 1000 characters, additional fields are generated
into a child segment.
In case of BAPISDHD1, this leads to:
Segment structure E1BPSDHD1 with versions
E2BPSDHD1000
E2BPSDHD1001
E2BPSDHD1002
E2BPSDHD1003: