09-24-2009 8:59 AM
I have added in the user exit save document prepare of sales order the following ABAP code in order to check if the net amount of the sales order is less than 300. If this requirement is met a pop up should begin. The code is the following, theproblem is that it doesn't take into account the amount the way I have written.
if vbak-vbtyp = 'C' and " orders only
( t180-tcode = 'VA01' or " order create or
t180-tcode = 'VA02' ). " order change
LOOP AT vbak.
IF vbak-netwr < '300'.
*
*
if sy-subrc = 0.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
TITEL = 'Customer Check'(z31)
TEXTLINE1 = 'Add text here...'(z32)
TEXTLINE2 = 'and here....'(z33).
endif.
endloop.
endif.
09-24-2009 9:18 AM
Create a variable (or a constant for that matter) with the same type as VBAK-NETWR and assign it the value 300.
I don't see the problem yet. Post the exact code where you do the comparison with vbak-netwr to 300??
09-24-2009 9:18 AM
Create a variable (or a constant for that matter) with the same type as VBAK-NETWR and assign it the value 300.
I don't see the problem yet. Post the exact code where you do the comparison with vbak-netwr to 300??
09-24-2009 9:22 AM
The code is below. Can you help me with the constant or the variable (the abap code)
if vbak-vbtyp = 'C' and " orders only
( t180-tcode = 'VA01' or " order create or
t180-tcode = 'VA02' ). " order change
LOOP AT vbak.
IF vbak-netwr < '300'.
*
*
if sy-subrc = 0.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
TITEL = 'Customer Check'(z31)
TEXTLINE1 = 'Add text here...'(z32)
TEXTLINE2 = 'and here....'(z33).
endif.
endloop.
endif.
ENDFORM. "USEREXIT_SAVE_DOCUMENT_PREPARE
*eject
09-24-2009 9:56 AM
I have done the following changes but the 300 euros in not again taken into consideration
DATA: x LIKE VBAK-NETWR.
x = 300.
if vbak-vbtyp = 'C' and " orders only
yvbak-netwr <= x and
( t180-tcode = 'VA01' or " order create or
t180-tcode = 'VA02' ). " order change
if sy-subrc = 0.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
TITEL = 'Customer Check'(z31)
TEXTLINE1 = 'Add text here...'(z32)
TEXTLINE2 = 'and here....'(z33).
endif.
endif.
09-24-2009 10:04 AM
what for "if sy-subrc = 0." here? yvbak contains previous NETWR. are you sure you need yvbak?
09-24-2009 10:14 AM
only when i use yvbak the pop up operates but since then it doesn't take into account the 300
09-24-2009 2:11 PM
Are you sure that NETWR is the problem? There are several comparisons made in this piece of code. Comment them one by one and make sure that it is the NETW that is the problem. I did the same thing here with the 300 Euros and it works just fine for me.