HR函数学习01——创建组织单位

时间:2023-06-02 18:14:44

创建组织单位:

RH_OBJECT_CREATE

REPORT ZLYHR01.

DATA:LS_OBJ    TYPE OBJEC,
LV_STU TYPE GDSTR-SVECT,
LV_TIT TYPE CHAR20,
LV_SUBTYP TYPE SUBTYP,
LS_P1000 TYPE P1000,
LT_P1000 TYPE TABLE OF P1000. LS_OBJ-OTYPE = 'O'."对象类型
LS_OBJ-PLVAR = ''."计划版本 CALL FUNCTION 'RH_OBJECT_CREATE'
EXPORTING
* LANGU = SY-LANGU
PLVAR = LS_OBJ-PLVAR
OTYPE = LS_OBJ-OTYPE
* EXT_NUMBER = '00000000'
SHORT = '测试组织单元'
STEXT = '测试组织单元'
* BEGDA = SY-DATUM
* ENDDA = '99991231'
* OSTAT = '1'
* VTASK = 'D'
* GUID =
* KEEP_LUPD = ' '
IMPORTING
OBJID = LS_OBJ-OBJID
EXCEPTIONS
TEXT_REQUIRED =
INVALID_OTYPE =
INVALID_DATE =
ERROR_DURING_INSERT =
ERROR_EXT_NUMBER =
UNDEFINED = .
IF SY-SUBRC = .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'. WRITE LS_OBJ-OBJID.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF.

结果:50000103