Hey everyone,
I'm trying to control visibility of field custom on shop cart in SRM. Below follow the process executed for me to control fields.
The process of Shop Cart here is:
a) We have 4 types of Cart: "Claim Cart", "Tooling Cart", "DQF Cart" and "Freight Cart".
b) For the type Freight Cart, some options will appear in the screen for choice.
c) Insert an item normally in the field Prod. ID and click in details. The fields included in customizing SPRO will appear.
d) For each option of freight I have control which fields should appear in details.
My solution.
1º -> I've included the fields in Structure via SPRO customizing and Control Metadata(All fields that I have to control, I've setting like Not Visible).
2º -> I have created a enhancement for to control visibility in component /SAPSRM/WDC_DODC_SC_I_BD, View V_DODC_SC_I_BD.
For the choice freight I search in table Z the fields that should appear in details and hide the others fields.
Code:
" Caminho no Context
v_path = `ITEM_BASIC_DATA`.
" Busca Context WebDynpro
o_context_items = wd_context->path_get_node( path = v_path ).
IMPORT button TO v_button FROM MEMORY ID 'SHOP_CART'.
" Verifica se houve retorno com sucesso
IF o_context_items IS BOUND.
SELECT *
FROM ztbsrm_screen
INTO CORRESPONDING FIELDS OF TABLE t_screen
WHERE zz_screen = 'DOTC_BASIC'.
IF sy-subrc IS INITIAL.
SELECT *
FROM ztbsrm_process
INTO CORRESPONDING FIELDS OF TABLE t_process
FOR ALL ENTRIES IN t_screen
WHERE zz_process = t_screen-zz_process.
IF NOT sy-subrc IS INITIAL.
RETURN.
ENDIF.
SELECT *
FROM ztbsrm_fields
INTO CORRESPONDING FIELDS OF TABLE t_fields
FOR ALL ENTRIES IN t_process
WHERE zz_process = t_process-zz_process
AND zz_option = t_process-zz_option.
IF NOT sy-subrc IS INITIAL.
RETURN.
ENDIF.
" Deleta
DELETE t_fields WHERE NOT zz_radiobutton EQ v_button.
LOOP AT t_fields ASSIGNING <fs_field>.
" Limpa Work Area
CLEAR: wa_properties,
v_campo.
" Move nome do campo
v_campo = <fs_field>-zz_field.
" Busca elemento de tela
o_element = o_context_items->get_element( ).
" Verifica Retorno
IF o_element IS BOUND.
o_context_items->set_attribute_property(
EXPORTING
attribute_name = v_campo
property = o_element->e_property-visible
value = abap_true
).
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
My problem is:
The fields are not hidden. All fields display in screen and the control of visibility is not working correctly.
Thanks any help.
Regards.