SAP ABAP IMG Activity PRODUCT_SET (Define Consistency Check (Save))
Hierarchy
SAP_ABA (Software Component) Cross-Application Component
   AP-MD-PRO (Application Component) Central Part of Product Master
     COM_PRODUCT_CUST (Package) Product Master Customizing - General
IMG Activity
ID PRODUCT_SET Define Consistency Check (Save)  
Transaction Code S_A4C_68001101   IMG Activity: PRODUCT_SET 
Created on 20010601    
Customizing Attributes PRODUCT_SET   Define Consistency Check (Save) 
Customizing Activity PRODUCT_SET   Define Consistency Check (Save) 
Document
Document Class SIMG   Hypertext: Object Class - Class to which a document belongs.
Document Name PRODUCT_SET    

Use

This enhancement can be used to define your own cross-client checks that you would like to be performed before a product can be saved.

This enhancement contains the method CHECK_BEFORE_UPDATE, in which you can formulate the check.

When creating a check (implementation), you must specify in the filter the data segment (set type ID) that contains the data fields you want to check.

If a product is rejected, you generate an error message with the:

  • Message type 'E' if the product can only be saved as an inactive version
  • Message type 'A' if the product cannot be saved at all

This message, together with the name of the field, is then placed in the application log in product maintenance. The error message is displayed and you can navigate to the data field that caused the error message with a double-click.

If you wish the field to be displayed in a table control on the screen, you must also specify the line number in the table control when inserting the error message in the application log.

Requirements

The current data and old data of a segment (set type) is passed to the method CHECK_BEFORE_UPDATE in the parameters IT_SETDATA and IT_SETDATA_OLD. They are not assigned a type. So that you can read the individual data fields, you must declare an appropriate work area. In the sample code, this variable is called ls_set.

The data structure required can be determined in the Maintain Set Types and Attributes function by choosing Environment -> Set Type Structures. The data structure is displayed together with the field names it contains. The transaction data fields that can be used for the check are highlighted.

You should create your own message to describe the error situation in the application log. Message 014 from message class COM_PRODUCT, which is used in the example, serves as a template and should not be used in your checks.

Standard settings

Activities

  1. Clicking on the IMG activity starts the BAdI Builder, and a dialog box is displayed with all consistency check implementations (enhancements) that already exist. You can create a new implementation for the definition PRODUCT_SET by choosing Create. Use a name in the customer namespace.
  2. Select the data segment containing the fields for which you want to define the check. To do this, you must first insert an empty entry in the filter settings by choosing Insert Line. The set types (data segments of the product) can be displayed using the possible entries pushbutton. You can re-sort the entries by clicking on the header, or select an entry with a double-click.
  3. The sample code can be used as a template in your implementation. To do this, choose Goto -> Sample Code -> Copy.
  4. You now have to adjust the sample code as you are using another data segment (set types) and formulate your check for other fields. To do this, choose the Interface tab page and select the method CHECK_BEFORE_UPDATE with a double-click. Your method is shown with the sample code in the Class Builder. You must replace the data structure of the work area (ls_setdata) and the field names and check conditions. The procedure for finding the name of the data structure for your set type and the field names it contains is described under Requirements. You are advised to start the Maintain Set Types and Attributes function in a separate session so that you can simply copy across the information you require with copy and paste.
  5. Check whether your code contains syntax errors.
  6. Activate the method IF_EX_PRODUCT_SET~CHECK_BEFORE_UPDATE.
  7. Activate the implementation (enhancement).

Example

Further notes

This enhancement contains sample source code which does not allow an active version of the product to be saved if

  • the data field F0010 (Quantity) has the value 0
  • the data field F0011 (Unit of measure) is 'PC'

in the data segment (set type SETTYPE01).

Caution

Note that you are not allowed to make data changes to the code of the implementation (such as deleting data records).

The old data in the set type STATUS is not available in the implementation as the parameter IT_SETDATA_OLD is not supported for this set type. The parameter IV_PRODCUT_GUID is not supported for all set type implementations.

Business Attributes
ASAP Roadmap ID 153   Design enhancements 
Mandatory / Optional 2   Optional activity 
Critical / Non-Critical 2   Non-critical 
Country-Dependency A   Valid for all countries 
Assigned Application Components
Documentation Object Class Documentation Object Name Current line number Application Component Application Component Name
SIMG PRODUCT_SET 0 A4C0000261 Central Part of Product Master 
Maintenance Objects
Maintenance object type E   Business Add-In - Definition 
History
Last changed by/on SAP  20030228 
SAP Release Created in 300