2020 May 21 10:00 AM
Hi experts,
is it possible to make non-editable field EKKO-ZTERM in ME21N and ME22N depending on a condition? I'm triing to do it in IF_EX_ME_PROCESS_PO_CUST~FIELDSELECTION_HEADER but I don't know how.
thanks in advance,
Maria
2020 May 21 11:12 AM
2020 May 21 11:13 AM
Hi maria.merino
I read the BADI documentation and debugged a bit and here is what I found out.
In the FIELDSELECTION_HEADER method of the BADI you need to assign the field ID and display option:
You can find the field IDs in the type pool MMMFD.
In the method of your the BADI code should look something like this.
TYPE-POOLS:
mmmfd.
DATA:
ls_field_selection TYPE mmpur_fs.
ls_field_selection-metafield = mmmfd_pmnttrms.
ls_field_selection-fieldstatus = '*'. " display
INSERT ls_field_selection INTO TABLE ch_fieldselection
However, the issue is that this method is called only if there is a custom field on one of the tabs of the header screen (custom fields tab). You can see this in function MEPOBADI_FS_HEADER.
The MMMFD_CUST_01 is defined as follows.
The method is commented as a firewall, as it's supposed to prevent from changing standard fields' attributes, but once you get the BADI method to be called, the logic I showed works. The filtering part does not prevent from anything, except the BADI method being called.
To add this custom screen with custom fields you need to implement BADI ME_GUI_PO_CUST and in that BADI add new screen to the transaction.
You can check examples prepared by SAP, both for ME_GUI_PO_CUST and ME_PROCESS_PO_CUST BADIs:
- CL_EXM_IM_ME_GUI_PO_CUST
- CL_EXM_IM_ME_PROCESS_PO_CUST
Hope this helps.
Regards,
Mateusz
2020 May 21 11:42 AM
Hi
Another way would be to dynamically select a screen variant prepared beforehand (with the field disabled).
This can be done in method FIELDSELECTION_HEADER_REFKEYS of ME_PROCESS_PO_CUST BADI.
IF condition = abap_true.
ch_key0 = 'SOME_SCREEN_VARIANT_NAME'.
ENDIF.
Regards,