on 06-12-2015 3:16 PM
Hi Gurus,
Can you please help me with the logic to automatically populate Material Long text in SAP MDG-M? I am able to auto populate material short text using some characterics values. I need the logic for Material long text.
I am using Badi USMD_RULE_SERVICE_CROSS_ET Method IF_EX_USMD_RULE_SERVICE2~DERIVE.
Code:
CALL METHOD io_model->create_data_reference
EXPORTING
i_fieldname = if_mdg_bs_mat_gen_c=>gc_fieldname_bscdattxt
i_struct = if_usmd_gov_api_entity=>gc_struct_key_txt "gc_struct_key_txt_langu
i_tabtype = if_usmd_model_ext=>gc_tabtype_standard
IMPORTING
er_data = lrt_entity_data.
ASSIGN lrt_entity_data->* TO <lt_description1>.
In <lt_description1> I am not getting NOTEBSCDA field. So I am not able to populate the value for this field with long text.
I am using below coe to write data but it is not working.
CALL METHOD io_write_data->write_data
EXPORTING
i_entity = if_mdg_bs_mat_gen_c=>gc_entity_bscdattxt
it_key = lt_key
it_attribute = lt_attribute1
it_data = <lt_description1>.
Please help me with the proper code. Quick response will be appreciated.
Hi, try using GC_STRUCT_KEY_ATTR instead of gc_struct_key_txt
Regards, Ingo Bruß
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Arnab,
can you please help me how to implement the BADI to read the characteristics name and characteristics values and then populate that to material long text in SAP MDG - M.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Giridhar,
Go to SE18 and input the BAdi 'USMD_RULE_SERVICE'. You'll get 2 BAdis inside. 'USMD_RULE_SERVICE_CROSS_ET' has an example implementation 'MDG_BS_MAT_CLF2DESCRIPTION'. Copy that when you are creating your custom implementation. You can get the idea on how short text is populated.
Use below code to update long text:
***--Update Long Text
CALL METHOD io_model->create_data_reference
EXPORTING
i_fieldname = if_mdg_bs_mat_gen_c=>gc_fieldname_bscdattxt
i_struct = if_usmd_gov_api_entity=>gc_struct_key_attr
i_tabtype = if_usmd_model_ext=>gc_tabtype_standard
IMPORTING
er_data = lrt_entity_data.
ASSIGN lrt_entity_data->* TO <lt_description1>.
***--Insert description in logon language
INSERT INITIAL LINE INTO TABLE <lt_description1> ASSIGNING <ls_description1>.
ls_description1-material = <lv_matnr>.
ls_description1-langucode = sy-langu.
CONCATENATE lv_class_desc lc_semicolon INTO ls_description1-notebscda.
MOVE-CORRESPONDING ls_description1 TO <ls_description1>.
CREATE DATA lr_descr_struc1 LIKE LINE OF <lt_description1>.
lo_structdescr1 ?= cl_abap_structdescr=>describe_by_data_ref( p_data_ref = lr_descr_struc1 ).
LOOP AT lo_structdescr1->components ASSIGNING <lf_component1>.
INSERT <lf_component1>-name INTO TABLE lt_attribute1.
ENDLOOP.
CALL METHOD io_write_data->write_data
EXPORTING
i_entity = if_mdg_bs_mat_gen_c=>gc_entity_bscdattxt
it_key = lt_key
it_attribute = lt_attribute1
it_data = <lt_description1>.
Hope this will resolve your query.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.