Skip to Content
0

Use attribute PLANT from BTAdminI into BTAdminH in CRM Sales Order Screen

Feb 27, 2017 at 10:44 AM

166

avatar image

Hi,
There is a standard field PLANT present in the Item Level in Create Sales Order screen in CRM. My requirement is to use this same field in the Header screen, so that when User enters any value in Header Plant, same value gets copied across all line items.

For this, I created a new model attribute with same name PLANT under header component BTAdminH using BOL entity BTAdminI and relationship BTItemCustExt/PLANT, since this attribute is present under BTAdminI.
Then I am able to add PLANT in the header component using Show Available Fields.
But this newly added field contains a error "BTAdminI not bound"
Since I am new to CRM ABAP, can you please help me in finding what is the issue and what have I missed while adding the attribute?

Below is the code from GET_PLANT method generated.

value = 'BTAdminI not bound'."#EC NOTEXT

if iterator is bound.
current = iterator->get_current( ).
else.
current = collection_wrapper->get_current( ).
endif.

TRY.

DATA: coll TYPE REF TO if_bol_entity_col.
DATA: entity TYPE REF TO cl_crm_bol_entity.

entity ?= current.

* while entity
coll = entity->get_related_entities(
iv_relation_name = 'BTItemCustExt' ). "#EC NOTEXT
* iv_relation_name = 'BTOrderItemAll' ).
current = coll->get_current( ).
IF current IS NOT BOUND.
RETURN.
ENDIF.

TRY.
dref = current->get_property( 'ZZFLD000007' ). "#EC NOTEXT
CATCH cx_crm_cic_parameter_error.
ENDTRY.

CATCH cx_sy_ref_is_initial cx_sy_move_cast_error
cx_crm_genil_model_error.
RETURN.
ENDTRY.

Thanks in advance.
Rohan Hardikar.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
srinivas karri Apr 07, 2017 at 07:28 AM
1

Hello Rohan,

In the get method the initial value is set to value = 'BTAdminI not bound'. then after as per your requirement you got the relation then after your getting the 'ZZFLD000007'. this value your not passed to returning perpetrator on the get method. so this is the reason the values is showing as

'BTAdminI not bound' in that particular filed.

and one morething once you get the value set that value in set method then only the value will be visible in the web ui.

note: in setter method you have to set the value with there relations as you got the value in getter method.

Thanks & Regards,

Srinivas K.

Share
10 |10000 characters needed characters left characters exceeded
rohan hardikar May 07, 2017 at 06:34 AM
0

Hi Srinivas,

Thanks for your help!.
I have one more question - How to check in GET_ method of an attribute, whether SET_ method is triggered before ie I need to check whether SET_ method is triggered before GET_ method. Is it only possible through IMPORT/EXPORT or is there any direct way?

Thanks & Regards,
Rohan Hardikar

Share
10 |10000 characters needed characters left characters exceeded