Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Add Tax IDs to BP on SAVE (new)

I'm trying with the following code to add a Tax ID to the BP while I'm saving it (New).

But I don't get the BP ID.

BUPA_NUMBERS_GET doesn't return BP ID.

'BBP_BUPA_GET_NUMBER' doesn't return BP ID.

How can I solve this issue?

Best regards.

METHOD if_ex_bupa_tax_update~change_before_update.
  break josechau.

  DATA: lv_partner    TYPE  bu_partner,
        lv_tax_type   TYPE  bus_tax-tax_type,
        lv_tax_number TYPE  bus_tax-tax_number,
        lv_guid       TYPE  bu_partner_guid.

  LOOP AT it_changed_instances INTO lv_guid.
  ENDLOOP.

  CALL FUNCTION 'BUPA_NUMBERS_GET'
   EXPORTING
     iv_partner_guid           = lv_guid
   IMPORTING
     ev_partner                = lv_partner
*     EV_PARTNER_GUID           =
*     EV_PARTNER_EXTERNAL       =
*     ES_BUT000                 =
*   TABLES
*     ET_RETURN                 =
*     ET_PARTNER                =
            .

  CALL FUNCTION 'BBP_BUPA_GET_NUMBER'
   EXPORTING
*   PARTNER                 =
     partner_guid            = lv_guid
*   ADDRNUM                 =
   IMPORTING
     ev_partner              = lv_partner
*   EV_PARTNER_GUID         =
*   EV_GUID_32              =
   EXCEPTIONS
     partner_not_valid       = 1
     guid_not_valid          = 2
     no_input                = 3
     OTHERS                  = 4
            .
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.


  MOVE lv_partner TO lv_tax_number.
  MOVE 'CO1' TO lv_tax_type.

  CALL FUNCTION 'BUPA_TAX_ADD'
    EXPORTING
      iv_partner                  = lv_partner
      iv_tax_type                 = lv_tax_type
      iv_tax_number               = lv_tax_number
* TABLES
*   CT_RETURN                   =
 EXCEPTIONS
   record_already_exists       = 1
   invalid_data                = 2
   foreign_lock                = 3
   OTHERS                      = 4
            .
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

  CALL FUNCTION 'BUPA_TAX_SAVE_COMMIT'.
ENDMETHOD.

Tags:
Former Member
Former Member replied

Hi,

Sure, this can be done - but i'd need some more info -

How are you creating the BP ? Are you using transaction BP, or are you using a report program with BAPIs ?

In SAP BP, the dialog memory and BAPI memory are very different. If you are creating the bp using dialog(transaction BP), then what we can do is default the tax number on the screen, and the dialog memory, so that it automatically gets saved.

If you are using BAPIs / APIs, then there should be no problem using BUPA_TAX_ADD.

Cheers,

Rishu.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question