Skip to Content

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

Creating relation in BADI PARTNER_UPDATE

Dear all,

I'm wanting to check every bp of a special role if it has a certain relationship.

If this relationship is not present, this relationship has to be created.

I have used BAdI partner_update to do this check and creation.

(The code I have put underneath this text.)

After saving a partner for which the relation is created, I get the message

R1-788 "Enter the relationship number or relationship category".

After entering transaction BP gives a message "Changes have been saved" and gets into a strange mode.

None of the data is shown on the screen or can be adjusted. It just gives the bp-number (display-mode).

After restarting BP everything seems fine and saved properly.

Do any of you know what I missed or are doing wrong.

Thanx in advance.

Point will be rewarded ofcourse.

METHOD if_ex_partner_update~change_before_update .

DATA:

lt_but000_new TYPE TABLE OF bus000___i,

ls_but000 TYPE but000,

lv_rltyp TYPE bu_rltyp,

lv_addrnumber TYPE ad_addrnum,

lv_woonadres TYPE bapibus1006_address,

lv_alumnikring TYPE bu_partner,

lv_but050 TYPE but050,

lt_return TYPE TABLE OF bapiret2.

CALL FUNCTION 'BUPA_GENERAL_CALLBACK'

TABLES

et_but000_new = lt_but000_new.

LOOP AT lt_but000_new INTO ls_but000.

  • Deze functie moet alleen doorlopen worden voor een bp van het type ZALALU.

CLEAR: lv_rltyp.

SELECT SINGLE rltyp INTO lv_rltyp

FROM but100

WHERE partner = ls_but000-partner

AND rltyp = 'ZALALU'.

CHECK lv_rltyp = 'ZALALU'.

  • Zoek de juiste alumnikring op.

CLEAR: lv_addrnumber.

CALL FUNCTION 'BUPA_ADDRESSES_GET'

EXPORTING

iv_partner = ls_but000-partner

iv_address_type = 'ZALWOON'

IMPORTING

ev_standard_addrnumber = lv_addrnumber.

CLEAR: lv_woonadres.

CALL FUNCTION 'BUPA_ADDRESS_GET_DETAIL'

EXPORTING

iv_partner = ls_but000-partner

iv_addrnumber = lv_addrnumber

IMPORTING

es_address = lv_woonadres.

CLEAR lv_alumnikring.

SELECT SINGLE partner INTO lv_alumnikring

FROM zalkring_pc

WHERE postcode_van <= lv_woonadres-postl_cod1

AND postcode_tot >= lv_woonadres-postl_cod1

AND NOT opgeheven = 'X'.

  • Opzoeken of de relatie al bestaat.

CALL FUNCTION 'BUPR_RELATIONSHIP_CHECK_EXIST'

EXPORTING

iv_partner_1 = ls_but000-partner

iv_partner_2 = lv_alumnikring

iv_relationship = 'ZALALR'

TABLES

et_return = lt_return.

  • Als de relatiebestaat, dan alleen de einddatum update naar 99991231

  • als dat niet al zo is.

IF not lt_return[] IS INITIAL.

CALL FUNCTION 'BUPR_RELATIONSHIP_CREATE'

EXPORTING

iv_partner_1 = ls_but000-partner

iv_partner_2 = lv_alumnikring

iv_relationship = 'ZALALR'

iv_x_save = ' '.

CALL FUNCTION 'BUS_BAPI_SAVE'

EXPORTING

WITH_COMMIT = ' '.

ENDIF.

ENDLOOP.

ENDMETHOD.

Edited by: Monique van de Waarsenburg on Oct 7, 2008 3:51 PM

Edited by: Monique van de Waarsenburg on Oct 7, 2008 3:53 PM

Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question