on 2020 Sep 08 1:43 PM
Dear experts,
While execution NWBC tcode, I am trying to read the fields BU_TYPE and BU_GROUP from the buffer in the MDG System, but they keep comming empty. This is what I am currently doing in the code:
CONSTANTS: lc_bp_central TYPE USMD_ENTITY VALUE 'BP_CENTRL'.
data(lr_delta_buffer) = cl_usmd_delta_buffer=>get_instance( ).
lr_delta_buffer->read_data( EXPORTING i_entity = lc_bp_central i_struct = if_usmd_model_ext=>gc_struct_key_attr
IMPORTING er_t_data_ins = data(lr_t_ins_bp_ctrl)
er_t_data_upd = data(lr_t_upd_bp_ctrl)
er_t_data_del = data(lr_t_del_bp_ctrl)
er_t_data_mod = data(lr_t_mod_bp_ctrl)
er_t_data_old = data(lr_t_old_bp_ctrl) ).
Am I too far from the correct answer? 😉
Thank you in advance!
Alm
Request clarification before answering.
Thanks for the reply. The 'USMD_RULE_SERVICE' BADI triggers only when there is a change in data during a roundtrip. In your specific case, even if it gets called during creation of BP, it would always be blank. During change of a BP, however you would see it getting filled.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Silva,
There are other ways to fetch the data of the change request but one of the simple way to fecth the current data within the change request would be
cl_usmd_gov_api=>get_instance(
EXPORTING
iv_model_name = 'BP' " Data Model
RECEIVING
ro_gov_api = DATA(lr_gov_api) " Governance API
).
lr_gov_api->if_usmd_gov_api_cr_data~get_crequest_data(
EXPORTING
iv_crequest_id = iv_cr " Change Request
IMPORTING
et_entity_data_inactive = data(lt_cr_data) " Data for Entity Types
).
data(ls_bupa) = lt_cr_data[ usmd_entity = 'BP_HEADER' STRUCT = 'KATTR' usmd_entity_cont = ' ']. " Data must be in ls_bupa
Regards
Pavan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Pavan,
I tried implemmenting your solution, but I cannot use this API in my BADI, I am receiving a short dump.
In the code, there is a comment from SAP why it does not allow me to get the instance cl_usmd_gov_api=>get_instance:
* programming error: gov api must not be instanciated after / used from outside convenience api"
ASSERT cl_usmd_conv_som_gov_api=>check_instance_exists( iv_model_name ) = abap_false.
Thank you very much for your inputs!
BR,
Alm
Yes you are correct , you cannot instantiate the GOV api again in this badi implementation.But if you keenly observe there is already an instance of CL_USMD_MODEL_EXT which will be the part of signature where you also have access to the methods to read entity data BP_HEADER of structure type KATTR .
The NWBC tcode is to launch all the MDG roles you have which in turn launches all the MDG access like Material, Customer, Supplier, Business Partner and FI views. Can you please share what exact steps are you performing and what is the exact use-case?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 18 | |
| 7 | |
| 6 | |
| 6 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.