‎2010 Aug 22 1:40 PM
Hi experts,
Can anyone please explain what the below FM performs:
==================================
FUNCTION Z.
*"----
""Local Interface:
*" IMPORTING
*" REFERENCE(CHRT_ACCTS) TYPE /BI0/OICHRT_ACCTS
*" REFERENCE(ACCOUNT) TYPE /BI0/OIACCOUNT
*" REFERENCE(CO_AREA) TYPE /BI0/OICO_AREA
*" REFERENCE(ZPC) TYPE /BIC/OIZPC
*" REFERENCE(KEY_MUST_BE_FOUND) TYPE BOOLEAN DEFAULT 'X'
*" REFERENCE(MSGTY) TYPE SYMSGTY DEFAULT 'I'
*" REFERENCE(GET_FIRST_ENTRY) TYPE BOOLEAN DEFAULT 'X'
*" REFERENCE(DATETO) TYPE RSDATETO
*" REFERENCE(DATEFROM) TYPE RSDATEFROM OPTIONAL
*" REFERENCE(RECNO) TYPE SYTABIX OPTIONAL
*" TABLES
*" ZZ STRUCTURE /BIC/AZZ00
*" MONITOR STRUCTURE RSMONITOR OPTIONAL
*" MONITOR_RECNO STRUCTURE RSMONITORS OPTIONAL
*"----
CLEAR ZZ.
ZZ-chrt_accts = chrt_accts.
ZZ-account = account.
ZZ-co_area = co_area.
ZZ-/bic/zpc = zpc.
ZZ-datefrom = datefrom.
ZZ-dateto = dateto.
REFRESH ZZ.
PERFORM z1000_read_ZZ TABLES ZZ
USING get_first_entry.
return values found in table or raise exception
IF ZZ[] IS INITIAL
AND key_must_be_found = 'X'.
PERFORM z1000_set_return_message
TABLES monitor
USING msgty 'YFI_MIR' '013'
'ZZ' chrt_accts
account co_area.
PERFORM z9999_return_message_recno
TABLES monitor_recno
USING msgty 'YFI_MIR' '013'
'ZZ chrt_accts
account co_area
recno.
ENDIF.
ENDFUNCTION.
=========================================
In our case there are 2 records in the table ZZ, of which the FM should pick the latest record but it is picking the old record.
Can anyone please check where the error is and any correction I have to make inorder to rectify the error.
I suppose we need to change in the following line
PERFORM z1000_read_ZZ TABLES ZZ
USING get_first_entry.
Regards,
Bhadri M.
‎2010 Aug 22 5:11 PM
You can sort the ZZ table records based on your logic by which you want to have the latest record.