I am working on a SAP query and using some ABAP code in a field, I have the following code:
Get period for material from MBEWH* tables: MBEWH. clear Z_MBEWH_LFMON. select * from MBEWH where MATNR = MBEW-MATNR and BWKEY = MBEW-BWKEY and LFGJA = Z_MBEWH_LFGJA. Z_MBEWH_LFMON = MBEWH-LFMON. endselect.
The problem I have is I need to sort the data by the LFMON field and get the last record, can you tell me what change I need in the above code?