Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with XVBUV and not able to trigger In-completion log

0 Kudos

Hi Folks!!!

Currently working on a AFS (Apparels & Footwear) System and i have a requirement on in-completion log. Facing this issue when creating Sales order/Quotation.

Case 1. When there are no line items then Incompletion log should trigger

Case 2. When an item is entered in 'AFS Item Overview' tab and when clicked on 'Matrix entry' and enter required qty in the grid. Trigger incompletion log when there is an invalid grid ie when there is a reason for rejection.

I have added a field ZNOITEM to VBAK and added code to USEREXIT_SAVE_DOCUMENT_PREPARE for Case 1. And added ZRES_REJ to VBAK and added code to USEREXIT_SAVE_DOCUMENT_PREPARE for Case 2.

vbak-znoitem  = space.
vbak
-zres_rej = space.

IF t180-trtyp = 'H' OR
   t180
-trtyp = 'V'  OR
   t180
-trtyp = 'A'.

* select records for order type found in ZPARAMETERS table
 
SELECT *
   
FROM ZPARAMETERS
   
INTO TABLE lt_param1
   
WHERE program_name = 'TEST_PROGRAM' AND
          field_value  = 'ZOR'.
 
IF sy-subrc = 0.
   
IF xvbap[] IS NOT INITIAL.
      lt_xvbap_item[]
= xvbap[].
     
DELETE lt_xvbap_item WHERE updkz = 'D'.
* Check if there are items selected for deletion
     
IF lt_xvbap_item[] IS INITIAL.
        vbak
-zzitem = space.
     
ELSE.
        vbak
-zzitem = 'X'.
* Clear from incompletion log if exits
       
READ TABLE xvbuv ASSIGNING <ls_xvbuv1>
       
WITH KEY vbeln = vbak-vbeln
                 tbnam
= 'VBAK'
                 fdnam
= 'ZNOITEM'.
       
IF sy-subrc = 0.
* Delete the Entry from standard Incompletion table if exists
         
DELETE xvbuv INDEX sy-tabix.
       
ENDIF.

* Check if any of the schedule line has reason for rejection
        lt_xvbep_item
= xvbep[].
       
DELETE lt_xvbep_item WHERE updkz = 'D'.
* Check if there exists any schedule line items
       
IF lt_xvbep_item[] IS NOT INITIAL.
         
LOOP AT lt_param1 ASSIGNING <ls_param1> WHERE field = 'J_3AABGRU'.
* Check for reason for rejection entries
           
READ TABLE lt_xvbep_item TRANSPORTING NO FIELDS WITH KEY j_3aabgru = <ls_param1>-field_value2.
           
IF sy-subrc = 0.
              vbak
-zzscl_rej = 'X'.
             
EXIT.
           
ENDIF.
         
ENDLOOP.
         
IF vbak-zzscl_rej NE 'X'.
           
READ TABLE xvbuv ASSIGNING <ls_xvbuv1> WITH KEY vbeln = vbak-vbeln
                                                            tbnam
= 'VBAK'
                                                            fdnam
= 'ZREA_REJ'.
           
IF sy-subrc = 0.
* Delete the Entry from standard Incompletion table if exists
             
DELETE xvbuv INDEX sy-tabix.
           
ENDIF.
         
ENDIF.
       
ENDIF.
      ENDIF.
   
ELSE.
* When there are no items
      vbak
-zzitem = space.
   
ENDIF.
 
ENDIF.
ENDIF.

Issue with XVBUV[]:

1. When i try to SAVE order with line items i can see ZNOITEM, ZREA_REJ are available in XVBUV[] in USEREXIT_SAVE_DOCUMENT_PREPARE and in-completion log is triggered for both the fields.

2. When an item is entered in 'AFS Fast entry' and click on enter in key board and go to 'AFS Item Overview' tab, when clicked on 'Matrix entry' and enter required qty in the grid and press back (F3). The item has an invalid Grid value and hence it contains reason for rejection

    Click on SAVE button. Now there are no entries in XVBUV[] and not triggering in-completion log.

Note: 1. User may enter item in 'AFS Fast entry' or 'AFS Item Overview' and Matrix Grid is available in 'AFS Item Overview' tab.

           2. ZPARAMETER table contains the entries with the order type and reason for rejection entries. And respective custom fields are configured in OVA2 and other required required config. are done.

Thanks in advance!!!!

2 REPLIES 2

0 Kudos

Hi,

The issue is resolved. Thank you!!!

0 Kudos

Would you mind sharing the solution so that others with the same issue get that benefit?

Thanks

Rob