To get material revision level use the function module "REVISION_LEVEL_SELECT".
See the below sample code.
CALL FUNCTION 'REVISION_LEVEL_SELECT'
EXPORTING
aeobj = '4'
datuv = sy-datum
matnr = wa_po-matnr
IMPORTING
arevlv = wa_out-revlm
EXCEPTIONS
date_not_found = 1
ecn_not_found = 2
ecn_no_revision = 3
input_incomplete = 4
input_inconsistent = 5
revision_not_found = 6
version_not_found = 7
OTHERS = 8.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Object 4 means for material. You need to pass the date, revision level on date. If you don't pass date you will not get results.
See the below sample code.
CALL FUNCTION 'REVISION_LEVEL_SELECT'
EXPORTING
aeobj = '4'
datuv = sy-datum
matnr = wa_po-matnr
IMPORTING
arevlv = wa_out-revlm
EXCEPTIONS
date_not_found = 1
ecn_not_found = 2
ecn_no_revision = 3
input_incomplete = 4
input_inconsistent = 5
revision_not_found = 6
version_not_found = 7
OTHERS = 8.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Object 4 means for material. You need to pass the date, revision level on date. If you don't pass date you will not get results.