*"---------------------------------------------------------------------- *"Methoden Signatur: *" Importing *" IV_GUID TYPE CRMT_OBJECT_GUID *" IV_PARTNER_FCT TYPE CRMT_PARTNER_FCT *" IV_PARTNER_PFT TYPE CRMT_PARTNER_PFT *" Exporting *" EV_NUMBER TYPE BU_PARTNER *" EV_DESCRIPTION_NAME TYPE BU_DESCRIP *" EV_DESCRIPTION_SHORT TYPE COMT_PARTNER_ADDRESS_WO_STREET *" EV_DESCRIPTION_LONG TYPE COMT_PARTNER_ADDRESS_W_STREET *"----------------------------------------------------------------------
************************************************************************ * Method GET_PARTNER_OF_FCT * * Date 26.01.2015 * * * *----------------------------------------------------------------------* * Get Partner for given Partner Function. * ************************************************************************ METHOD GET_PARTNER_OF_FCT. DATA: ls_partner TYPE crmt_partner_external_wrk, lv_description TYPE bus000flds-descrip, lv_description_name TYPE bus000flds-descrip, lv_description_long TYPE bus000flds-descrip_long. CLEAR: ev_number, ev_description_name, ev_description_short, ev_description_long. *Get partner for a given partner function or partner function type. CALL FUNCTION 'CRM_PARTNER_READ_OW' EXPORTING iv_ref_guid = iv_guid iv_ref_kind = 'A' iv_partner_fct = iv_partner_fct iv_partner_pft = iv_partner_pft iv_mainpartner_only = 'X' iv_get_bp_numbers = 'X' * IV_REFRESH_ADDRESS_REF = ' ' IMPORTING es_partner_wrk = ls_partner EXCEPTIONS error_occurred = 1 parameter_error = 2 entry_does_not_exist = 3 OTHERS = 4. *Partner not found. CHECK sy-subrc = 0. *Get Description CALL FUNCTION 'BUP_PARTNER_DESCRIPTION_GET' EXPORTING i_partnerguid = ls_partner-bp_partner_guid IMPORTING e_description = lv_description e_description_name = lv_description_name e_description_long = lv_description_long EXCEPTIONS partner_not_found = 1 wrong_parameters = 2 internal_error = 3 OTHERS = 4. *Partner not found. CHECK sy-subrc = 0. *Transfer data. MOVE: ls_partner-partner_no TO ev_number, lv_description_name TO ev_description_name, lv_description TO ev_description_short, lv_description_long TO ev_description_long. *Alternatively we could use function CRM_PARTNER_TO_DISPLAY_OW. *But here we get all partners and have to filter/select the wanted partner entry with own coding. ENDMETHOD.
*"---------------------------------------------------------------------- *"Methoden Signatur: *" Importing *" IV_UNAME TYPE SYUNAME *" Exporting *" EV_DESCRIPTION_NAME TYPE BU_DESCRIP *" EV_DESCRIPTION_SHORT TYPE COMT_PARTNER_ADDRESS_WO_STREET *" EV_DESCRIPTION_LONG TYPE COMT_PARTNER_ADDRESS_W_STREET *"----------------------------------------------------------------------
************************************************************************ * Method GET_PARTNER_BY_UNAME * * Date 26.01.2015 * * * *----------------------------------------------------------------------* * Get Partner for given User Name. * ************************************************************************ METHOD get_partner_by_uname. DATA: lv_partner_guid TYPE bu_partner_guid, lv_description TYPE bus000flds-descrip, lv_description_name TYPE bus000flds-descrip, lv_description_long TYPE bus000flds-descrip_long. CLEAR: ev_description_name, ev_description_short, ev_description_long. *Get Partner for Username CALL FUNCTION 'BP_CENTRALPERSON_GET' EXPORTING iv_username = iv_uname IMPORTING ev_bu_partner_guid = lv_partner_guid EXCEPTIONS no_central_person = 1 no_business_partner = 2 no_id = 3 OTHERS = 4. *Partner not found. CHECK sy-subrc = 0. *Get Description CALL FUNCTION 'BUP_PARTNER_DESCRIPTION_GET' EXPORTING i_partnerguid = lv_partner_guid IMPORTING e_description = lv_description e_description_name = lv_description_name e_description_long = lv_description_long EXCEPTIONS partner_not_found = 1 wrong_parameters = 2 internal_error = 3 OTHERS = 4. *Partner not found. CHECK sy-subrc = 0. *Transfer data. MOVE: lv_description_name TO ev_description_name, lv_description TO ev_description_short, lv_description_long TO ev_description_long. ENDMETHOD.