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

Error message if duplicate invoice

Former Member
0 Likes
985

HI ,

im using Badi INVOICE_UPDATE for giving erROR msg but old invoive values not comming so validation not working

METHOD if_ex_invoice_update~change_before_update.

  • ...

  • Start of addition by

BREAK-POINT.

IF s_rbkp_new-bukrs EQ s_rbkp_old-bukrs

AND s_rbkp_new-budat EQ s_rbkp_old-budat

AND s_rbkp_new-xblnr EQ s_rbkp_old-xblnr

AND s_rbkp_new-waers EQ s_rbkp_old-waers

AND s_rbkp_new-lifnr EQ s_rbkp_old-lifnr

AND s_rbkp_new-RMWWR EQ s_rbkp_old-RMWWR.

MESSAGE ID 'ZI' TYPE 'E' NUMBER '047' .

ENDIF.

ENDMETHOD.

6 REPLIES 6
Read only

madhu_vadlamani
Active Contributor
0 Likes
920

HI,

Here there is no code no bring the old data from tables.Did you check in debug mode.

Regards,

Madhu.

Read only

0 Likes
920

S_RBKP_OLD is expected to hold old values but its empty at run time

Read only

0 Likes
920

i m use FM MRM_FI_DOCUMENT_CHECK inside badi but its not working thou independently its giving desired resut

Edited by: Vrendr@ on Oct 11, 2011 3:02 PM

Read only

0 Likes
920

i dont think raising an error message from the exit is correct approach. did you check if there is any explicit or implicit enhancements where you can capture the required parameters and raise an error message

Read only

0 Likes
920

I used below inside badi is working fine

DATA i_bsak TYPE TABLE OF bsak .

DATA i_bsik TYPE TABLE OF bsik .

        • Invoice validation ********************

          • check for duplicate check in vendor open items

SELECT * FROM bsik INTO TABLE i_bsik

WHERE bukrs EQ S_RBKP_NEW-bukrs

AND lifnr EQ S_RBKP_NEW-lifnr

AND xblnr EQ S_RBKP_NEW-xblnr

AND waers EQ S_RBKP_NEW-waers

AND bldat EQ S_RBKP_NEW-bldat

AND wrbtr EQ S_RBKP_NEW-rmwwr

AND shkzg EQ 'H'.

IF sy-subrc EQ 0.

MESSAGE E047(ZI) WITH S_RBKP_NEW-belnr S_RBKP_NEW-xblnr.

ELSE.

          • check for duplicate check in vendor cleared items

SELECT * FROM bsak into TABLE i_bsak

WHERE bukrs EQ S_RBKP_NEW-bukrs

AND lifnr EQ S_RBKP_NEW-lifnr

AND xblnr EQ S_RBKP_NEW-xblnr

AND waers EQ S_RBKP_NEW-waers

AND bldat EQ S_RBKP_NEW-bldat

AND wrbtr EQ S_RBKP_NEW-rmwwr

AND shkzg EQ 'H'.

IF sy-subrc EQ 0.

MESSAGE E047(ZI) WITH S_RBKP_NEW-belnr S_RBKP_NEW-xblnr.

ENDIF.

ENDIF.

Read only

Former Member
0 Likes
920

Hi,

do you create a new invoice or change an existing invoice ? I think S_RBKP_OLD will only be filled in change mode.

Regards,

Klaus