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

VA01

Former Member
0 Likes
1,680

Hi,

I put the below code in USEREXIT_MOVE_FIELD_TO_KOMKD

<b>TABLES : KOTD011, KOTD001.

DATA V_KNUMH like KOTD001-KNUMH.

select single KNUMH from KOTD011 into V_KNUMH where matnr = VBAP-MATNR

IF SY-SUBRC = 0 .

MESSAGE s901(VU)."Material substitution Exist

else.

MESSAGE s902(VU)." Material substituion Not exist

endif.</b> It's working fine. But this message is still displaying after cursor moved to another input field (that's to get another Material number in Va01).

I want to display this message only " <i>When i give value to material number in VA01 & press enter message should come, after that cursor goes to Quanity field give value & press enter cursor should move to next line to get another material number, this time message should not display."</i>

In which userExit i need to put this code? Am i putting code in wrong place??

15 REPLIES 15
Read only

Former Member
0 Likes
1,618

hi,

you code is fine the USEREXIT also correct just put one more condiation as

data : v_matnr like VBAP-MATNR

if v_matnr ne VBAP-MATNR.

v_matnr = VBAP-MATNR

write your code.

enfif.

this will work fine just check it let me know .

Read only

0 Likes
1,618

The correct place to put you code would be at USEREXIT_MOVE_FIELD_TO_VBAP

In there the field SVBAP-TABIX is 0 when the line item is created and greater than 0 (normally 1) when the line item is changed.

Just put your code between

<b><b>IF SVBAP-TABIX EQ 0.</b></b> and

<b>ENDIF.</b>

Read only

0 Likes
1,618

No. I tried it's not working.

Read only

0 Likes
1,618

No it's also not working. Exactly i need when i put value in Material line item then press enter warning message will come as "Enter quanity". before that message i should display my message. Also once after i put value for Quantity & press enter cursor will go to next item level to get input next material, that time my message should not display.

i tried both code but no effect. It's working same as my first code.......

please guide.........

-subha

Read only

0 Likes
1,618

help me please................

-subha

Read only

0 Likes
1,618

Unless you are in a version higher than 4.6C (my current version, haven't work in higher versions) this should work. Might help if your code is the first thing on the VBAP userexit since other check might interfere.

Try this

IF SVBAP-TABIX EQ 0.

<your message>

ENDIF

That is: without the database read, and we can take it from there.

Read only

0 Likes
1,618

I tried but still it's not working B'cos The SAP standard message for Enter Quantity(warning message VU 001) is Overlapping my message. So it's not coming to display when i give value to Material number & press enter. Also it's still displaying once cursor moved to next item level ....

-subha

Read only

0 Likes
1,618

Hi Subha,

Use the USEREXIT_CHECK_VBAP routine in program MV45AFZB which Sharad had suggested and the code would be like this...

TABLES : KOTD011, KOTD001.
DATA V_KNUMH like KOTD001-KNUMH.
select single KNUMH from KOTD011 into V_KNUMH where matnr = <b>XVBAP-MATNR</b>
IF SY-SUBRC = 0 .
MESSAGE s901(VU)."Material substitution Exist
else.
MESSAGE s902(VU)." Material substituion Not exist
endif.

Pls see if this helps...

Thanks,

Renjith

Read only

0 Likes
1,618

I haven't tried this out, but perhaps changing your message type from 'S' to 'I' will resolve the problem with warning message VU001.

If the warning message is being sent after the success message (but prior to the next screen being displayed) then the success message (which is intended for the next screen) will not be displayed. This is because only one of the messages can be shown on the next screen, and if the 'W' message was sent after the 'S' message then warning message VU001 will win out over the 'S' message.

Again, this is just an off-the-cuff hunch. Good luck!

Regards,

James Gaddis

Read only

0 Likes
1,618

I need to display message like S type b'cos if i give message type as I then Popup will come. this should not come....

-subha

Read only

0 Likes
1,618

I wonder if a warning 'W' type message might work for you, or would your message simply be overtaken by the SAP warning as it is with the 'S'? A warning would not give a popup unless the user configures their SAPGUI to do so. Since I cannot get the registration key for changing the user-exit code on my test system, I'm left with only guessing (sorry)...

Regards,

Jamie

Read only

0 Likes
1,618

That too not wanted. b'cos if i give warning message then It will ask for User additional enter key press to proceed further. This too my user don't want......??????

That's why i don't know how can i achieve this without touching standard card. B'cos if i give S message then it's overlapping by Sap standard warning message (Enter Quantity).

any ideas??????

Read only

0 Likes
1,618

Sounds like you have to keep track of each line item and only display the message once (unless the material number has changed).

How about creating an internal table in MV45ATZZ

data: begin of zz_itab occurs 0,
        posnr      type posnr,
        matnr      type matnr,
      end of zz_itab.

Refresh the table for each order in MV45AFZA in

USEREXIT_REFRESH_DOCUMENT

refresh zz_itab.

In whichever user exit you do your code in, only check once unless the material number has changed

read table zz_itab with key posnr = vbap-posnr.
* record found
if sy-subrc = 0.
* check if material has changed
  if zz_itab-matnr <> vbap-matnr.
*.... do your message code 
*   save new material number
      zz_itab-matnr = vbap-matnr.
      modify zz_itab index sy-tabix.
* else - already done- no message.
  endif.
else.
* record not found
* add material
  zz_itab-posnr = vbap-posnr.
  zz_itab-matnr = vbap-matnr.      
  append zz_itab.
*.... do your message code 
endif.

This is a hack... did not check syntax. Should use a TYPE instead of BEGIN OCCURS.

The user exit should be restricted as well..

transaction code (VA01, VA02), orders only (VBAK-VBTYP), sales organization (VBAK-VKORG), etc....

Read only

0 Likes
1,618

Subha,

You have opened numerous threads around this project.

Not sure that you are prepared for a project of this complexity...

Did you speak to your manager about getting help?

Read only

Former Member
0 Likes
1,618

Try USEREXIT_CHECK_VBAP in MV45AFZB.