Академический Документы
Профессиональный Документы
Культура Документы
Category) in S/4HANA
Cookbook for Field Length Extension of VBTYP (Sales Document Category) in S/4HANA ...................... 1
Overview.............................................................................................................................................. 3
Constants ............................................................................................................................................. 3
Identify affected Objects and Source Code ......................................................................................... 4
Adaption of DDIC Elements ................................................................................................................. 6
Views: .............................................................................................................................................. 6
Data Elements ................................................................................................................................. 6
Tables and Structures ...................................................................................................................... 6
Archive Informationsystem ................................................................................................................. 6
Adaptation of VBTYP in generated structure tables ....................................................................... 7
How to find and check all related artefacts .................................................................................... 7
Adaption of Source Code..................................................................................................................... 9
Classes, Includes, Functions, Reports .............................................................................................. 9
Interfaces ....................................................................................................................................... 10
External Interfaces (BAPIs, RFC Function Modules, IDOCs) .............................................................. 11
BAPIs .............................................................................................................................................. 11
Released RFC Function Modules ................................................................................................... 16
IDOCs ............................................................................................................................................. 16
Appendix 1 - List of Constants and Utility Methods for VBTYP: ............................................................ 19
Document History
In some tables, such asVBRK, 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 interface
IF_SD_DOC_CATEGORY. For combinations of VBTYP values, the constants are collected as methods
in class CL_SD_DOC_CATEGORY_UTIL.
See Appendix 1 for a detailed list containing the constants and the corresponding replacement.
Identify affected Objects and Source Code
For detailed information on how to identify which of your custom code objects might need to be
adapted in order to be compatible with SAP S/4HANA, please refer to
The current cookbook describes how to handle those findings of the SAP S/4HANA custom code
check in ABAP Test Cockpit (ATC), which are labeled as being related to SAP note 2198647, with the
focus on the SD document category (VBTYP).
Coding related to the SD document category can be identified by the ATC check if repository
elements are referenced which are marked in the transition database for incompatible model
changes, e.g. data element VBTYP. Usage of constants of the former include RVVBTYP will also be
detected because the content of the Include RVVBTYP was removed.
Sometimes coding related to the SD document category used neither references to repository
elements (but e.g. local variables of type C(1)) nor constants from Include RVVBTYP but rather literals
to denote single values or an enumeration of values like ‘CEFHIW’ (order-like).
An additional possibility to find this type of coding is the report RS_ABAP_SOURCE_SCAN. One
advantage of the report is that it can also search in code comments.
You can e.g. search by using the names of own data elements that belong to domain ‘VBTYP’. For
example, if a data element has the name SD_DOC_TYPE, use this string as the search term. In the
result list of the report you can directly navigate to the source code. If you are expecting a huge
number of results, the report can be executed in the background.
Adaption of DDIC Elements
Views:
Views don’t need to be considered because, due to the change of the underlying table
structure, the view automatically receives the correct data type.
Data Elements
Before you adapt a DDIC Element, first adapt the referenced implementations first (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.
Old New
VBTYP VBTYPL
VBTYP_N VBTYPL_N
VBTYP_V VBTYPL_V
Archive Informationsystem
The field catalogs of the SD archiving objects for the archive informationsystem also contain the field
VBTYP of the document header tables, e.g. LIKP-VBTYP in field catalog SAP_RV_LIKP_001.
This stays unchanged in S/4HANA.
As long as the structure table refers to the short data element VBTYP deletion programs like
S3LIKPDLS will abort with an error message due to the type mismatch to LIKP-VBTYP.
The generated structure table must also be adapted by the customer.
However, it is not necessary to delete and regenerate the table for the VBTYP adaptation. This would
make it necessary to fill the infostructure again which might lead to long runtimes.
Although ZARIXSD23 is generated by the ADK tools (transaction SARI) it is also possible to adjust the
DDIC structure manually with respect to the data element VBTYP:
After the activation the generated report program that displays the list for the archive infostructure
should work fine automatically because it refers to the type of the structure field.
The selection screen should be regenerated automatically with the longer VBTYP field.
Also the deletion programs should work fine again as the types of the original field (e.g. LIKP-VBTYP)
and of the field ZARIXSD23-VBTYP do match now.The related data class is not affected.
F4 on the next field “Archive Infostructure” shows all active infostructures for this archiving object,
e.g. Z_DRB_RV_LIKP_2.
Copy the name of this archive infostructure. In transaction SARI choose ‘Customizing’, enter the
name of the archive infostructure -> Display
Press ‘Technical Data’:
Adaption of Source Code
Check and adapt data declaration with the correct data element:
i. Old: DATA: lc_vbtyp_wa(1) TYPE c.
ii. New: DATA: lc_vbtyp_wa LIKE likp-vbtyp.
iii. Fallback: If no corresponding data element is found, make the declaration with data
element VBTYPL (DATA: lc_vbtyp_wa TYPE vbtypl.)
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
External Interfaces (BAPIs, RFC Function Modules, IDOCs)
In new releases of SAP ERP, changes to external interfaces must be compatible with previous
releases. This compatibility approach holds true for BAPIs, released RFC function modules, and
IDOCs.
To facilitate a smooth conversion, and to support interoperability of S/4HANA with other SAP
solutions such as SAP ERP, SAP CRM, and so on, external interfaces in S/4HANA are kept compatible
with SAP ERP.
The data transfer in RFC calls and IDOC containers is based on binary parameter structures. Changes
or enhancements to these structures in a newer release or support package must keep the order and
length of existing fields identical.
Parameters of BAPI function modules, or of released RFC function modules that contain one or more
fields of type sales-document category, are extended (at their respective ends) with additional
_LONG fields. The original, short-length fields are kept in the structures as they are.
IDOC segments that contain one or several fields of type sales document category are extended (at
their respective ends) with additional _LONG fields. The original, short-length fields remain
unchanged.
BAPIs
BAPI_BILLINGDOC_GETDETAIL
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 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.
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 is 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
is derived from context information.
Example: In the BAPI BAPI_CUSTOMERRETURN_CHANGE, the parameter RETURN_HEADER_IN is of
type BAPISDHD1, which contains the field SD_DOC_CAT. Because the SD document category of a
customer return is a fixed value (IF_SD_DOC_CATEGORY=>RETURNS = ‘H’), changes to the field
SD_DOC_CAT or SD_DOC_CAT_LONG are ignored.
The original field is kept, along with the original data type (VBTYP, Char1), and an additional _LONG
field has been added to the end of the structure.
Note that this does not apply for non-released function modules.
For non-released function modules, the adaption pattern was chosen depending on the usage of the
function module in SAP-SAP integration scenarios.
For cases in which a function module is used in integration scenarios between different SAP
solutions, a compatible enhancement has been implemented to decouple the transformation to
S/4HANA from adaptions in other SAP solutions.
If a function module is not used in such integration scenarios, it may have been adapted in a way that
makes it incompatible with SAP ERP. In this case, all usages within the ERP components of S/4HANA
have been adapted accordingly.
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:
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.
E2BPSDHD1000
E2BPSDHD1001
E2BPSDHD1002
E2BPSDHD1003:
and child segment E1BPSDHD11 with versions
E2BPSDHD11000
E2BPSDHD11001:
Appendix 1 - List of Constants and Utility Methods for VBTYP:
cl_sd_doc_category_util=>is_any_sales_or_distributio ABCDEFGHIJKLMNOPSTU
vbtyp_vert n( iv_vbtyp = WX012345678rstuwx