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: 

ABAP Popup menu

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

Sm1tje
Active Contributor
0 Kudos

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??

6 REPLIES 6

Sm1tje
Active Contributor
0 Kudos

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??

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

0 Kudos

what for "if sy-subrc = 0." here? yvbak contains previous NETWR. are you sure you need yvbak?

Former Member
0 Kudos

only when i use yvbak the pop up operates but since then it doesn't take into account the 300

Sm1tje
Active Contributor
0 Kudos

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.