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

Function OBJ_GENERATE 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 'OBJ_GENERATE'"Generate Object.
EXPORTING
* IV_KORRNUM = ' ' "Task number to be used
IV_OBJECTNAME = "Object name
IV_OBJECTTYPE = "Object Type (ONly V, T, C Allowed)
IV_MAINT_MODE = "I = Insert; U = Update; D = Delete
* IV_OBJECTTEXT = ' ' "Only required for object type T
* IV_NO_CORRECTION = ' ' "X: Change without correction
* IV_OBJCATEG = ' ' "Object Category
* IV_OBJTRANSP = ' ' "Transport Flag
* IV_DEVCLASS = ' ' "Package
TABLES
* TT_V_OBJ_S = "Piece List (Only Required for Object Type T)
* TT_OBJM = "Methods (Only AFTER_IMP, BEFORE_EXP)
EXCEPTIONS
ILLEGAL_CALL = 1 OBJECT_NOT_FOUND = 2 GENERATE_ERROR = 3 TRANSPORT_ERROR = 4 OBJECT_ENQUEUE_FAILED = 5
IMPORTING Parameters details for OBJ_GENERATE
IV_KORRNUM - Task number to be used
Data type: E070-TRKORRDefault: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
IV_OBJECTNAME - Object name
Data type: OBJH-OBJECTNAMEOptional: No
Call by Reference: No ( called with pass by value option)
IV_OBJECTTYPE - Object Type (ONly V, T, C Allowed)
Data type: OBJH-OBJECTTYPEOptional: No
Call by Reference: No ( called with pass by value option)
IV_MAINT_MODE - I = Insert; U = Update; D = Delete
Data type: OBJ_PARA-MAINT_MODEOptional: No
Call by Reference: No ( called with pass by value option)
IV_OBJECTTEXT - Only required for object type T
Data type: OBJT-DDTEXTDefault: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
IV_NO_CORRECTION - X: Change without correction
Data type: CDefault: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
IV_OBJCATEG - Object Category
Data type: OBJH-OBJCATEGDefault: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
IV_OBJTRANSP - Transport Flag
Data type: OBJH-OBJTRANSPDefault: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
IV_DEVCLASS - Package
Data type: TADIR-DEVCLASSDefault: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for OBJ_GENERATE
TT_V_OBJ_S - Piece List (Only Required for Object Type T)
Data type: V_OBJ_SOptional: Yes
Call by Reference: Yes
TT_OBJM - Methods (Only AFTER_IMP, BEFORE_EXP)
Data type: OBJMOptional: Yes
Call by Reference: Yes
EXCEPTIONS details
ILLEGAL_CALL - Invalid use of parameters
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
OBJECT_NOT_FOUND - Specified view/table does not exist
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
GENERATE_ERROR - Error occurred during generation
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
TRANSPORT_ERROR - Error occurred in correction connection
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
OBJECT_ENQUEUE_FAILED - Object could not be locked
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for OBJ_GENERATE 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_iv_korrnum | TYPE E070-TRKORR, " ' ' | |||
| lt_tt_v_obj_s | TYPE STANDARD TABLE OF V_OBJ_S, " | |||
| lv_illegal_call | TYPE V_OBJ_S, " | |||
| lt_tt_objm | TYPE STANDARD TABLE OF OBJM, " | |||
| lv_iv_objectname | TYPE OBJH-OBJECTNAME, " | |||
| lv_object_not_found | TYPE OBJH, " | |||
| lv_iv_objecttype | TYPE OBJH-OBJECTTYPE, " | |||
| lv_generate_error | TYPE OBJH, " | |||
| lv_iv_maint_mode | TYPE OBJ_PARA-MAINT_MODE, " | |||
| lv_transport_error | TYPE OBJ_PARA, " | |||
| lv_iv_objecttext | TYPE OBJT-DDTEXT, " ' ' | |||
| lv_object_enqueue_failed | TYPE OBJT, " | |||
| lv_iv_no_correction | TYPE C, " ' ' | |||
| lv_iv_objcateg | TYPE OBJH-OBJCATEG, " ' ' | |||
| lv_iv_objtransp | TYPE OBJH-OBJTRANSP, " ' ' | |||
| lv_iv_devclass | TYPE TADIR-DEVCLASS. " ' ' |
|   CALL FUNCTION 'OBJ_GENERATE' "Generate Object |
| EXPORTING | ||
| IV_KORRNUM | = lv_iv_korrnum | |
| IV_OBJECTNAME | = lv_iv_objectname | |
| IV_OBJECTTYPE | = lv_iv_objecttype | |
| IV_MAINT_MODE | = lv_iv_maint_mode | |
| IV_OBJECTTEXT | = lv_iv_objecttext | |
| IV_NO_CORRECTION | = lv_iv_no_correction | |
| IV_OBJCATEG | = lv_iv_objcateg | |
| IV_OBJTRANSP | = lv_iv_objtransp | |
| IV_DEVCLASS | = lv_iv_devclass | |
| TABLES | ||
| TT_V_OBJ_S | = lt_tt_v_obj_s | |
| TT_OBJM | = lt_tt_objm | |
| EXCEPTIONS | ||
| ILLEGAL_CALL = 1 | ||
| OBJECT_NOT_FOUND = 2 | ||
| GENERATE_ERROR = 3 | ||
| TRANSPORT_ERROR = 4 | ||
| OBJECT_ENQUEUE_FAILED = 5 | ||
| . " OBJ_GENERATE | ||
ABAP code using 7.40 inline data declarations to call FM OBJ_GENERATE
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 TRKORR FROM E070 INTO @DATA(ld_iv_korrnum). | ||||
| DATA(ld_iv_korrnum) | = ' '. | |||
| "SELECT single OBJECTNAME FROM OBJH INTO @DATA(ld_iv_objectname). | ||||
| "SELECT single OBJECTTYPE FROM OBJH INTO @DATA(ld_iv_objecttype). | ||||
| "SELECT single MAINT_MODE FROM OBJ_PARA INTO @DATA(ld_iv_maint_mode). | ||||
| "SELECT single DDTEXT FROM OBJT INTO @DATA(ld_iv_objecttext). | ||||
| DATA(ld_iv_objecttext) | = ' '. | |||
| DATA(ld_iv_no_correction) | = ' '. | |||
| "SELECT single OBJCATEG FROM OBJH INTO @DATA(ld_iv_objcateg). | ||||
| DATA(ld_iv_objcateg) | = ' '. | |||
| "SELECT single OBJTRANSP FROM OBJH INTO @DATA(ld_iv_objtransp). | ||||
| DATA(ld_iv_objtransp) | = ' '. | |||
| "SELECT single DEVCLASS FROM TADIR INTO @DATA(ld_iv_devclass). | ||||
| DATA(ld_iv_devclass) | = ' '. | |||
Search for further information about these or an SAP related objects