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: 

Problem with VA01 User Exit

Former Member
0 Kudos
106

I have put a USer Ecit on VA01 that user will not enter more than 70 line items in Sale Order. i have put this in MV45AFZZ in form


*---------------------------------------------------------------------*
*       FORM USEREXIT_SAVE_DOCUMENT_PREPARE                           *
*---------------------------------------------------------------------*
*       This userexit can be used for changes or checks, before a     *
*       document is saved.                                            *
*                                                                     *
*       If field T180-TRTYP contents 'H', the document will be        *
*       created, else it will be changed.                             *
*                                                                     *
*       This form is called at the beginning of form BELEG_SICHERN    *
*                                                                     *
*---------------------------------------------------------------------*
FORM userexit_save_document_prepare.
  DATA : vl_line TYPE i.

  DESCRIBE TABLE xvbap LINES vl_line.

  IF vl_line > 70.
    MESSAGE e063(zsd).
  ENDIF.

ENDFORM.                    "USEREXIT_SAVE_DOCUMENT_PREPARE

The Error comes when I enter more than 70 items, but when I delete the line items and make it to 70 items, then also the error comes when debugging i found that the no. of items which i have deleted are not deleted from XVBAP table.

can any one tell wat's missing here.

abhishek suppal

1 ACCEPTED SOLUTION

christian_wohlfahrt
Active Contributor
0 Kudos
71

Hi Abhisehk!

I'm not online, so I can't tell you exact name, but in last 20 fields somewhere is an update flag. This changes to D (I guess) in case of line deletion -> internal table is as full as before, but less entries will be created.

<b>Don't delete entries in xvbap!</b>

Just make a small test, delete and change some lines (not necessarily 70) and have a look in which value they differ in xvbap.

Later you just have to count the insert lines (in loop where).

Regards,

Christian

3 REPLIES 3

venkata_ramisetti
Active Contributor
0 Kudos
71

Hi,

You may write code like below...

FORM userexit_save_document_prepare.

DATA : vl_line TYPE i.

DESCRIBE TABLE xvbap LINES vl_line.

IF vl_line > 70.

LOOP AT XVBAP FROM 70.

DELETE XVBAP.

ENDLOOP.

MESSAGE e063(zsd). ENDIF.ENDFORM. "USEREXIT_SAVE_DOCUMENT_PREPARE

christian_wohlfahrt
Active Contributor
0 Kudos
72

Hi Abhisehk!

I'm not online, so I can't tell you exact name, but in last 20 fields somewhere is an update flag. This changes to D (I guess) in case of line deletion -> internal table is as full as before, but less entries will be created.

<b>Don't delete entries in xvbap!</b>

Just make a small test, delete and change some lines (not necessarily 70) and have a look in which value they differ in xvbap.

Later you just have to count the insert lines (in loop where).

Regards,

Christian

0 Kudos
71

thanx Christian

abhishek suppal