Application Development and Automation 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: 
Read only

Facing Problem when try to restrict multiple condition type using MV45AFZZ

Former Member
0 Likes
461

Dear All,

I am trying to restrict multiple condition type using Include MV45AFZZ.


It is working and we are also getting error message on click of SAVE button also.


But then when we press enter it is cumming out of tcode instead of going to edit mode.


Kindly help me to solve this.


"""""" Codding we have done for reference """""


Include MV45AFZZ

FORM USEREXIT_SAVE_DOCUMENT

Data: lv_cnt1 type i,

         lv_cnt2 type i,

         it_temp type table of komv.

CHECK  sy-tcode = 'VA01'  AND    VBAK-AUART = 'ZPS'  AND NOT xkomv[] IS INITIAL.

  

it_temp[] = xkomv[].

sort it_temp by kschl.

delete adjacent duplicates from it_temp comparing kschl.

lv_cnt1 = lines( it_temp ).

lv_cnt2 = lines( xkomv ). 

if lv_cnt1 NE lv_cnt2.

     message 'Duplicate entries exit' type ‘E’.

endif.


Thanks & Regards,

Dhaval Raval



Dear All,

I am trying to restrict multiple condition type using Include MV45AFZZ.


It is working and we are also getting error message on click of SAVE button also.


But then when we press enter it is cumming out of tcode instead of going to edit mode.


Kindly help me to solve this.


"""""" Codding we have done for reference """""


Include MV45AFZZ

FORM USEREXIT_SAVE_DOCUMENT

Data: lv_cnt1 type i,

         lv_cnt2 type i,

         it_temp type table of komv.

CHECK  sy-tcode = 'VA01'  AND    VBAK-AUART = 'ZPS'  AND NOT xkomv[] IS INITIAL.

  

it_temp[] = xkomv[].

sort it_temp by kschl.

delete adjacent duplicates from it_temp comparing kschl.

lv_cnt1 = lines( it_temp ).

lv_cnt2 = lines( xkomv ). 

if lv_cnt1 NE lv_cnt2.

     message 'Duplicate entries exit' type ‘E’.

endif.


Thanks & Regards,

Dhaval Raval



1 REPLY 1
Read only

RaymondGiuseppi
Active Contributor
0 Likes
434

Read documentation in include source and online documentation and some (of many) threads in scn, you aren't allowed to update or even check data in this form, use USEREXIT_SAVE_DOCUMENT_PREPARE


  • USEREXIT_SAVE_DOCUMENT_PREPARE

Use this user exit to make certain changes or checks immediately before saving a document. It is the last possibility for changing or checking a document before posting.

Reference: User Exits in SalesUser Exits In Sales Document Processing

Regards,

Raymond