Skip to Content
0
Former Member
Nov 16, 2011 at 08:46 AM

To create prospect and contact business partners when qualification is hot

18 Views

Hello Experts,

I have written following code in do_prepare_output, issue is its creating partner(prospect) everytime i want this to be done once.

i have checked with GET_QUAL_LEVEL_MAN too its not working.

Thanks in advance.

TYPES : BEGIN OF S_PROS,

L_NAME1 TYPE STRING,

L_LANG TYPE STRING,

L_CAT TYPE STRING,

END OF S_PROS.

DATA : LV_BPNUMBER1 TYPE BU_PARTNER.

DATA : LR_STATUS TYPE REF TO IF_BOL_BO_PROPERTY_ACCESS,

LR_PROSPECT TYPE REF TO IF_BOL_BO_PROPERTY_ACCESS,

LR_PRO_GUID TYPE REF TO IF_BOL_BO_PROPERTY_ACCESS,

LR_BPNUM1 TYPE REF TO IF_BOL_BO_PROPERTY_ACCESS,

L_STATUS TYPE STRING,

L_PROSPECT TYPE STRING,

L_PRO_GUID TYPE STRING.

data :

l_BPARTNER_GUID TYPE BAPIBUS1006_HEAD-PARTNERGUID,

l_MESSAGES type table of CRMT_ISALES_RETURN.

DATA : WA_PROS TYPE S_PROS,

WA_NAME1 TYPE BAPIBUS1006_CENTRAL_ORGAN,

WA_LANG TYPE BAPIBUS1006_CENTRAL,

WA_CAT TYPE BAPIBUS1006_HEAD-PARTN_CAT,

T_RETURN TYPE TABLE OF BAPIRET2,

L_BU_PROS type BAPIBUS1006_HEAD-BPARTNER.

LV_BPNUMBER1 = ZL_BT108H_L_DETAIL_IMPL=>IV_PARTNER_PROSPECT.

LR_STATUS = ME->TYPED_CONTEXT->BTLEADH->COLLECTION_WRAPPER->GET_CURRENT( ).

LR_PROSPECT = ME->TYPED_CONTEXT->BTPARTNERPROSPECT->COLLECTION_WRAPPER->GET_CURRENT( ).

LR_PRO_GUID = ME->TYPED_CONTEXT->BTPARTNERPROSPECT->COLLECTION_WRAPPER->GET_CURRENT( ).

LR_BPNUM1 = ME->TYPED_CONTEXT->BTPARTNERPROSPECT->COLLECTION_WRAPPER->GET_CURRENT( ).

IF LR_STATUS IS BOUND.

CALL METHOD LR_STATUS->GET_PROPERTY_AS_STRING

EXPORTING

IV_ATTR_NAME = 'QUAL_LEVEL_MAN'

  • IV_USE_ISO_FORMAT = ABAP_FALSE

RECEIVING

RV_RESULT = L_STATUS.

IF L_STATUS = '03'.

CALL METHOD LR_PROSPECT->GET_PROPERTY_AS_STRING

EXPORTING

IV_ATTR_NAME = 'PARTNER_NO'

  • IV_USE_ISO_FORMAT = ABAP_FALSE

RECEIVING

RV_RESULT = L_PROSPECT.

ENDIF.

ENDIF.

WA_PROS-L_NAME1 = L_PROSPECT.

WA_PROS-L_LANG = SY-LANGU.

WA_PROS-L_CAT = '2'.

WA_NAME1-NAME1 = WA_PROS-L_NAME1.

WA_LANG-PARTNERLANGUAGE = WA_PROS-L_LANG.

WA_CAT = WA_PROS-L_CAT.

IF LR_PRO_GUID IS BOUND."and L_PRO_GUID EQ '00000000000000000000000000000000'.

CALL METHOD LR_PRO_GUID->GET_PROPERTY_AS_STRING

EXPORTING

IV_ATTR_NAME = 'BP_PARTNER_GUID'

  • IV_USE_ISO_FORMAT = ABAP_FALSE

RECEIVING

RV_RESULT = L_PRO_GUID.

endif.

IF L_PRO_GUID EQ '00000000000000000000000000000000'.

CALL FUNCTION 'BAPI_BUPA_CREATE_FROM_DATA'

EXPORTING

  • BUSINESSPARTNEREXTERN =

PARTNERCATEGORY = WA_CAT

  • PARTNERGROUP =

CENTRALDATA = WA_LANG

  • CENTRALDATAPERSON = WA_NAME1

CENTRALDATAORGANIZATION = wa_name1

  • CENTRALDATAGROUP =

  • ADDRESSDATA =

  • DUPLICATE_MESSAGE_TYPE =

  • ACCEPT_ERROR = ' '

IMPORTING

BUSINESSPARTNER = L_BU_PROS

TABLES

  • TELEFONDATA =

  • FAXDATA =

  • TELETEXDATA =

  • TELEXDATA =

  • E_MAILDATA =

  • RMLADDRESSDATA =

  • X400ADDRESSDATA =

  • RFCADDRESSDATA =

  • PRTADDRESSDATA =

  • SSFADDRESSDATA =

  • URIADDRESSDATA =

  • PAGADDRESSDATA =

  • ADDRESSNOTES =

  • COMMUNICATIONNOTES =

  • COMMUNICATIONUSAGE =

  • TELEFONDATANONADDRESS =

  • FAXDATANONADDRESS =

  • TELETEXDATANONADDRESS =

  • TELEXDATANONADDRESS =

  • E_MAILDATANONADDRESS =

  • RMLADDRESSDATANONADDRESS =

  • X400ADDRESSDATANONADDRESS =

  • RFCADDRESSDATANONADDRESS =

  • PRTADDRESSDATANONADDRESS =

  • SSFADDRESSDATANONADDRESS =

  • URIADDRESSDATANONADDRESS =

  • PAGADDRESSDATANONADDRESS =

  • COMMUNICATIONNOTESNONADDRESS =

  • COMMUNICATIONUSAGENONADDRESS =

RETURN = T_RETURN

  • ADDRESSDUPLICATES =

.

ENDIF.

"ENDIF.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.