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

创建组织单位:

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 = '01'."计划版本


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       = 1
    INVALID_OTYPE       = 2
    INVALID_DATE        = 3
    ERROR_DURING_INSERT = 4
    ERROR_EXT_NUMBER    = 5
    UNDEFINED           = 6.
IF SY-SUBRC = 0.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      WAIT = 'X'.

  WRITE LS_OBJ-OBJID.
ELSE.
  CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF.

结果:50000103

【推广】 免费学中医,健康全家人
原文地址:https://www.cnblogs.com/sapSB/p/5952188.html