13.12.10

SAP Note 12905 - Field check and field texts in condition tables

Symptom:

For a field in a condition table, the system does not carry out a check against the check table and it does not display the description from the corresponding text table.

The automatic check and text determination for material determination, listing/exclusion, profile determination, and batch determination are implemented in Release 4.0 which is successful in most cases. If not, see Note 354807.

As of Release 4.6A, the automatic check and text determination is implemented for text determination, pricing conditions, and message conditions. However, this requires a foreign key relationship or fixed values to be stored in the DDIC beforehand. If necessary, you still have to program a special logic. For this, refer to Note 325551 to avoid modifications as of Releae 4.6.

Other terms

Condition, field, condition field, check, text
CO-PA, valuation, KE41, KE42, KE43, KE47, VK11, VK12

Reason and Prerequisites

Fields for which there are no check routines have been allowed for condition tables.

Solution

A new check routine must be programmed for the new field.

The method for implementing such a check routine is explained using the following example: Field ZZPRO5 is selected as the new field, which should consist of the first 5 digits of the product hierarchy.

Caution: This is a modification which has to be checked again for each release/maintenance level. The modification is only intended for use by experienced developers.

    1. Create Include MV13AFYY and add Include MV13AFYY at the end of program SAPMV13A.
    2. Create check module KOMG-ZZPRO5. The module is added to Include MV13AFYY:

    *---------------------------------------------------------------------*
    * MODULE KOMG-ZZPRO5 *
    *---------------------------------------------------------------------*
    * Pruefen der Produkthierarchie (Stelle 1 - 5) *
    *---------------------------------------------------------------------*
    MODULE KOMG-ZZPRO5.
    PERFORM KOMG-ZZPRO5 USING YES READ_SUBRC.
    ENDMODULE.
    3. Create FORM routine KOMG-ZZPRO5. The FORM routine is also included in MV13AFYY.

    *---------------------------------------------------------------------*
    * FORM KOMG-ZZPRO5 *
    *---------------------------------------------------------------------*
    * Prüfen der Produkthierarchie (stelle 1 - 5 ) *
    *---------------------------------------------------------------------*
    * --> KV_ERROR : Fehlermeldung falls Prod.Hiera. nicht vorhanden *
    * --> KV_SUBRC : Returncode, falls keine Fehlermeldung angefordert *
    *---------------------------------------------------------------------*
    FORM KOMG-ZZPRO5 USING KP_ERROR KP_SUBRC.
    * Reset Returncode
    CLEAR KP_SUBRC.
    * Löschen aktiv ?
    PERFORM DELETE_INDICATOR_SET.
    * Keine Prüfung beim Löschen
    CHECK DELETE_INDICATOR = NO.
    * Produkthierarchie gerade gelesen ?
    IF KOMG-ZZPRO5 = T179-PRODH(5) AND
    T179-PRODH+5 = SPACE.
    EXIT.
    ENDIF.
    * Initialisieren der Workarea
    IF KOMG-ZZPRO5 EQ SPACE.
    CLEAR: T179, T179T.
    EXIT.
    ENDIF.
    * Lesen der Kundengruppen-Tabelle
    SELECT SINGLE * FROM T179 WHERE PRODH EQ KOMG-ZZPRO5.
    IF SY-SUBRC NE 0.
    CLEAR: T179, T179T.
    * Ausgabe einer Fehlermeldung ?
    IF KP_ERROR = YES.
    MESSAGE E033 WITH KOMG-ZZPRO5.
    ELSE.
    KP_SUBRC = SY-SUBRC.
    EXIT.
    ENDIF.
    ENDIF.
    * Lesen der Bezeichnung
    SELECT SINGLE * FROM T179T WHERE SPRAS EQ SY-LANGU
    AND PRODH EQ KOMG-ZZPRO5.
    IF SY-SUBRC <> 0.
    CLEAR T179T.
    ENDIF.
    ENDFORM.
    4. Activating the check routine for the selection report

    Add the following source code to Include MV13AKOM in routine FELD_PRUEFUNG at the end of CASE line "CASE FP_FELDNAME." (however, before the WHEN OTHERS statement which exists in some releases):

    CASE FP_FELDNAME.
    ...
    ...
    WHEN 'ZZPRO5'. PERFORM KOMG-ZZPRO5 USING FP_ERROR FP_SUBRC. "<--
    ENDCASE.
    5. Adding the text to the internal text table

    Enter the following source code in Include MV13AKOM, routine FILL_DEFAULT at the end of CASE line "CASE FD_FIELD." (again before a WHEN OTHERS statement):

    CASE FD_FIELD.
    ...
    ...
    WHEN 'ZZPRO5'. MOVE T179T-VTEXT TO TEXT_DEFAULT-TEXT. "<--
    ENDCASE.
    6. Transferring the text from the internal text table

    Enter the following source code in Include MV13AKOM, routine GET_TEXT at the end of CASE line "CASE TEXT_ERFASSUNG":

    CASE TEXT_ERFASSUNG.
    ...
    ...
    WHEN 'ZZPRO5'. MOVE TEXT_DEFAULT-TEXT TO T179T-VTEXT. "<--
    ENDCASE.
    7. Including the text field for screen generation

    Enter the following source code in Include MV13AKOM, routine "GET_TEXT_FIELD" at the end of CASE line "CASE GTF_FIELD".

    CASE GTF_FIELD.
    ...
    ...
    WHEN 'ZZPRO5'. "<--
    GTF_TEXT_TABELLE = 'T179T'. "<--
    GTF_TEXT_FIELD = 'VTEXT'. "<--
    ENDCASE.
    8. Adding the SPA/GPA parameter

    The parameter is set in the Data Dictionary as follows:
    In Transaction SE11, view of structure KOMG, double-click on the component type (data element) of field ZZPRO5. Switch to the change mode and enter a parameter ID of up to 20 characters on the Attributes tab. Then check and activate the structure. It is supposed that ZZZ is the SPA/GPA parameter for field ZZPRO5.

    Enter the following source code in Include MV13AKOM, routine GET_PARAMETER at the end of CASE line "CASE GP_FIELD".

    CASE GPF_FIELD.
    ...
    ...
    WHEN 'ZZPRO5'. "<--
    * Parameter holen "<--
    IF KOMG-ZZPRO5 IS INITIAL. "<--
    GET PARAMETER ID 'ZZZ' FIELD KOMG-ZZPRO5. "<--
    ENDIF. "<--
    * Text zum Parameter lesen "<--
    IF NOT KOMG-ZZPRO5 IS INITIAL. "<--
    PERFORM KOMG-ZZPRO5 USING NO READ_SUBRC. "< --
    ENDIF. "<--
    ENDCASE.
    9. (Optional) Adding a CLEAR statement to ERFASSUNG_INITIALISIEREN (MV130F0E)
    ...
    form erfassung_initialisieren using ei_kvewe ei_kappl ei_kschl
    ei_datab ei_datbi ei_kalid.
    ...
    * Die Prueftabellen clearen sonst wird nicht in der Steploopzeile neu
    * gelesen
    if call_modus = space.
    clear: vtcom, kukon,
    mtcom, *mtcom,
    ...

    ...
    tskm,
    komg-waerk.
    * <<<<<<<<<<<<<<<< START OF INSERT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    * Optional, only if the table considered is not included in the
    * CLEAR statement above!
    CLEAR: T179.
    * <<<<<<<<<<<<<<<< END OF INSERT << < <<<<<<<<<<<<<<<<<<<<<<<<<<
    endif.
    * Erste Zeile der Schnellerfassung zurücksetzen.
10. (Optional) Adding a Tables statement to MV130COM (only if the Tables statement does not yet exists for the corresponding tables)
...
* Tabellen für Prüfungen
* <<<<<<<<<<<<<<<<<< START OF INSERT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
TABLES: T179, T179T.
* <<<<<<<<<<<<<<<<<< END OF INSERT < <<<<< <<<<<<<<<<<<<<<<<<<<<<<<
tables:
t003o, t003p, *t003o, *t003p,
t005, t005t, *t005, *t005t,
...

Key word: Condition

No comments:

Post a Comment