Quantcast
Channel: ABAP Development
Viewing all articles
Browse latest Browse all 948

Adding Incompletion log entries to Incompletion Log Internal Table XVBUV

$
0
0

The in-completion log reminds you when data important for further processing is missing from the sales document.


When you enter a sales document, the system usually proposes much of the necessary data from customer and material master records, and you can also enter additional data or change proposed data manually. The sales document then forms the basis for various subsequent functions, such as delivery processing and billing.


However, subsequent functions can often only be carried out if the data in the original sales document is complete. To guarantee completeness, the system logs all missing data in an in-completion log. The data needed to process subsequent functions is defined by your system administrator for each sales document type.


Path for finding Incomplete Procedures:

IMG -> Sales and Distribution -> Basic Functions -> Log of Incomplete Items or Go to T-code OVA2


1. The incompletion log have block at following in-completion groups

  • Sales - Header
  • Sales - Item
  • Sales - Sched. Line
  • Partner
  • Sales Activity
  • Delivery header
  • Delivery item



   Screen Shot - 1

Groups.png



2. Each in-completion group may have set of incomplete procedures/Error procedures.


   Screen Shot - 2

Procedures.png



3. Consider Incomplete Procedure ‘Z1’ and go to ‘Fields'

  

    Screen Shot – 3

Fields.png



  • ‘Fields’ of the Procedure contains following fields

      1. Table: - Specifies the table in which the field exists.

      2. Field name: - Specifies the Field name in the table.

      3. Description: - Description of the field (The error log message that displays during the Incompletion Log)

      4. Screen: - The function code displays the screen on which we can enter the incomplete data.

      5. Status Group: - Specify the corresponding status group.

      6. Warning: - Checking this field the system gives a warning when the user does not make an entry in the required field.

      7. Sequence: - Determines the sequence in which the system checks for the incomplete fields.



  • ‘Status Group Controls’ which subsequent documents can be blocked for processing, if the data in the mandatory field is missing.

    

    Screen Shot – 4

Status Group.png

Here if we check delivery we cannot create the delivery document if the data in the mandatory field is missing to which this status group is       assigned.



Consider an example how to add In-completion Log entries to the In-completion Log Internal Table


Based on a business logic/requirement user wants to display an in-completion message avoiding the order to be deliverable.


Consider field ZZBUYGRP which is not a screen field and appended to table VBAK. Whole idea of in-completion log is if certain field is blank system prompts us to fill that field before saving an order.


FromScreen Shot – 3 the field ZZBUYGRP is defined with description ‘Buying Group Approval’ under Sales Header Group. An in-completion log message ‘Buying Group Approval’ should trigger for missing Buying Group approval and when the document is saved with in-completion status then in general fields VBUK-UVVLK and VBUK-UVALLis set to ‘A’.


  

   Screen Shot – 5

Incompletion Log.png


And if the certain field is not blank then in-completion log message should not trigger setting fieldsVBUK-UVVLK& VBUK-UVALL to ‘C’ and SAP thinks the order is deliverable as the field VBAK-ZZBUYGRP assigned to Status Group 02 as per the Screen Shot – 4.


As a standard convention VBAK-ZZBUYGRP = ‘X’ when certain field is not blank which means there exists no In-completion log and VBAK-ZZBUYGRP = space when certain field is blank.


Since the In-completion log has to be triggered at Sales Header level, add the below code under all valid USER Exit inside MV45AFZZ.


* Set initial Values
vbak
-zzbuygrp    = ‘X’.

* For Create and Change

IF t180-trtyp = ‘H’ OR t180-trtyp = ‘V’
OR t180-trtyp = ‘A’.

* Only for Sales Document
IF vbak-vbtyp = ‘C’.

    IF (certain field) is not blank.

      CLEAR vbak-zzbuygrp.

    ELSE.

      vbak-zzbuygrp = ‘X’.

* Clear from incompletion log if exits.
READ TABLE xvbuv ASSIGNING <ls_xvbuv> WITH KEY vbeln = vbak-vbeln

                                                                                               tbnam = 'VBAK'

                                                                                               fdnam = 'ZZBUYGRP'.

      IF sy-subrc = 0.

* Delete the Entry from standard Incompletion table

        DELETE xvbuv INDEX sy-tabix.

      ENDIF.

    ENDIF.

ENDIF.

ENDIF.


Even if the certain field is not having value and the In-completion log is not triggering & this is due to record with respect to the ‘ZZBUYGRP’ doesn’t exist in the In-completion Log internal table, XVBUV.


Check all other possible User Exit available in MV45AFZZ. If still the In-completion log is not triggering even the certain field is blank, add the below code adding in-completion log entry to the In-completion Log internal table XVBUV.


Field TVAK-FEHGR willcarry the Error Procedure (Z1) inside MV45AFZZ and using Error procedure, Z1 get all the records defined inside the ‘Fields’ as shown in Screen Shot – 3 using Table TVUVF.


DATA: ls_tvuvf TYPE tvuvf.

* Set initial Values
vbak
-zzbuygrp    = ‘X’.

* For Create and Change

IF t180-trtyp = ‘H’ OR t180-trtyp = ‘V’
OR t180-trtyp = ‘A’.

* Only for Sales Document
IF vbak-vbtyp = ‘C’.

    IF (certain field) is not blank.

      CLEAR vbak-zzbuygrp.

      READ TABLE xvbuv TRANSPORTING NO FIELDS WITH KEY vbeln = vbak-vbeln

                                                                                                  tbnam = 'VBAK'      

                                                                                                            fdnam = 'ZZBUYGRP'.

      IF sy-subrc <> 0.

        SELECT SINGLE *

             FROM tvuvf

             INTO ls_tvuvf

             WHERE fehgr = tvak-fehgr

             AND   tbnam = 'VBAK'

             AND   fdnam = 'ZZBUYGRP'.

        IF sy-subrc = 0.

          xvbuv-mandt = sy-mandt.
          xvbuv
-vbeln = vbak-vbeln.
          xvbuv
-tbnam = ls_tvuvf-tbnam.
         xvbuv
-fdnam = ls_tvuvf-fdnam.
         xvbuv
-fehgr = tvak-fehgr.
         xvbuv
-statg = ls_tvuvf-statg.
         xvbuv
-msgkz = ls_tvuvf-msgkz.
         xvbuv
-sortf = ls_tvuvf-sortf.

         APPEND xvbuv.

      ENDIF.

    ENDIF.

ELSE.

      vbak-zzbuygrp = ‘X’.

* Clear from incompletion log if exits.
     
READ TABLE xvbuv ASSIGNING <ls_xvbuv> WITH KEY vbeln = vbak-vbeln

                                                                                                     tbnam = 'VBAK'

                                                                                                     fdnam = 'ZZBUYGRP'.

      IF sy-subrc = 0.

* Delete the Entry from standard Incompletion table

        DELETE xvbuv INDEX sy-tabix.

      ENDIF.

   ENDIF.

ENDIF.

ENDIF.


Tcode's related to In-completion Log

Tcode

Description

OVA2

To define incompletion procedure

VUA4

To assign incompletion procedure to delivery type

VUPA

To assign incompletion procedure to Partner functions

VUC2

To assign incompletion procedure to Sales Activities

OVA0

To define Status groups

VUA2

To assign incompletion procedure to Sales Document Header

  V.02

Execute to get a checklist of incomplete sales orders

VUA2

To set a warning or error message on document save

VUP2

To assign incompletion procedure to Sales item category

VUE2

To assign incompletion procedure to Schedule line category


Key tables to check Incompletion Logs

Tables

Description

VBUV

Incompletion log - Sales documents

VBUK

Header incompletion

VBUP

Item incompletion

TVUVG

Groups

V50UC

Incompletion log − Deliveries

V50UC_USER

Incompletion log − Deliveries − Enhancements

TVUV

Procedures

TVUVF

Fields

TVUVS

Status groups

TVUVFC

Fcodes

FMII1

Funds Management Account Assignment Data


Viewing all articles
Browse latest Browse all 948

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>