Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Make EKKO-ZTERM non editable in ME21N ME22N

maria_merino
Active Participant
0 Kudos
1,691

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

3 REPLIES 3

Abinathsiva
Active Contributor
872

Hi,

instead try method PROCESS_HEADER

MateuszAdamus
Active Contributor
872

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:

  • '-' Field is suppressed
  • '*' Field is purely a display field
  • '.' Input field
  • '+' Mandatory field

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

0 Kudos
872

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,
Mateusz