自开发程序调用创建文档屏幕CV01N功能

1.DC10配置 对象号

  1. call subscreen sub1602a including 'SAPLCV140' '0206'.

一个OBJKY可对应多个文档编号.
OBJKY可自定义
创建后的文档显示, DRAD抓取自定义OBJKY传参即可。

data:gs_drad type drad.
clear gs_drad.
*  GS_DRAD-MANDT = SY-MANDT.
  gs_drad-dokob = c_s_docm-dokob. "'ZTPM_BGSQ'
  gs_drad-obzae = '0000'.             " 计数器码

  if gs_drad-objky is initial.
    gs_drad-objky =  '000000000000'.  " 文档管理对象码
  endif.

  call function 'CV140_LINKS_INIT'.

  call function 'CV140_LINKS_CREATE_WORKAREA'
    exporting
      ps_drad      = gs_drad
*     PF_OPCODE    = G_OPCODE
*     PF_REFRESH   = ''
*     PF_NO_READ_TEXT       = ' '
*     PF_SET_TCODE =
    exceptions
      not_found    = 1
      record_exist = 2
      others       = 3.

  if gv_nedit is not initial.
    g_opcode = '3'.
  else.
    g_opcode = '2'."可编辑
  endif.

  call function 'CV140_LINKS_SCREEN'
    exporting
*     PF_INCLUDE_DYNPRO        = ' '
      pf_opcode       = g_opcode
      pf_sub_screen   = 'X'
*     PF_VORSCHLAG_DOKAR       =
      pf_dokob        = gs_drad-dokob
      pf_objky        = gs_drad-objky
      pf_check_exist  = 'X'
      pf_actuell_show = 'X'.


“保存
 call function 'CV140_LINKS_SAVE'
    exceptions
      error  = 1
      others = 2.
  if sy-subrc <> 0.

    message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.

”对象号 修改一次
  call function 'CV140_LINKS_CHANGE'
    exporting
      pf_dokob        = l_drad-dokob
      pf_objky_new    = l_drad-objky
      pf_objky_old    = '000000000000'
    exceptions
      not_found       = 1
      error_exist     = 2
      error_enque     = 3
      error_authority = 4
      others          = 5.
  if sy-subrc > 1.
    message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.

  call function 'CV140_LINKS_SAVE'
    exceptions
      error  = 1
      others = 2.

  commit work and wait.

你可能感兴趣的:(自开发程序调用创建文档屏幕CV01N功能)