0% found this document useful (0 votes)
188 views2 pages

Partner Creation Using BOL Report

This document reports on creating a partner record in SAP CRM. It declares variables and objects, sets properties like name, address, phone number, and gender on the partner record, and saves and commits the new record to the SAP system.

Uploaded by

puneet mittal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
188 views2 pages

Partner Creation Using BOL Report

This document reports on creating a partner record in SAP CRM. It declares variables and objects, sets properties like name, address, phone number, and gender on the partner record, and saves and commits the new record to the SAP system.

Uploaded by

puneet mittal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

REPORT ZPM_PARTNER_CREATE.

* Declarion of objects
DATA: lr_core TYPE REF TO cl_crm_bol_core.
DATA: lr_entity TYPE REF TO cl_crm_bol_entity.
DATA: lr_entity_adr TYPE REF TO cl_crm_bol_entity.
DATA: lr_entity_mail TYPE REF TO cl_crm_bol_entity.
DATA: lr_entity_phone TYPE REF TO cl_crm_bol_entity.
DATA: lr_entity_gend TYPE REF TO cl_crm_bol_entity.
DATA: lr_factory TYPE REF TO cl_crm_bol_entity_factory.
DATA: lr_transaction TYPE REF TO if_bol_transaction_context.

* Declaration of work areas


DATA: ls_addr TYPE CRMT_BUPA_IL_ADDRESS.
DATA: ls_data TYPE crmst_header_object_buil.
data: ls_mail TYPE CRMST_EMAIL_BUIL.
DATA : ls_phone TYPE CRMST_TELEPHONE_BUIL.
data: ls_gender TYPE CRMT_ICM_BP_DESCR_UI .
DATA: ls_params TYPE crmt_name_value_pair.

* Declaration of internal table


DATA: lt_params TYPE crmt_name_value_pair_tab.

* Declaration of variables
DATA: lv_bpno TYPE string.

* Creating instance to business object layer


lr_core = cl_crm_bol_core=>get_instance( ).

TRY.
lr_core->start_up( 'BP_APPL' ).
CATCH cx_crm_genil_general_error.
ENDTRY.

lr_factory = lr_core->get_entity_factory( 'BuilHeader' ).


* Assigning Business category and group to a BP.
ls_params-name = 'BP_CATEGORY'.
ls_params-value = '1'.
APPEND ls_params TO lt_params.

ls_params-name = 'BP_GROUP'.
ls_params-value = '0001'.
APPEND ls_params TO lt_params.

lr_entity = lr_factory->create( lt_params ).

* Providing first name and last name to BP.


ls_data-firstname = 'Puneet'.
ls_data-lastname = 'Mittal'.
lr_entity->set_properties( ls_data ).

lr_entity_adr = lr_entity->CREATE_RELATED_ENTITY( 'BuilAddressRel' ).

* Assigning address to a BP
ls_addr-STREET = 'Malad West'.
ls_addr-POSTL_COD1 = '400064'.
ls_addr-COUNTRY = 'IN'.
lr_entity_adr->set_properties( ls_addr ).
lr_entity_mail = lr_entity_adr->CREATE_RELATED_ENTITY( 'BuilAddressEMailRel' ).

* Assigning mail id to a BP
ls_mail-E_MAIL = '[email protected]'.
lr_entity_mail->set_properties( ls_mail ).

lr_entity_phone = lr_entity_adr->CREATE_RELATED_ENTITY( 'BuilAddressPhoneRel' ).

* Assigning mobile no to a BP
ls_phone-TELEPHONE = '9699322631'.
ls_phone-TEL_NO = '9699322631'.
lr_entity_phone->set_properties( ls_phone ).

lr_entity_gend = lr_entity-
>CREATE_RELATED_ENTITY( 'BuilICMPersonalDescriptionRel' ).

* Assigning gender as female


ls_gender-GENDER = '1'.
lr_entity_gend->set_properties( ls_gender ).

* When we instatiate modify method then only data get saved in BOL layer
* untill then data get stored in buffer
lr_core->modify( ).

* Getting BP that we created


lv_bpno = lr_entity->get_property_as_string( 'BP_NUMBER' ).
WRITE:lv_bpno.

* Commit the data


lr_transaction = lr_core->get_transaction( ).
lr_transaction->save( ).
if lr_transaction->save( ) = abap_true.
lr_transaction->commit( abap_true ).
ENDIF.

You might also like