This page created to clarify the application logic and customizing behind Field Selection in Purchase Requisition.
Field Selection determines whether a field should be editable/disabled, visible/hidden, mandatory/optional, when users display, edit or create the Purchase Requisition.
The Field Selection Customizing can be found in the following OLME paths:
- General: Purchase Requisition -> Define Screen Layout at Document Level,
- Account Assignment related: Account Assignment -> Maintain Account Assignment Categories.
The general customizing contains many different field selections and it is not always easy to determine, which one is used in different cases. Moreover, there are also different logic, which can overwrite the customizing dynamically.
By following the Debugging Guide, you can determine, which Field Selection is used and why the field is displayed as system displays it.
Before starting the debugging, press F1 on the relevant field that you would like to debug and click button Technical Information (hammer icon). Here copy the table and field name such as [table name]-[field name].
In case of Material field, it will look like MEREQ3319-MATNR.
The next steps will differ, if you would like to debug a tab or the item overview table.
- In case tab debugging, set a breakpoint in Include LMEREQF05 Method GET_FIELDSELECTION. When you display a tab, the breakpoint will stop. At this point you can skip to section Debugging Guide.
- In case of overview table, set a breakpoint in Method BUILD_GRID_LAYOUT of class CL_GRID_VIEW_MM. When you display the overview table or change a value in it, the breakpoint will stop. At the middle of this Method you can find a LOOP statement.
This loop is responsible to gather the field selection for each line of the overview table (blanks too). Continue to the LOOP step, which has the same index as the index of the relevant row in overview table (in case you would like to debug the first row, you need the first loop step). When you reached the relevant LOOP step, set a breakpoint in Include LMEREQF05 Method GET_FIELDSELECTION. For further steps refer to the next section (Debugging Guide).
At this point you are in debugging mode in Method GET_FIELDSELECTION. Before continuing with debugging, in the call stack double-click event FS_GET.
Then add MY_DYNPRO_FIELDS in Variables section and double-click it.
In the table, in column SCREENNAME locate the field name that you copied at the beginning and copy the value in METAFIELD column. We will need this value later. If you got the value, in call stack go back to event GET_FIELDSELECTION and make sure you see the below coding logic.
At the beginning of the Method, system gathers some customizing data based on document, item type, accounting field selection, release strategy data, then it populates the field selection keys (l_key0 - l_key6).
Afterwards, system calls BAdI that can modify the standard field selection keys.
Here check, if the BAdI changes the field selection keys, because these will be used in the next call, where system gathers the field selection customizing.
System fills the data in L_MASK structure, but it is not yet in readable form, so we can ignore it at this point.
Afterwards, system loops at all fields that are available in table CH_FIELDSELECTION and sets the found field selection configuration for each.
You can continue at the end of the LOOP.
Now open table CH_FIELDSELECTION. Based on the METAFIELD value that we copied at the beginning of the debugging, gather the value of FIELDSTATUS column. You can find the meaning of the value below:
- . = Optional
- + = Required
- * = Display
- - = Hidden
If the value is not expected, it means that the issue occurs due to incorrect customizing. Show the field selection keys by adding the variables (l_key0 – l_key6) in the variables section.
Then go into OLME path Purchase Requisition -> Define Screen Layout at Document Level and verify the previously found field selection keys. Or if you debugging account assignment fields, execute transaction OME9 and double click the used account assignment category to review the relevant field selection customizing.
If the value is correct until this point, it means that the customizing is correct. Besides the field selection customizing, there can be special rules for each field that overwrites the customizing dynamically. To review the dynamic logic, continue the debugging. There will be another loop on table CH_FIELDSELECTION and system will call the dynamic logic (Method COMPUTE_FIELDSTATUS), if exists.
Open table CH_FIELDSELECTION again and based on the METAFIELD value that we copied at the beginning of the debugging, check the index of relevant line (first column). Continue to the LOOP step that has the same index as the index of the line in CH_FIELDSELECTION and go into (F5) Method COMPUTE_FIELDSTATUS.
In Method COMPUTE_FIELDSTATUS you will find individual logic that populates l_ctxt->fs-fieldstatus with the following values:
- . = Optional
- + = Required
- * = Display
- - = Hidden
Review whether the coding changes FIELDSTATUS unexpectedly.
If the value is still correct, press F7 to return into Method FS_GET. Here system calls the BAdI (ME_PROCESS_REQ_CUST) that can be used to implement custom dynamic logic to determine the field selection for custom fields.
After the BAdI is called, verify if the field status was changed in CH_FIELDSELECTION based on the METAFIELD value, because this is the last logic that can modify the field selection.
Community Wiki - Field Selection in Purchase Order - Debugging Guide
Community Wiki - Field Selection in Contract and Scheduling Agreement - Debugging Guide