on 08-26-2014 2:23 PM
Hello Experts,
I am quite new to SAP. Recently I was given a task to create a custom field called "Agent" (used to select an individual account) and display it on Web Client. I had to use Extend Object Model for Business Partner in SPRO. I've walked through the guide, published on http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/4048d161-9ac1-2e10-3bbf-baef73d78... . I've created Key, Structure, Class and Table with two elements (bp_guid and char).
Now I wonder how to add new field to Web Client using (I suppose) transaction BSP_WD_CMPWB. Please help me walk through it.
Thank you in advance.
Best regards,
Andrew
Hey guys,
I've managed to create custom fields where I wanted them to be. But there's another problem. I've created those fields in business hours relation. There are field to choose an employee and communication channel like e-mail, fax, etc.Anyway i still have a little problem.
When I click on a new button on business hours assignment block I see a view of new business hours element (as it should be). There are my two new fields. They're mandatory fields so I need to fill them. When I do this and fill all other fields (even those which aren't mandatory), I click the back button (the one which save the data). There is no error and I'm returning to the standard account view. Now, when I want to edit created object. I click the edit button. When the view changes to business hours view, my fields of employee and the channel are not filled out. But when I fill them now, on edit screen, they would be saved.
When I debug the redefinition of method MODIFY there is some problem with lwa_key. While creating the new business hours element the lwa_key equals 0, but when I edit the object it has some value. Here's the code of modify method (the assign part):
TRY.
lv_obj ?= iv_ref.
CATCH: cx_sy_assign_cast_error.
EXIT.
ENDTRY.
lv_obj->get_key( IMPORTING es_key = lwa_key ).
IF lwa_key IS INITIAL.
lr_parent = lv_obj->get_parent(
CALL METHOD lr_parent->get_key
IMPORTING
es_key = ls_parent_key.
ENDIF.
lv_delta = lv_obj->get_delta_flag( ).
IF lv_delta EQ if_genil_cont_simple_object=>delta_created.
lwa_key-parent_guid = ls_parent_key-partner_guid.
CLEAR: lwa_global_bol_data, gt_global_bol_data.
MOVE-CORRESPONDING lwa_key TO lwa_global_bol_data.
TRY.
CALL METHOD lv_obj->set_key
EXPORTING
is_object_key = lwa_key.
CATCH cx_crm_genil_duplicate_key.
ENDTRY.
lv_obj->get_attributes( IMPORTING es_attributes = lwa_bol_data ).
lv_obj->get_attributes( IMPORTING es_attributes = lwa_bol_data_chg ).
lr_obj_prop = lv_obj->get_attr_props_obj( ).
CALL METHOD lr_obj_prop->get_name_tab_4_property
EXPORTING
iv_property = if_genil_obj_attr_properties=>modified
IMPORTING
et_names = lt_changed_fields.
LOOP AT lt_changed_fields INTO lwa_changed_fields.
ASSIGN COMPONENT lwa_changed_fields OF STRUCTURE lwa_bol_data_chg TO
<new_data>.
ASSIGN COMPONENT lwa_changed_fields OF STRUCTURE lwa_global_bol_data
TO <old_data>.
<old_data> = <new_data>.
ENDLOOP.
APPEND lwa_global_bol_data TO gt_global_bol_data.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think you took the long path, I would undo what you did and enhance the BP using AET,
http://help.sap.com/saphelp_crm700_ehp02/helpdata/en/01/320bd270e84f419953906fe8050ed1/frameset.htm
If you search thorugh SCN for AET you will find plenty of posts.
Cheers!
Luis
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry I didn't know you know about AET, to avoid this kind of confusions I would suggest to specify with more detail your original question, that begin said , using AET I didn't find a single scenario which i needed to implement the other approach, in terms of productivity and SAP support didn't make sense to me.
You need to:
1- Enhance the component
2- Enhance the View
3- In best scenario you will have your BOL model avaliable on the BOL browser (only to check)
4- You "will" need to add your BOL model in the view creating a new context (Note you need to have the BUILDHEADER respresentation as context node, that's because you BOL is a child of this one)
Let's see how it goes
Hi,
I believe the above said issue appears when there is no instance of the attribute u are trying to display on the view. We have an option to select "Always create an instance" while creation of view. Since the model was enhanced, the particular attribute may not have instance during initialization.
So u could modify the IF_BSP_MODEL~INIT method of the corresponding context node class and pass initial value to the model.
-
Anish
Hi,
I suppose other attributes are not having this issue.
I once had one such issue and i had to redefine the method i mentioned earlier.
The node was not initializing, so have to implement the same
method IF_BSP_MODEL~INIT.
DATA:
lt_params TYPE crmt_name_value_pair_tab,
ls_params TYPE crmt_name_value_pair,
lr_core TYPE REF TO cl_crm_bol_core,
lr_factory TYPE REF TO cl_crm_bol_entity_factory,
lr_bo_coll TYPE REF TO if_bol_bo_col,
lr_connobj TYPE REF TO cl_crm_bol_entity.
* calling the super class
super->if_bsp_model~init( id = id
owner = owner ).
* Setting parameter value
ls_params-name = 'xxxxxx'. "<-- Pass attribute name
ls_params-value = ''.
APPEND ls_params TO lt_params.
* creating instance of the BOL core
lr_core = cl_crm_bol_core=>get_instance( ).
* Calling factory method for connection object node creation
lr_factory = lr_core>get_entity_factory( 'xxxxx' ). <-- Pass the object name
lr_connobj = lr_factory->create( lt_params ).
* adding the entity into the colletion
CREATE OBJECT lr_bo_coll TYPE cl_crm_bol_bo_col.
lr_bo_coll->add( lr_connobj ).
set_collection( lr_bo_coll ).
endmethod.
-
Anish
User | Count |
---|---|
7 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.