I want to make changes to a Business Partner and commiting those things back to the Database with
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
But for some of my BPs I get following error message which breaks my programm.
I've tracked the issue in FM TAX_NUMBER_CHECK (detailed explanation at the bottom).
Is there a way I can exclute busniess partners with invalid tax code from the BAPI_TRANSACTION_COMMIT?
I wanted to check the tax number with TAX_NUMBER_CHECK but I get the same error.
Further I recreated the Tax check in my program (see oding below) but also this helps not (not in all cases).
IF tax_code_1+9(5) <> space. DATA: cfield(2) TYPE c, refe1 TYPE i, refe2 TYPE i, refe3 TYPE i. IF tax_code_1 CN '1234567890 '. ENDIF. DO 4 TIMES. refe1 = refe1 + savecode9+8(1). SHIFT savecode9 RIGHT. refe3 = savecode9+8(1). refe3 = refe3 * 2. IF refe3 > 9. cfield = refe3. refe3 = cfield(1). refe3 = refe3 + cfield+1(1). ENDIF. refe2 = refe2 + refe3. SHIFT savecode9 RIGHT. ENDDO. refe1 = refe2 + refe1 + savecode9+8(1). refe1 = refe1 MOD 10. IF refe1 EQ 0. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'. ENDIF. ELSE.
TAX_NUMBER_CHECK
WHEN 'FR'. " Frankreich PERFORM check_taxcode_f USING tax_code_1.
FORM check_taxcode_f USING tax_code_1 LIKE kna1_bf-stcd1. DATA: savestcd1 LIKE kna1_bf-stcd1. IF tax_code_1 is not initial. " N2451019 Error Message "Tax code 1 is not valid" for Tax number2(FR2) savestcd1 = tax_code_1. *------- Prüfung auf Vollständigkeit ----------------------------------- IF savestcd1(9) = '356000000'. " Note 1955116 "SIRET Number check for LA-POSTE ELSE. IF savestcd1+9(5) = space. CALL FUNCTION 'READ_CUSTOMIZED_MESSAGE' EXPORTING i_arbgb = 'AR' i_dtype = 'W' i_msgnr = '171' IMPORTING e_msgty = typ_mess. IF typ_mess = 'E'. MESSAGE e171 RAISING not_valid. ELSEIF typ_mess NE '-'. MESSAGE ID 'AR' TYPE typ_mess NUMBER '171'. "RAISING NOT_VALID. Changes under note 2320358 " Error Message "Tax code 1 is not valid" is not showing for FR1 Tax number" ENDIF. PERFORM check_nine_digits USING tax_code_1. ELSE. PERFORM check_nine_digits USING tax_code_1. PERFORM check_all_digits USING tax_code_1. ENDIF. ENDIF. ENDIF. ENDFORM.