on 09-22-2015 12:07 PM
Hi ,
I am initializing the AD_POSTAL entity for business partner using BAdI IF_EX_USMD_RULE_SERVICE2~DERIVE method.
This Badi method gets triggered when the maintenance window is loaded for the first time but the default values for attributes of AD_Postal entity which I am setting using the Badi is not reflected on the UI .
However when I press the return key or try to set manually for one of the attributes of AD_POSTAL entity all the default values which has been set earlier using the Badi gets updated on the UI .
I am facing the same issue even when i tried updating this entity with the enhancement in feeder class.
Any clue regarding this Issue .
Here is my code :
**** *******************************************
Creating Data Reference for AD_POSTAL
**** *******************************************
**** Initializing attributes of AD_POSTAL entity ***********************************************************************************
ASSIGN COMPONENT 'BP_HEADER' of structure <ls_data_ad_postal_new> to <lv_system_new>.
<lv_system_new> = lv_bp_header.
ASSIGN COMPONENT 'ADDRNO' of structure <ls_data_ad_postal_new> to <lv_system_new>.
<lv_system_new> = gs_temp_key_addr. " Address Number Generated from FM NUMBER_GET_NEXT
ASSIGN COMPONENT 'REF_POSTA' of structure <ls_data_ad_postal_new> to <lv_system_new>.
<lv_system_new> = 'DE'.
ASSIGN COMPONENT 'city1' of structure <ls_data_ad_postal_new> to <lv_system_new>.
<lv_system_new> = 'Berlin'.
***********************************************************************************
INSERT <ls_data_ad_postal_new> INTO TABLE <lt_data_ad_postal_new>.
CREATE DATA lr_data_struc LIKE LINE OF <lt_data_ad_postal_new>.
lo_struct_data ?= cl_abap_structdescr=>describe_by_data_ref( p_data_ref = lr_data_struc ).
CLEAR: lt_attribute.
LOOP AT lo_struct_data->components ASSIGNING <lf_component>.
INSERT <lf_component>-name INTO TABLE lt_attribute.
ENDLOOP.
"************************write the data************************************************
TRY.
io_write_data->write_data(
EXPORTING
i_entity = 'AD_POSTAL'
it_attribute = lt_attribute
it_data = <lt_data_ad_postal_new> ).
CATCH cx_usmd_write_error. " Error During Write Access RETURN.
ENDTRY.
Regards,
Vicky
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raghu,
I tried as mentioned in the document . Created an implicit enhancement in PROCESS_EVENT .
Still Get this runtime error .
ERROR: Entry parameter of method CL_CRM_BOL_ENTITY ->SET_PROPERTY contains value REF_POSTA, which is not allowed (termination: RABAX_STATE).
Here is my Code :
Data: ls_cr_attributes TYPE /mdgbp/_s_bp_pp_ad_postal.
Data: lv_street type AD_STREET value 'STREET'.
"******loads all attributes of AD_POSTAL entity
MO_ENTITY->IF_BOL_BO_PROPERTY_ACCESS~GET_PROPERTIES(
importing
ES_ATTRIBUTES = LS_CR_ATTRIBUTES
).
*All the Attributes of AD_POSTAL is loaded in LS_CR_ATTRIBUTES.
MO_ENTITY->IF_BOL_BO_PROPERTY_ACCESS~SET_PROPERTY(
exporting
IV_ATTR_NAME = 'REF_POSTA'
IV_VALUE = 'DE'
).
MO_ENTITY->IF_BOL_BO_PROPERTY_ACCESS~SET_PROPERTY(
exporting
IV_ATTR_NAME = 'STREET'
IV_VALUE = 'Goethe'
).
Regards,
VIcky
Hi Vicky,
you're using an invalid structure for ls_cr_attributes. If you work with MO_ENTITY, it's mandatory to use the UI structures, but not the MDG structures. If you want to be bit more generic, you can retrieve the actual structure from MO_ENTITY itself. Check the related methods!
Best regards
Michael
Hi Vicky,
As your original code works on an event, I would assume that you just need to trigger that event at the end of the derive BADI to have it open up with the fields derived.
This could be achieved with the following code:
data: lo_fpm type ref to if_fpm,
lo_event type ref to cl_fpm_event.
create object lo_event
exporting
iv_event_id = 'ROUNDTRIP'.
lo_fpm = cl_fpm_factory=>get_instance( ).
lo_fpm->raise_event( io_event = lo_event ).
May not work but worth a shot?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.