According to your needs, you can use FM AIP9_STATUS_READ or FM STATUS_READ.
FM AIP9_STATUS_READ
DATA : lv_objnr TYPE j_objnr,
lv_system_status TYPE j_stext, " (CHAR40)
lv_user_status TYPE j_stext. " (CHAR40)
CONCATENATE 'OR' gv_aufnr INTO lv_objnr.
CALL FUNCTION 'AIP9_STATUS_READ'
EXPORTING
i_objnr = lv_objnr
i_spras = sy-langu
IMPORTING
e_sysst = lv_system_status
e_anwst = lv_user_status.
This will return in each wa list of system and user external status (in requested language) separated by space.
FM STATUS_READ :
DATA : lv_objnr TYPE j_objnr,
lt_status TYPE STANDARD TABLE OF jstat,
lv_status_schema TYPE j_stsma.
CONCATENATE 'OR' gv_aufnr INTO lv_objnr.
CALL FUNCTION 'STATUS_READ'
EXPORTING
objnr = lv_objnr
only_active = 'X'
IMPORTING
stsma = lv_status_schema
TABLES
status = lt_status
EXCEPTIONS
object_not_found = 1
OTHERS = 2.
This will return internal status id in LT_STATUS.
Read More