cancel
Showing results for 
Search instead for 
Did you mean: 

BBP_PO_INBOUND_BADI

Former Member
0 Kudos

Hi all.

SRM 4.0, extended classic scenario.

I have tried modifying this BAdI in R/3 in an attempt to overwrite the TAXJURCODE in the Invoice tab of the PO with the value from the address details of the TAXJURCODE - but without any luck so far.

Here is the code I have entered:

DATA: ls_bbp_poaddrdelivery TYPE bbp_poaddrdelivery.

LOOP AT bbp_poaddrdelivery INTO ls_bbp_poaddrdelivery.

LOOP AT bapi_poitem INTO ls_bapi_poitem WHERE

po_item = ls_bbp_poaddrdelivery-po_item.

ls_bapi_poitem-taxjurcode = ls_bbp_poaddrdelivery-taxjurcode.

MODIFY bapi_poitem FROM ls_bapi_poitem.

ENDLOOP.

ENDLOOP.

Any other ideas as to how I could overwrite the field MEPO1317-TXJCD with the value from ADDR1_DATA-TAXJURCODE? How have you guys overcome this issue? It seems to me that the jurisdiction code in R/3 should change together with the jur code on Address Details.

Thanks.

DM

Message was edited by: DENMOG

Dennis Mogensen

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

Which R/3 version are you using ?

<b>Please go through the following Sample code for the BADI - BBP_PO_INBOUND_BADI, which will help in your case... -></b>

METHOD IF_EX_BBP_PO_INBOUND_BADI~BBP_MAP_BEFORE_BAPI .

  DATA: LT_BAPI_POCOND       TYPE TABLE OF  BAPIMEPOCOND,
        LS_BAPI_POCOND      TYPE  BAPIMEPOCOND,
        LS_BAPI_CONDX        TYPE  BAPIMEPOCONDX,
        LT_PO_KONV          TYPE TABLE OF KONV,
        LT_EKKO              TYPE TABLE OF EKKO,
        LS_EKKO              TYPE EKKO,
        LS_EKPO              TYPE EKPO,
        LS_PO_KONV          TYPE KONV,
        LV_LOCAL_CURRENCY    TYPE WAERS,
        LS_BBP_PO_ITEM      TYPE LINE OF BBPT_IF_BAPIMEPOITEM.


  SELECT SINGLE * INTO LS_EKKO FROM EKKO
                  WHERE EBELN EQ BBP_POHEADER-PO_NUMBER.
  IF SYST-SUBRC EQ 0.
    LOOP AT BAPI_POITEM INTO LS_BBP_PO_ITEM.

      SELECT SINGLE * INTO LS_EKPO FROM EKPO
                          WHERE EBELP EQ LS_BBP_PO_ITEM-PO_ITEM AND
                          EBELN EQ BBP_POHEADER-PO_NUMBER.

      CHECK SYST-SUBRC EQ 0.

      IF  ( BBP_POHEADER-CURRENCY NE LS_EKKO-WAERS )
      OR  ( LS_BBP_PO_ITEM-NET_PRICE NE LS_EKPO-NETPR ).

        SELECT SINGLE WAERS  FROM  T001
                            INTO  LV_LOCAL_CURRENCY
                            WHERE BUKRS EQ BBP_POHEADER-COMP_CODE.
        SELECT * FROM  KONV
                INTO  TABLE LT_PO_KONV
                WHERE KNUMV EQ LS_EKKO-KNUMV.

        LOOP AT LT_PO_KONV INTO  LS_PO_KONV
                          WHERE KNTYP EQ 'H'  "basic price
                          AND KRECH EQ 'C'. "quantity
          READ TABLE BBP_POITEM INTO LS_BBP_PO_ITEM
                    WITH KEY PO_ITEM = LS_PO_KONV-KPOSN.
          CHECK SYST-SUBRC EQ 0.


          LS_BAPI_POCOND-CURRENCY = BBP_POHEADER-CURRENCY.
          LS_BAPI_POCOND-COND_VALUE = LS_BBP_PO_ITEM-NET_PRICE.
          LS_BAPI_POCOND-CONPRICDAT = BBP_POHEADER-DOC_DATE.
          LS_BAPI_POCOND-COND_TYPE = LS_PO_KONV-KSCHL.
          LS_BAPI_POCOND-ITM_NUMBER = LS_BBP_PO_ITEM-PO_ITEM.
          LS_BAPI_POCOND-CHANGE_ID = 'U'.

          IF BBP_POHEADER-CURRENCY EQ LV_LOCAL_CURRENCY.
            LS_BAPI_POCOND-CONEXCHRAT = '1.0'.
          ELSE.
            CALL FUNCTION 'READ_EXCHANGE_RATE'
              EXPORTING
                DATE            = LS_BAPI_POCOND-CONPRICDAT
                FOREIGN_CURRENCY = LS_BAPI_POCOND-CURRENCY
                LOCAL_CURRENCY  = LV_LOCAL_CURRENCY
              IMPORTING
                EXCHANGE_RATE    = LS_BAPI_POCOND-CONEXCHRAT
              EXCEPTIONS
                NO_RATE_FOUND    = 1
                NO_FACTORS_FOUND = 2
                NO_SPREAD_FOUND  = 3
                DERIVED_2_TIMES  = 4
                OVERFLOW        = 5
                ZERO_RATE        = 6
                OTHERS          = 7.
            IF SYST-SUBRC NE 0.
              LS_BAPI_POCOND-CONEXCHRAT = '1.0'.
            ENDIF.
          ENDIF.
          APPEND LS_BAPI_POCOND TO BAPI_POCOND.
          LS_BAPI_CONDX-ITM_NUMBER = LS_PO_KONV-KPOSN.
          LS_BAPI_CONDX-CURRENCY = 'X'.
          LS_BAPI_CONDX-COND_VALUE = 'X'.
          LS_BAPI_CONDX-CONPRICDAT = 'X'.
          LS_BAPI_CONDX-CHANGE_ID = 'X'.
          APPEND LS_BAPI_CONDX TO BAPI_POCONDX.
        ENDLOOP.
      ENDIF.
    ENDLOOP.
  ENDIF.
ENDMETHOD.

<u>Other related links -></u>

Do let me know.

Regards

- Atul

Former Member
0 Kudos

Thanks, Atul.

But I think I have to make changes within the BAPI_PO_CREATE - within this, there is an open slot for Customer Enhancements, and I will try to make the code here.

Do you have any experience in changing the BAPI's that create the PO in R/3?

Former Member
0 Kudos

Hi

Yes ofcourse.. )

Please look for BAPI_PO_CHANGE in this case.

<u>Useful Pointers -></u>

Note 606768 BAPI_PO_CREATE: <u>EXIT_SAPLMEWP_002</u> Addition.headr data miss.

Note 336589 BAPI_PO_CREATE: Customer enhancements

Regards

- Atul

Former Member
0 Kudos

Hi there.

Again thanks for input on this issue.

I finally got my tax jurisdiction code to work in R/3 as well. I used the BBP_ECS_PO_OUT_BADI to send the correct taxjurcode to the backend, and this was good enough.

Points will be awarded.

Answers (0)