2006 Jan 06 11:21 AM
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
2006 Jan 06 11:38 AM
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
2006 Jan 06 11:33 AM
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
2006 Jan 06 11:38 AM
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
2006 Jan 06 12:23 PM