SAP ANST_OCS_GET_COMPONENT_STATE Function Module for Get components
ANST_OCS_GET_COMPONENT_STATE is a standard anst ocs get component state SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Get components processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for anst ocs get component state FM, simply by entering the name ANST_OCS_GET_COMPONENT_STATE into the relevant SAP transaction such as SE37 or SE38.
Function Group: ANST_SEARCH_NOTES
Program Name: SAPLANST_SEARCH_NOTES
Main Program: SAPLANST_SEARCH_NOTES
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Remote-Enabled
Update:

Function ANST_OCS_GET_COMPONENT_STATE pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'ANST_OCS_GET_COMPONENT_STATE'"Get components.
EXPORTING
IV_COMPONENT = "Software Component
IMPORTING
EV_COMP_REL = "SAP Release
EV_IS_MASTERCOMP = "State of Software Component/Subcomponent
EV_IS_SUBCOMP = "State of Software Component/Subcomponent
ES_MASTERCOMP = "Compat. Structure CVERS + Add. Info (See CVERS_SDU from 4.6)
EV_COMP_TYPE = "Single-Character Flag
EV_COMP_LEVEL = "Four-digit number
EV_COMP_SPP_LEVEL = "Four-digit number
EV_LAST_PATCH = "Support Package name
EV_LAST_SPP = "Support Package name
EV_COMP_ACTIVE = "Single-Character Flag
EV_COMP_PATCHABLE = "Single-Character Flag
EV_SFW_STATUS = "Switch Framework Status of a Software Component
EXCEPTIONS
UNKNOWN_COMPONENT = 1
IMPORTING Parameters details for ANST_OCS_GET_COMPONENT_STATE
IV_COMPONENT - Software Component
Data type: SPAM_CVERS-COMPONENTOptional: No
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for ANST_OCS_GET_COMPONENT_STATE
EV_COMP_REL - SAP Release
Data type: SPAM_CVERS-RELEASEOptional: No
Call by Reference: No ( called with pass by value option)
EV_IS_MASTERCOMP - State of Software Component/Subcomponent
Data type: COMP_STATEOptional: No
Call by Reference: No ( called with pass by value option)
EV_IS_SUBCOMP - State of Software Component/Subcomponent
Data type: COMP_STATEOptional: No
Call by Reference: No ( called with pass by value option)
ES_MASTERCOMP - Compat. Structure CVERS + Add. Info (See CVERS_SDU from 4.6)
Data type: SPAM_CVERSOptional: No
Call by Reference: No ( called with pass by value option)
EV_COMP_TYPE - Single-Character Flag
Data type: SPAM_CVERS-COMP_TYPEOptional: No
Call by Reference: No ( called with pass by value option)
EV_COMP_LEVEL - Four-digit number
Data type: SPAM_FPDEF-VERSIONOptional: No
Call by Reference: No ( called with pass by value option)
EV_COMP_SPP_LEVEL - Four-digit number
Data type: SPAM_FPDEF-VERSIONOptional: No
Call by Reference: No ( called with pass by value option)
EV_LAST_PATCH - Support Package name
Data type: PAT03-PATCHOptional: No
Call by Reference: No ( called with pass by value option)
EV_LAST_SPP - Support Package name
Data type: PAT03-PATCHOptional: No
Call by Reference: No ( called with pass by value option)
EV_COMP_ACTIVE - Single-Character Flag
Data type: SPAM_CVERS-COMP_TYPEOptional: No
Call by Reference: No ( called with pass by value option)
EV_COMP_PATCHABLE - Single-Character Flag
Data type: SPAM_CVERS-COMP_TYPEOptional: No
Call by Reference: No ( called with pass by value option)
EV_SFW_STATUS - Switch Framework Status of a Software Component
Data type: SWF_CSTATEOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
UNKNOWN_COMPONENT -
Data type:Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for ANST_OCS_GET_COMPONENT_STATE Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_ev_comp_rel | TYPE SPAM_CVERS-RELEASE, " | |||
| lv_iv_component | TYPE SPAM_CVERS-COMPONENT, " | |||
| lv_unknown_component | TYPE SPAM_CVERS, " | |||
| lv_ev_is_mastercomp | TYPE COMP_STATE, " | |||
| lv_ev_is_subcomp | TYPE COMP_STATE, " | |||
| lv_es_mastercomp | TYPE SPAM_CVERS, " | |||
| lv_ev_comp_type | TYPE SPAM_CVERS-COMP_TYPE, " | |||
| lv_ev_comp_level | TYPE SPAM_FPDEF-VERSION, " | |||
| lv_ev_comp_spp_level | TYPE SPAM_FPDEF-VERSION, " | |||
| lv_ev_last_patch | TYPE PAT03-PATCH, " | |||
| lv_ev_last_spp | TYPE PAT03-PATCH, " | |||
| lv_ev_comp_active | TYPE SPAM_CVERS-COMP_TYPE, " | |||
| lv_ev_comp_patchable | TYPE SPAM_CVERS-COMP_TYPE, " | |||
| lv_ev_sfw_status | TYPE SWF_CSTATE. " |
|   CALL FUNCTION 'ANST_OCS_GET_COMPONENT_STATE' "Get components |
| EXPORTING | ||
| IV_COMPONENT | = lv_iv_component | |
| IMPORTING | ||
| EV_COMP_REL | = lv_ev_comp_rel | |
| EV_IS_MASTERCOMP | = lv_ev_is_mastercomp | |
| EV_IS_SUBCOMP | = lv_ev_is_subcomp | |
| ES_MASTERCOMP | = lv_es_mastercomp | |
| EV_COMP_TYPE | = lv_ev_comp_type | |
| EV_COMP_LEVEL | = lv_ev_comp_level | |
| EV_COMP_SPP_LEVEL | = lv_ev_comp_spp_level | |
| EV_LAST_PATCH | = lv_ev_last_patch | |
| EV_LAST_SPP | = lv_ev_last_spp | |
| EV_COMP_ACTIVE | = lv_ev_comp_active | |
| EV_COMP_PATCHABLE | = lv_ev_comp_patchable | |
| EV_SFW_STATUS | = lv_ev_sfw_status | |
| EXCEPTIONS | ||
| UNKNOWN_COMPONENT = 1 | ||
| . " ANST_OCS_GET_COMPONENT_STATE | ||
ABAP code using 7.40 inline data declarations to call FM ANST_OCS_GET_COMPONENT_STATE
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| "SELECT single RELEASE FROM SPAM_CVERS INTO @DATA(ld_ev_comp_rel). | ||||
| "SELECT single COMPONENT FROM SPAM_CVERS INTO @DATA(ld_iv_component). | ||||
| "SELECT single COMP_TYPE FROM SPAM_CVERS INTO @DATA(ld_ev_comp_type). | ||||
| "SELECT single VERSION FROM SPAM_FPDEF INTO @DATA(ld_ev_comp_level). | ||||
| "SELECT single VERSION FROM SPAM_FPDEF INTO @DATA(ld_ev_comp_spp_level). | ||||
| "SELECT single PATCH FROM PAT03 INTO @DATA(ld_ev_last_patch). | ||||
| "SELECT single PATCH FROM PAT03 INTO @DATA(ld_ev_last_spp). | ||||
| "SELECT single COMP_TYPE FROM SPAM_CVERS INTO @DATA(ld_ev_comp_active). | ||||
| "SELECT single COMP_TYPE FROM SPAM_CVERS INTO @DATA(ld_ev_comp_patchable). | ||||
Search for further information about these or an SAP related objects