SAP CVAUTH_SET_INITIAL_AUTH Function Module for Setting initial authorization
CVAUTH_SET_INITIAL_AUTH is a standard cvauth set initial auth SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Setting initial authorization 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 cvauth set initial auth FM, simply by entering the name CVAUTH_SET_INITIAL_AUTH into the relevant SAP transaction such as SE37 or SE38.
Function Group: CV_AUTH01
Program Name: SAPLCV_AUTH01
Main Program: SAPLCV_AUTH01
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function CVAUTH_SET_INITIAL_AUTH 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 'CVAUTH_SET_INITIAL_AUTH'"Setting initial authorization.
EXPORTING
DOKNR = "Document number
DOKAR = "Document type
DOKTL = "Document part
DOKVR = "Document version
* ADMIN = SY-UNAME "SAP System, User Logon Name
* FL_COMMIT_WAIT = 'X' "Boolean Variable (X=True, -=False, Space=Unknown)
IMPORTING
ERROR_MESSAGE = "Message Text
EXCEPTIONS
ERROR = 1 GUID_EXISTS = 2
IMPORTING Parameters details for CVAUTH_SET_INITIAL_AUTH
DOKNR - Document number
Data type: DOKNROptional: No
Call by Reference: No ( called with pass by value option)
DOKAR - Document type
Data type: DOKAROptional: No
Call by Reference: No ( called with pass by value option)
DOKTL - Document part
Data type: DOKTL_DOptional: No
Call by Reference: No ( called with pass by value option)
DOKVR - Document version
Data type: DOKVROptional: No
Call by Reference: No ( called with pass by value option)
ADMIN - SAP System, User Logon Name
Data type: SY-UNAMEDefault: SY-UNAME
Optional: Yes
Call by Reference: No ( called with pass by value option)
FL_COMMIT_WAIT - Boolean Variable (X=True, -=False, Space=Unknown)
Data type: DATATYPE-BOOLEANDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for CVAUTH_SET_INITIAL_AUTH
ERROR_MESSAGE - Message Text
Data type: BAPIRET2-MESSAGEOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
ERROR -
Data type:Optional: No
Call by Reference: Yes
GUID_EXISTS -
Data type:Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for CVAUTH_SET_INITIAL_AUTH 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_doknr | TYPE DOKNR, " | |||
| lv_error | TYPE DOKNR, " | |||
| lv_error_message | TYPE BAPIRET2-MESSAGE, " | |||
| lv_dokar | TYPE DOKAR, " | |||
| lv_guid_exists | TYPE DOKAR, " | |||
| lv_doktl | TYPE DOKTL_D, " | |||
| lv_dokvr | TYPE DOKVR, " | |||
| lv_admin | TYPE SY-UNAME, " SY-UNAME | |||
| lv_fl_commit_wait | TYPE DATATYPE-BOOLEAN. " 'X' |
|   CALL FUNCTION 'CVAUTH_SET_INITIAL_AUTH' "Setting initial authorization |
| EXPORTING | ||
| DOKNR | = lv_doknr | |
| DOKAR | = lv_dokar | |
| DOKTL | = lv_doktl | |
| DOKVR | = lv_dokvr | |
| ADMIN | = lv_admin | |
| FL_COMMIT_WAIT | = lv_fl_commit_wait | |
| IMPORTING | ||
| ERROR_MESSAGE | = lv_error_message | |
| EXCEPTIONS | ||
| ERROR = 1 | ||
| GUID_EXISTS = 2 | ||
| . " CVAUTH_SET_INITIAL_AUTH | ||
ABAP code using 7.40 inline data declarations to call FM CVAUTH_SET_INITIAL_AUTH
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 MESSAGE FROM BAPIRET2 INTO @DATA(ld_error_message). | ||||
| "SELECT single UNAME FROM SY INTO @DATA(ld_admin). | ||||
| DATA(ld_admin) | = SY-UNAME. | |||
| "SELECT single BOOLEAN FROM DATATYPE INTO @DATA(ld_fl_commit_wait). | ||||
| DATA(ld_fl_commit_wait) | = 'X'. | |||
Search for further information about these or an SAP related objects