SAP ABAP 代码修改自动比较对象版本一致

news2024/11/25 19:16:53

第一步,找到SE38/SE37代码修改的出口
SMOD中查找
第二步,实施增强
CMOD中添加增强并激活,如下图
在这里插入图片描述
第三步,添加代码
在这里插入图片描述

在这里插入图片描述
如上图两个双击添加并修改代码
ZXSEUU08中与 ZXSEUU01代码一致,如下

*&---------------------------------------------------------------------*
*&  包含                ZXSEUU01
*&---------------------------------------------------------------------*
if  objectname <> 'ZXSEUU01'.
*  break jordan.
**  只要编辑就检查一下
*  CHECK sy-uname = 'JORDAN'.
  check operation eq 'MODIFY'.
  check sy-tcode = 'SE37'.
  data:lv_object type tadir-object.
  case sy-tcode.
    when 'SE38'.
      lv_object = 'PROG'.
    when 'SE37'.
      lv_object = 'FUNC'.
    when others.
  endcase.
  data ls_yabap_check_001 type yabap_check_001.
  select single * from yabap_check_001
    into ls_yabap_check_001 where bname eq sy-uname and object = '' and objname = ''.
  if sy-subrc is initial.
    if ls_yabap_check_001-datum is initial.
      exit.
    elseif ls_yabap_check_001-datum >= sy-datum.
      exit.
    endif.
  else.
    select single * from yabap_check_001
        into ls_yabap_check_001
       where bname eq sy-uname and object = lv_object
       and objname = objectname and datum = sy-datum
       and disregard = abap_true  "空为已激活
      .
    if sy-subrc is initial.
      exit.
    endif.
  endif.


  clear lw_yabap_check_002.
  perform get_version using objectname  lv_object changing lw_yabap_check_002.

  clear lw_yabap_check_002.
  data:lt_tfdir type table of tfdir,
       lw_tfdir type tfdir.

*** step1 获取主函数
  select single * from    tfdir
    into lw_tfdir where  funcname = objectname.
  check sy-subrc is initial.
  select * from    tfdir
    into table lt_tfdir where  pname = lw_tfdir-pname.
  if sy-subrc is  initial.
    loop at lt_tfdir assigning field-symbol(<fs_tfdir>).
*******      限制输出条目数,以免返回的过数过大,使人无法评估
      describe table lt_yabap_check_002 lines data(lv_lines).
      if lv_lines > 50.
        exit.
      endif.
*      IF lw_wbcrossi-include IS NOT INITIAL.  标准函数出口,这个include是没有版本的
      if <fs_tfdir>-funcname is not initial.
        read table lt_yabap_check_002 with  key objname = <fs_tfdir>-funcname transporting no fields.
        if sy-subrc is initial.
****          已经在的情况焉,那么不需要再列出来,以免无限循环
          continue.
        endif.
        clear lw_yabap_check_002.
        lw_yabap_check_002-objname_link = objectname.
        perform get_version using <fs_tfdir>-funcname  lv_object changing lw_yabap_check_002.
      endif.
    endloop.
  endif.
****  step2 获取函数外的子例程
*************除了函数,把其他的pefrorm子例程也查出来检查版本,主要就是top与f01 f02这种
  data:lt_wbcrossi type table of wbcrossi,
       lw_wbcrossi type wbcrossi.

  data:lv_object_prog type tadir-object value 'PROG'.
  select * from wbcrossi
    into table lt_wbcrossi
    where otype = 'IC' and master = lw_tfdir-pname and include = lw_tfdir-pname .
  if sy-subrc is  initial.
    loop at lt_wbcrossi into lw_wbcrossi.
      describe table lt_yabap_check_002 lines lv_lines.
      if lv_lines > 50.
        exit.
      endif.
      if lw_wbcrossi-name is not initial.
        read table lt_yabap_check_002 with  key objname = lw_wbcrossi-name transporting no fields.
        if sy-subrc is initial.
****          已经在的情况焉,那么不需要再列出来,以免无限循环
          continue.
        endif.
        clear lw_yabap_check_002.
        lw_yabap_check_002-objname_link = lw_tfdir-pname.
        perform get_version using lw_wbcrossi-name  lv_object_prog  changing lw_yabap_check_002.
      endif.
    endloop.
  endif.
  gv_object = lv_object.
  gv_objectname = objectname.
  sort lt_yabap_check_002 by suggest descending.
  perform show_alv.
endif.

另外有表如下,这个表主要是记录检查的日志
在这里插入图片描述
其他include如下
ZXSEUF01 获取对象相关
ZXSEUF02 alv显示相关
ZXSEUF03 代码比较相关
lsvrif18 标准代码的一些inculde (都在 ZXSEUZZZ中添加)
ZXSEUTOP 变量定义及声明
放同一个include也没事

*----------------------------------------------------------------------*
***INCLUDE ZXSEUF01.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Form  GET_VERSION_LIST_REMOTE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_DIR_OBJTYPE  text
*      -->P_DIR_OBJNAME  text
*      <--P_NO_ENTRY  text
*----------------------------------------------------------------------*
form get_version_list_remote tables to_vrs_dir_vrs structure vrsd
                              using pi_objtype pi_objname pi_dir_destination
                              changing po_no_entry
                               .

  data: old_state type bool.

  refresh: vrs_dir_vrs, logvers_dir.

  perform check_vc_state_remote using pi_dir_destination changing old_state.

  if old_state = true.
    perform get_old_fashioned_versdir using pi_objtype pi_objname pi_dir_destination
                                      changing po_no_entry.
  else.
    call function 'SVRS_GET_VERSION_DIRECTORY_46'
      exporting
        destination            = pi_dir_destination
        objname                = pi_objname
        objtype                = pi_objtype
      tables
        version_list           = vrs_dir_vrs
        lversno_list           = logvers_dir
      exceptions
        no_entry               = 1
        system_failure         = 2
        communication_failure_ = 3.

    case sy-subrc.
      when 0.
        po_no_entry = false.
      when 1.
        po_no_entry = true.
      when 2.
*        'Fehler im Zielsytem'.
*        MESSAGE w123.
        leave.
      when 3.
*        'Keine Verbindung zum Zielsystem'.
*        MESSAGE w124.
        leave.
    endcase.
  endif.
  to_vrs_dir_vrs[] = vrs_dir_vrs[].
endform.                    " GET_VERSION_LIST_REMOTE


form check_vc_state_remote using pi_dir_destination changing po_old_state.

  data: head_entry like vrsd.

  perform get_vrsd_entry_remote
          using head_type head_objname head_versno pi_dir_destination
          changing head_entry po_old_state.

endform.                    "check_vc_state_remote

form get_vrsd_entry_remote using pi_objtype pi_objname pi_versno pi_dir_destination
                           changing vrsd_entry po_no_entry.

  call function 'GET_VRSD_ENTRY_46'
    exporting
      destination           = pi_dir_destination
      objname               = pi_objname
      objtype               = pi_objtype
      versno                = pi_versno
    importing
      vrsd_entry            = vrsd_entry
    exceptions
      no_entry_found        = 1
      system_failure        = 2
      communication_failure = 3.

  case sy-subrc.
    when 0.
      po_no_entry = false.
    when 1.
      po_no_entry = true.
    when 2.
*      'Fehler im Zielsytem'.
*      message w123.
      leave.
    when 3.
*       'Keine Verbindung zum Zielsystem'.
*      message w124.
      leave.
  endcase.

endform.                    "get_vrsd_entry_remote



form get_old_fashioned_versdir using pi_objtype pi_objname pi_dir_destination
                               changing po_no_entry.

  data: vrsd_entry like vrsd.

  data: object_not_found like bool.

  perform get_vrsd_entry_remote
          using pi_objtype pi_objname null_versno pi_dir_destination
          changing buffer0 po_no_entry.

  if po_no_entry = false.
    call function 'GET_VERSION_LIST_46'
      exporting
        destination           = pi_dir_destination
        objname               = pi_objname
        objtype               = pi_objtype
      tables
        version_list          = vrs_dir_vrs
      exceptions
        system_failure        = 1
        communication_failure = 2.

    case sy-subrc.
      when 1.
*        'Fehler im Zielsytem'.
*        message w123.
        leave.
      when 2.
*        'Keine Verbindung zum Zielsystem'.
*        message w124.
        leave.
    endcase.


    sort vrs_dir_vrs descending by versno.
    loop at vrs_dir_vrs.
      logvers_dir-versno = vrs_dir_vrs-versno.
      append logvers_dir.
    endloop.
    read table vrs_dir_vrs index 1.
    if vrs_dir_vrs-versmode = impt_mode.
*      Es gibt einen offenen Import, setze Flag zurück:
      vrs_dir_vrs-versmode  = corr_mode.
    endif.
    vrs_dir_vrs-versno = 0.
    modify vrs_dir_vrs index 1.
  endif.

  vrsd_entry = buffer0.
  perform add_active_version_remote using pi_dir_destination
          changing vrsd_entry object_not_found.

  if object_not_found = false.
    po_no_entry = false.
  endif.

*  Möglicherweise gibt es eine überarbeitete Version.
  perform add_modif_version_remote using pi_dir_destination
          changing vrsd_entry object_not_found.

  if object_not_found = false.
    po_no_entry = false.
  endif.

endform.

form add_active_version_remote  using pi_dir_destination changing vrsd_info structure vrsd
                                        po_not_found.

  data: object_not_found like vrsd-versmode.
  data: nplus1           like vrsd-versno.
  data: retcode          like bool.

  call function 'FIND_OBJECT_40'
    exporting
      destination           = pi_dir_destination
      objname               = vrsd_info-objname
      objtype               = vrsd_info-objtype
    importing
      object_not_found      = object_not_found
    exceptions
      system_failure        = 1
      communication_failure = 2.

  case sy-subrc.
    when 1.
*        'Fehler im Zielsytem'.
*      message w123.
      leave.
    when 2.
*        'Keine Verbindung zum Zielsystem'.
*      message w124.
      leave.
  endcase.                             " SY-SUBRC.

  if object_not_found = space.
    po_not_found = false.
  else.
    po_not_found = true.
  endif.

  clear: vrsd_info-korrnum, vrsd_info-author,
         vrsd_info-datum,   vrsd_info-zeit.

  if po_not_found = false.

    if vrsd_info-versmode = impt_mode.
*     Es gibt einen offenen Import, und einen Satz n+1 der
*     uns verschwiegen wurde. Er beschreibt die aktive Version
      nplus1 = vrsd_info-lastversno + 1.
      perform get_vrsd_entry_remote
              using vrsd_info-objtype vrsd_info-objname nplus1 pi_dir_destination
              changing vrsd_info retcode.
    else.
      perform get_korrinfo_remote using pi_dir_destination changing vrsd_info.
    endif.

    move-corresponding vrsd_info to vrs_dir_vrs.
    vrs_dir_vrs-versno    = null_versno.
    logvers_dir-versno    = acti_versno.
    insert vrs_dir_vrs index 1.
    insert logvers_dir index 1.
  endif.

endform.

form add_modif_version_remote using pi_dir_destination changing vrsd_info structure vrsd
                                       po_not_found.

  data: mod_dd_exists like vrsd-versmode.

  call function 'TEST_MOD_DD_40'
    exporting
      destination           = pi_dir_destination
      objname               = vrsd_info-objname
      objtype               = vrsd_info-objtype
    importing
      mod_dd_exists         = mod_dd_exists
    exceptions
      system_failure        = 1
      communication_failure = 2.

  case sy-subrc.
    when 1.
*       'Fehler im Zielsytem'.
*      message w123.
      leave.
    when 2.
*       'Keine Verbindung zum Zielsystem'.
*      message w124.
      leave.
  endcase.

  if mod_dd_exists <> space.
    po_not_found = false.
    perform get_korrinfo_remote using  pi_dir_destination changing vrsd_info.
    move-corresponding vrsd_info to vrs_dir_vrs.
    vrs_dir_vrs-versno    = modi_versno.
    logvers_dir-versno    = modi_versno.
    insert vrs_dir_vrs index 1.
    insert logvers_dir index 1.

  else.
    po_not_found = true.
  endif.

endform.                    "add_modif_version_remote


form get_korrinfo_remote using pi_dir_destination changing vrsd_info structure vrsd.

  call function 'GET_KORRNUM_AUTHOR_DATUM_40'
    exporting
      destination           = pi_dir_destination
      objname               = vrsd_info-objname
      objtype               = vrsd_info-objtype
    importing
      author                = vrsd_info-author
      datum                 = vrsd_info-datum
      korrnum               = vrsd_info-korrnum
      zeit                  = vrsd_info-zeit
    exceptions
      system_failure        = 1
      communication_failure = 2.

  case sy-subrc.
    when 1.
*       'Fehler im Zielsytem'.
*      message w123.
      leave.
    when 2.
*       'Keine Verbindung zum Zielsystem'.
*      message w124.
      leave.
  endcase.

  if vrsd_info-korrnum <> space.
*     Korrektur ist offen, Zeitstempel korrigieren:
    vrsd_info-datum = sy-datum.
    vrsd_info-zeit  = sy-uzeit.
  endif.

endform.
*&---------------------------------------------------------------------*
*&      Form  GET_VERSION
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_PROGRAM  text
*      <--P_LW_YABAP_CHECK_002  text
*----------------------------------------------------------------------*
form get_version  using    p_program p_object type tadir-object
                  changing pw_yabap_check_002 type ty_yabap_check_002_mix .

  data:lv_mtext_qas type string.
  data:lv_mtext_prd type string.
*  PROGRAM  Version management: Directory table
  data:ls_vrsd type vrsd.
**  取当前对象已经释放的请求里面最新的激活版本
  select single * from vrsd
    into ls_vrsd
    where objname = p_program
    and versno =  0
**    防止是第一次修改,并没有释放的情况
    and korrnum is not null .
*     AND korrnum eq abap_false.
  if sy-subrc is initial.
    pw_yabap_check_002-dev = ls_vrsd.
  else.
    pw_yabap_check_002-objname = p_program.
    pw_yabap_check_002-crdate = sy-datum.
    pw_yabap_check_002-crtime = sy-uzeit.
    pw_yabap_check_002-objname = p_program.
*       REPOSRC 是报表的情况下,查这个表
    data:ls_reposrc type  reposrc.

*****    这里如果是函数的话,需要改一下取数逻辑
    select single * from reposrc into ls_reposrc
       where progname = p_program.
    if sy-subrc is initial.
      pw_yabap_check_002-dev_author = ls_reposrc-cnam.
*      pw_yabap_check_002-dev_author = ls_reposrc-cnam.
      pw_yabap_check_002-dev_versno = ls_reposrc-vern.
    endif.
    pw_yabap_check_002-suggest = '无版本信息,无法比较'.

    append pw_yabap_check_002 to lt_yabap_check_002.
    exit.
  endif.

*  TMSMCONF
***  检查本系统是有传输请求配置的
  data:ls_tmsmconf type tmsmconf.
  select single * from tmsmconf into ls_tmsmconf .
  check sy-subrc is initial.

***  TMSCSYS
**  查到本系统内的传输请求  这里可以区分 Q*与T*
  data:lt_tmscsys type table of tmscsys.
  select * from tmscsys into table lt_tmscsys
      where extsys <> 'X'
       or extsys is null
       and nfsgrp eq ls_tmsmconf-nfsgrp.
  check sy-subrc is initial.
***  检查是se38的程序
*  IF p_object = 'PROG'.
*******    排除SAP的程序 ?LYFG_TEST01F01
**       TRDIR
**    select
*    DATA:ls_tadir TYPE tadir.
*    SELECT SINGLE * FROM  tadir INTO ls_tadir
*         WHERE pgmid = 'R3TR'
*         AND object = p_object
*         AND obj_name = p_program.
*    CHECK sy-subrc IS INITIAL.
*  ENDIF.


*TMSADM@TPV.DOMAIN_DEV
*ZXF05U01
*REPS
* 函数模块 SVRS_DISPLAY_REMOTE_DIR
* * Lies die Versionsliste des REMOTE-Systems
  data: dir_objtype   like vrsd-objtype.
  data: dir_objname   like vrsd-objname.
  data: no_entry type bool.
  dir_objtype = ls_vrsd-objtype.
  dir_objname = ls_vrsd-objname.

************************************************************************
*   获取当前对象的测试环境的版本信息                                   *
************************************************************************
  data:    lt_vrs_dir_vrs_qas like table of vrsd ,
           lw_vrs_dir_vrs_qas type vrsd.
  dir_destination_qas = 'TMSADM@QA1.DOMAIN_DEV'.

* Prüfe, ob Objekt im Zielsystem existiert und Versionen hat
  data:  returncode_qas like sy-subrc,
         returncode_prd like sy-subrc.
  perform ck_check_remote_object
                using    dir_destination_qas dir_objname
                changing dir_objtype
                         returncode_qas.
  case returncode_qas.
    when 0 or 1.
    when 2.
*    'Fehler im Zielsystem'
      message id 'SB' type 'I' number 123 into lv_mtext_qas.
    when 3.
*     'Keine Verbindung zum Zielsystem oder fehlerhafte Kommunikation'
      message id 'SB' type 'I' number  124 into lv_mtext_qas.

    when 4.
*     'Das Objekt existiert nicht im Zielsystem'.
      message id 'SB' type 'I' number  131 into lv_mtext_qas.

  endcase.
  if returncode_qas eq 0 or returncode_qas eq 1.
    perform get_version_list_remote tables lt_vrs_dir_vrs_qas
                                    using dir_objtype dir_objname dir_destination_qas
                                    changing no_entry.
  else.
    lw_vrs_dir_vrs_qas-objname  = dir_objname.
    lw_vrs_dir_vrs_qas-objtype  = dir_objtype.
    append lw_vrs_dir_vrs_qas to lt_vrs_dir_vrs_qas.
  endif.

************************************************************************
*   获取当前对象的生产的版本信息                                       *
************************************************************************
  dir_destination_prd = 'TMSADM@TPV.DOMAIN_DEV'.
  perform ck_check_remote_object
                  using    dir_destination_prd dir_objname
                  changing dir_objtype
                           returncode_prd.
  case returncode_prd.
    when 0 or 1.
    when 2.
*    'Fehler im Zielsystem'
      message id 'SB' type 'I' number 123 into lv_mtext_prd.
    when 3.
*     'Keine Verbindung zum Zielsystem oder fehlerhafte Kommunikation'
      message id 'SB' type 'I' number  124 into lv_mtext_prd.

    when 4.
*     'Das Objekt existiert nicht im Zielsystem'.
      message id 'SB' type 'I' number  131 into lv_mtext_prd.

  endcase.

  if returncode_prd eq 0 or returncode_prd eq 1.
    data:    lt_vrs_dir_vrs_prd like table of vrsd ,lw_vrs_dir_vrs_prd type vrsd.

    perform get_version_list_remote tables lt_vrs_dir_vrs_prd
                                    using dir_objtype dir_objname dir_destination_prd
                                    changing no_entry.
  else.
    lw_vrs_dir_vrs_prd-objname  = dir_objname.
    lw_vrs_dir_vrs_prd-objtype  = dir_objtype.
    append lw_vrs_dir_vrs_prd to lt_vrs_dir_vrs_prd.
  endif.

  check no_entry ne true.
  if no_entry eq true.
    exit.
  endif.
  check no_entry ne true.
  pw_yabap_check_002-crdate = sy-datum.
  pw_yabap_check_002-crtime = sy-uzeit.
  pw_yabap_check_002-objname = p_program.
  pw_yabap_check_002-dev_versno = ls_vrsd-korrnum.
  if lt_vrs_dir_vrs_prd[] is not initial.
    read table lt_vrs_dir_vrs_prd index 1 into lw_vrs_dir_vrs_prd.
    if sy-subrc is initial.
      if lw_vrs_dir_vrs_prd-korrnum is initial.
        pw_yabap_check_002-dev_prd_compare = lv_mtext_prd.
      else.
        pw_yabap_check_002-prd_versno = lw_vrs_dir_vrs_prd-korrnum.
      endif.
      pw_yabap_check_002-prd = lw_vrs_dir_vrs_prd.
    endif.
  endif.
  if lt_vrs_dir_vrs_qas[] is not initial.
    read table lt_vrs_dir_vrs_qas index 1 into lw_vrs_dir_vrs_qas.
    if sy-subrc is initial.
      if lw_vrs_dir_vrs_qas-korrnum is initial.
        pw_yabap_check_002-dev_qas_compare = lv_mtext_qas.
      else.
        pw_yabap_check_002-qas_versno = lw_vrs_dir_vrs_qas-korrnum.
      endif.
      pw_yabap_check_002-qas = lw_vrs_dir_vrs_qas.
    endif.
  endif.
**DEV_AS4TEXT 请求描述 后面还要加开发人员

  if pw_yabap_check_002-dev_versno eq pw_yabap_check_002-qas_versno
    and pw_yabap_check_002-qas_versno eq pw_yabap_check_002-prd_versno
    and pw_yabap_check_002-dev_versno is not initial
    and pw_yabap_check_002-qas_versno is not initial
    and pw_yabap_check_002-prd_versno is not initial.

    pw_yabap_check_002-suggest = '放心修改。'(011).

  else.
*****    增加代码自动比较

    perform get_version_description using  pw_yabap_check_002.

    perform auto_compare_versions using  pw_yabap_check_002.

  endif.
  append pw_yabap_check_002 to lt_yabap_check_002.
endform.                    " GET_VERSION


form ck_check_remote_object using pi_logdest like rfcdes-rfcdest
                                  pi_objname like vrsd-objname
                            changing pi_objtype like vrsd-objtype
                                     retcode like sy-subrc.
************************************************************************
* FUNKTION:
* Prüft nach, ob das angegebene System mittels REMOTE-Function-Call
* angesprochen werden kann.
* ----------------------------------------------------------------------
* PARAMETER:
* PI_LOGDEST: Name der logischen Destination
*
* PI_OBJTYPE: Name des Objekts ('REPO', 'DYNP', ETC.)
*
* PI_OBJNAME: Name des Objekts
*
* RETCODE:    = 0 versions exist
*             = 1 active object exists
*             = 2/3 communication failures
*             = 4 object does not exist at all
*             = 5 object exists, but incompatible releases
************************************************************************
  data: object_not_found  like vrsd-versmode value ' '.

  data: vrsd_entry like vrsd.

  clear: retcode, object_not_found.

* Überprüfe, ob das Fremdsystem angesprochen werden kann und
* ob es dort Versionen dieses Objekts gibt.
  perform ck_check_remote_versions
          using pi_logdest pi_objname
          changing pi_objtype
                   retcode.

  if retcode = 1.
*   Keine Versionen im Fremdsystem gefunden. Prüfe, ob das Objekt
*   überhaupt im Zielsystem existiert.
    call function 'FIND_OBJECT_40'
      exporting
        destination           = pi_logdest
        objname               = pi_objname
        objtype               = pi_objtype
      importing
        object_not_found      = object_not_found
      exceptions
        system_failure        = 2
        communication_failure = 3.

    if sy-subrc <> 0.
      retcode = sy-subrc.
    else.
      if object_not_found <> space.
        retcode = 4.
      else.
        retcode = 1.
      endif.
    endif.

  elseif retcode = 0.
*   Versionen im Fremdsystem vorhanden, prüfen ob Vergleich
*   überhaupt möglich ist, oder nur Anzeige.
*   Bis jetzt gibt es bei fast allen Objekttypen Probleme
    if pi_objtype = 'DYNP' or
       pi_objtype = 'CUAD' or
       pi_objtype = 'TABD' or
       pi_objtype = 'VIED' or
       pi_objtype = 'MCID' or
       pi_objtype = 'MCOD' or
       pi_objtype = 'ENQD' or
       pi_objtype = 'TABT'.
*     Wir prüfen den Release-Stand anhand des Header Eintrages
      call function 'GET_VRSD_ENTRY_46'
        exporting
          destination           = pi_logdest
          objname               = head_objname
          objtype               = head_type
          versno                = head_versno
        importing
          vrsd_entry            = vrsd_entry
        exceptions
          no_entry_found        = 1
          system_failure        = 2
          communication_failure = 3.

      retcode = sy-subrc.
      if retcode = 1.
*       Wenn kein Header Eintrag vorhanden ist, dann handelt es
*       sich um einen älteren Releasestand (< 30A).
        retcode = 5.
      elseif retcode = 0.
*       Es gibt einen Header Eintrag, aber ist es ein richtiger?
        if vrsd_entry-rels < '30A '.                      "#EC PORTABLE
          retcode = 5.
        endif.
      endif.

    endif.

  endif.
endform.

form ck_check_remote_versions using pi_logdest like rfcdes-rfcdest
                                    pi_objname like vrsd-objname
                              changing pi_objtype like vrsd-objtype
                                       po_retcode like sy-subrc.
************************************************************************
* FUNKTION:
* Prüft nach, ob es in dem angegebenen System Versionen (in VRSD) des
* angegebenen Objektes gibt.
* ----------------------------------------------------------------------
* PARAMETER:
* PI_LOGDEST: Name der logischen Destination
*
* PI_OBJTYPE: Name des Objekts ('REPO', 'DYNP', ETC.)
*
* PI_OBJNAME: Name des Objekts
*
* PO_RETCODE: = 0 versions exist
*             = 1 no versions
*             = 2/3 communication failures
************************************************************************
  tables tfdir.
  data: versno like vrsd-versno value 0.
  data: iname  like vrsd-objname.
  data: iobjtype  like vrsd-objtype.


  data: vrsd_entry like vrsd.

  clear: po_retcode.

* Überprüfe, ob das Fremdsystem angesprochen werden kann und
* ob es dort Versionen dieses Objekts gibt.
  call function 'GET_VRSD_ENTRY_46'
    exporting
      destination           = pi_logdest
      objname               = pi_objname
      objtype               = pi_objtype
      versno                = versno
    importing
      vrsd_entry            = vrsd_entry
    exceptions
      no_entry_found        = 1
      system_failure        = 2
      communication_failure = 3.

  po_retcode = sy-subrc.
  if po_retcode <> 1.
    exit.
  endif.

  if pi_objtype = rept_type or pi_objtype = reps_type or
     pi_objtype = func_type.
*   Für einige Objekttypen werden noch alte LIMU REPOs gesucht,
*   in denen Versionen der ABAP-Source stehen könnten

    if pi_objtype = func_type.
*     wir brauchen zuerst den Include-Namen
      clear: iname.
      select single * from tfdir where funcname = pi_objname.
      iname(1)   = 'L'.
      iname+1(4) = tfdir-pname+4(4).   "'4' ist OK, da REPOs nicht mehr
      "versioniert werden.
      iname+5(1) = 'U'.
      iname+6(2) = tfdir-include.
*     Nun können wir die Versionen suchen
      iobjtype = repo_type.
      call function 'GET_VRSD_ENTRY_46'
        exporting
          destination           = pi_logdest
          objname               = iname
          objtype               = iobjtype
          versno                = versno
        importing
          vrsd_entry            = vrsd_entry
        exceptions
          no_entry_found        = 1
          system_failure        = 2
          communication_failure = 3.

      po_retcode = sy-subrc.

    elseif pi_objtype = reps_type.
      iobjtype = repo_type.
      call function 'GET_VRSD_ENTRY_46'
        exporting
          destination           = pi_logdest
          objname               = pi_objname
          objtype               = iobjtype
          versno                = versno
        importing
          vrsd_entry            = vrsd_entry
        exceptions
          no_entry_found        = 1
          system_failure        = 2
          communication_failure = 3.

      po_retcode = sy-subrc.

* Der Anzeigereport RSVRSTCO kann keine REPOs anzeigen
*    elseif pi_objtype = rept_type.
*      pi_objtype = repo_type.
*      call function 'GET_VRSD_ENTRY_40'
*         exporting
*              destination  = pi_logdest
*              objname      = pi_objname
*              objtype      = pi_objtype
*              versno       = versno
*         importing
*              vrsd_entry   = vrsd_entry
*         exceptions
*              no_entry_found        = 1
*              system_failure        = 2
*              communication_failure = 3.

*      po_retcode = sy-subrc.

    endif.
  endif.

endform.
*&---------------------------------------------------------------------*
*&      Form  GET_VERSION_DESCRIPTION
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_PW_YABAP_CHECK_002  text
*----------------------------------------------------------------------*
form get_version_description  using    piw_yabap_check_002  type ty_yabap_check_002_mix.
  data:lw_e07t type e07t.
  if piw_yabap_check_002-dev_versno is not initial.
    select single as4text
      from e07t
      into piw_yabap_check_002-dev_as4text
     where trkorr eq piw_yabap_check_002-dev_versno.
    piw_yabap_check_002-dev_author = piw_yabap_check_002-dev-author.
  endif.

  if piw_yabap_check_002-qas_versno is not initial.
    select single as4text
      from e07t
      into piw_yabap_check_002-qas_as4text
     where trkorr eq piw_yabap_check_002-qas_versno.
    piw_yabap_check_002-qas_author = piw_yabap_check_002-qas-author.
  endif.

  if piw_yabap_check_002-prd_versno is not initial.
    select single as4text
      from e07t
      into piw_yabap_check_002-prd_as4text
     where trkorr eq piw_yabap_check_002-prd_versno.
    piw_yabap_check_002-prd_author = piw_yabap_check_002-prd-author.
  endif.
endform.                    " GET_VERSION_DESCRIPTION

form auto_compare_versions  using    piw_yabap_check_002  type ty_yabap_check_002_mix.
*代码参考:SAPLSVRL / LSVRLF04
*FORM COMPARE_VERSIONS 与 	ZLOCAL_CL_SALV_BS_RUNTIME_INFO
**  这些版本的源没有区别。需要考虑多语言
*  data:lv_object like piw_yabap_check_002-objname,
*        ls_vrsd1 like piw_yabap_check_002-dev,
*        ls_vrsd2 like piw_yabap_check_002-qas,
*        lv_result like piw_yabap_check_002-DEV_QAS_COMPARE.


***  DEV_QAS_COMPARE
  if '对象在目标系统内不存在'(003) ne piw_yabap_check_002-dev_qas_compare.
    perform auto_compare_versions_sub using piw_yabap_check_002-objname piw_yabap_check_002-dev piw_yabap_check_002-qas changing piw_yabap_check_002-dev_qas_compare.
  endif.
***  DEV_PRD_COMPARE
  if '对象在目标系统内不存在'(003) ne piw_yabap_check_002-dev_prd_compare.
    perform auto_compare_versions_sub using piw_yabap_check_002-objname piw_yabap_check_002-dev piw_yabap_check_002-prd changing piw_yabap_check_002-dev_prd_compare.
  endif.
***  SUGGEST
  data:
    lv_string_no_diff type string,
    lv_string_no_exit type string.
  lv_string_no_diff = '这些版本的源没有区别。'(001).
  lv_string_no_exit = '对象在目标系统内不存在'(003).
  if piw_yabap_check_002-dev_qas_compare eq piw_yabap_check_002-dev_prd_compare and piw_yabap_check_002-dev_prd_compare eq lv_string_no_diff.
    piw_yabap_check_002-suggest = '放心修改。'(011).
  elseif piw_yabap_check_002-dev_qas_compare eq piw_yabap_check_002-dev_prd_compare and piw_yabap_check_002-dev_prd_compare eq   lv_string_no_exit.
    piw_yabap_check_002-suggest = '放心修改。'(011).
  elseif piw_yabap_check_002-dev_qas_compare eq  lv_string_no_diff and piw_yabap_check_002-dev_prd_compare eq   lv_string_no_exit.
    piw_yabap_check_002-suggest = '放心修改。'(011).
  else.
    piw_yabap_check_002-suggest = '请确认后再修改。'(012).
  endif.

endform.

form auto_compare_versions_sub  using pv_objname type  ty_yabap_check_002_mix-objname
                                  ps_vrsd1 type ty_yabap_check_002_mix-dev
                                  ps_vrsd2 type ty_yabap_check_002_mix-qas
                           changing pv_result type ty_yabap_check_002_mix-dev_qas_compare.

  check ps_vrsd2-korrnum is not initial.
  data: lt_sel_versions like vrsd occurs 0,
        lv_selnumber    type i,
        ls_vers_1       like vrsd,
        ls_vers_2       like vrsd,
        ls_infoline1a   like vrsinfolna,
        ls_infoline1b   like vrsinfolnb,
        ls_infoline2a   like vrsinfolna,
        ls_infoline2b   like vrsinfolnb,
        lv_objname1_l   like vrsd-objname,
        lv_objname2_l   like vrsd-objname.
***  DEV_QAS_COMPARE
  ls_infoline1a-objname =  	pv_objname.
  ls_infoline2a-objname =   pv_objname.

  move-corresponding  ps_vrsd1 to ls_infoline1b.
  move-corresponding  ps_vrsd1 to ls_vers_1.
  move-corresponding  ps_vrsd2 to ls_infoline2b.
  move-corresponding  ps_vrsd2 to ls_vers_2 .

  call function 'SVRS_SHORT2LONG_NAME'
    exporting
      objtype       = ls_vers_1-objtype
      objname_short = ls_vers_1-objname
    importing
      objname_long  = lv_objname1_l.

  call function 'SVRS_SHORT2LONG_NAME'
    exporting
      objtype       = ls_vers_2-objtype
      objname_short = ls_vers_2-objname
    importing
      objname_long  = lv_objname2_l.
  submit rsvrsrs3 and return
  with objname  = lv_objname1_l
  with objnam2  = lv_objname2_l
  with versno1  = ls_vers_1-versno
  with versno2  = ls_vers_2-versno
  with objtyp1  = ls_vers_1-objtype
  with objtyp2  = ls_vers_2-objtype
  with infoln1a = ls_infoline1a
  with infoln1b = ls_infoline1b
  with infoln2a = ls_infoline2a
  with infoln2b = ls_infoline2b
  exporting list to memory.
  data  begin of itab_list occurs 0.
          include structure abaplist.
  data  end of itab_list.
  data: begin of vlist occurs 0, "这个调用程序ALV输出的长度要根据实际长度来确认
          line type c length 300,
        end of vlist.
  call function 'LIST_FROM_MEMORY'
    tables
      listobject = itab_list
    exceptions
      not_found  = 4
      others     = 8.
  free memory .
  call function 'LIST_TO_ASCI'
    exporting
      list_index         = -1
    tables
      listasci           = vlist
      listobject         = itab_list
    exceptions
      empty_list         = 1
      list_index_invalid = 2
      others             = 3.
  if sy-subrc = 0 and vlist[] is not initial.
    describe table vlist[] lines data(lv_lines).
    read table vlist index lv_lines.
    pv_result =  vlist-line.
  endif.
endform.
*----------------------------------------------------------------------*
***INCLUDE ZXSEUF02.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Form  SHOW_ALV
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*

****DEFINITION

class lcl_event_receiver definition.

  public section.
    methods:

      handle_double_click
                    for event double_click of cl_gui_alv_grid
        importing e_row e_column.

  private section.

endclass.

data: ok_code           like sy-ucomm,
      gt_sflight        type table of sflight,
      gt_sbook          type table of sbook,
      g_max             type i value 100,
      g_repid           like sy-repid,
      gs_layout         type lvc_s_layo,
      gt_fieldcat       type lvc_t_fcat with header line,
      cont_on_main      type scrfname value 'BCALVC_EVENT2_D100_C1',
      cont_on_dialog    type scrfname value 'BCALVC_EVENT2_D101_C1',
      grid1             type ref to cl_gui_alv_grid,
      grid2             type ref to cl_gui_alv_grid,
* references to custom container: neccessary to bind ALV Control
      custom_container1 type ref to cl_gui_custom_container,
      custom_container2 type ref to cl_gui_custom_container,
      event_receiver    type ref to lcl_event_receiver.
****************************************************************
* LOCAL CLASSES: Implementation
****************************************************************
*===============================================================
* class lcl_event_receiver (Implementation)
*
* In this example, only event DOUBLE_CLICK is caught
*

class lcl_event_receiver implementation.

  method handle_double_click.
    data: ls_sflight like line of gt_sflight.

* § 4.The event DOUBLE_CLICK provides parameters for row and column
*   of the click. Use row parameter to select a line of the
*   corresponding internal table.

* read selected row from internal table gt_sflight
    read table gt_sflight index e_row-index into ls_sflight.

* § 5.Select data and call the second dynpro.

* select corresponding lines of table sbook
*    PERFORM select_table_sbook USING ls_sflight
*                               CHANGING gt_sbook.

* call dialog screen and display new alv control
    call screen 101 starting at 10 5.

  endmethod.                           "handle_double_click

endclass.

module pbo_0101 output.

* § 6.The first time dynpro 101 is called:
*   Create a second ALV Control for table SBOOK. This example
*   uses default lifetime (IMode), i.e, although you leave dynpro 101
*   the Control is still alive. This makes sense if it is expected
*   that the user wants to see different selections of table SBOOK
*   (the controls needs only be created once).
  set pf-status 'STANDARD'.
  if custom_container2 is initial.
* (the data from sbook is already selected)

* create a custom container control for our ALV Control
    create object custom_container2
      exporting
        container_name              = cont_on_dialog
      exceptions
        cntl_error                  = 1
        cntl_system_error           = 2
        create_error                = 3
        lifetime_error              = 4
        lifetime_dynpro_dynpro_link = 5.
    if sy-subrc ne 0.
* add your handling, for example
      call function 'POPUP_TO_INFORM'
        exporting
          titel = g_repid
          txt2  = sy-subrc
          txt1  = 'The control could not be created'(510).
    endif.
* create an instance of alv control
    create object grid2
      exporting
        i_parent = custom_container2.
*
* change title
*
    gs_layout-grid_title = '对象版本差异提示'(101).
    gs_layout-cwidth_opt = abap_true.
*
* adjust field catalog
* to suppress the output of already displayed key fields of sflight
*
    perform mask_columns tables gt_fieldcat.

    call method grid2->set_table_for_first_display
      exporting
        is_layout       = gs_layout
      changing
        it_fieldcatalog = gt_fieldcat[]
        it_outtab       = lt_yabap_check_002[].

  else.
* § 7.The next time dynpro 101 is called you use method
*     'refresh_table_display' to display newly selected data
*     in the instance of ALV Control that 'belongs' to dynpro 101.
    call method grid2->set_frontend_fieldcatalog exporting it_fieldcatalog = gt_fieldcat[].
    call method grid2->set_frontend_layout exporting is_layout = gs_layout.
    call method grid2->refresh_table_display.

  endif.                               "IF grid2 IS INITIAL.


  call method cl_gui_control=>set_focus exporting control = grid2.
  call method cl_gui_cfw=>flush.

*  CREATE OBJECT event_receiver.
*  SET HANDLER event_receiver->handle_double_click FOR grid2.

  if sy-subrc ne 0.
* add your handling, for example
    call function 'POPUP_TO_INFORM'
      exporting
        titel = g_repid
        txt2  = sy-subrc
        txt1  = 'Error in FLush'(500).
  endif.

endmodule.                             " PBO_0101  OUTPUT
*&---------------------------------------------------------------------*
*----------------------------------------------------------------------*
form mask_columns tables p_gt_fieldcat type lvc_t_fcat.


* Build the fieldcat according to DDIC structure SBOOK:
  call function 'LVC_FIELDCATALOG_MERGE'
    exporting
      i_structure_name = 'YABAP_CHECK_002'
    changing
      ct_fieldcat      = p_gt_fieldcat[].

* suppress key fields CARRID, CONNID and FLDATE
*  LOOP AT p_gt_fieldcat.
*    IF p_gt_fieldcat-fieldname = 'CARRID'
*     OR p_gt_fieldcat-fieldname = 'CONNID'
*     OR p_gt_fieldcat-fieldname = 'FLDATE'.
*      p_gt_fieldcat-key_sel = 'X'.
*      p_gt_fieldcat-no_out = 'X'.
*      MODIFY p_gt_fieldcat.
** set left alignment for the two key fields left...
*    ELSEIF p_gt_fieldcat-fieldname = 'BOOKID'
*          OR p_gt_fieldcat-fieldname = 'CUSTOMID'.
*      p_gt_fieldcat-just = 'L'.
*      MODIFY p_gt_fieldcat.
*    ENDIF.
*  ENDLOOP.

endform.                               " MASK_COLUMNS
module pai_0101 input.
*  break jordan.
  case ok_code.
    when 'RETURN' or 'WB_BACK' or 'WB_END' or 'WB_CANCEL' or 'BACK' or 'RW' or '%EX'.
      perform skip_today using ok_code.
      perform leave_screen_101.
    when 'DEV2QAS'.
**  需要检查,两个版本得有效,比如生产的版本,如果在本地不存在的情况下,提示需要远程比较
      perform compare_versions using ok_code .

    when 'DEV2PRD'.
**  需要检查,两个版本得有效,比如生产的版本,如果在本地不存在的情况下,提示需要远程比较
      perform compare_versions using ok_code.
    when 'QAS2PRD'.
**  需要检查,两个版本得有效,比如生产的版本,如果在本地不存在的情况下,提示需要远程比较
      perform compare_versions using ok_code.
    when 'SKIP_TODAY'.
      perform skip_today using ok_code.
      perform leave_screen_101.
  endcase.
  clear ok_code.
endmodule.
" SELECT_TABLE_SBOOK

" SELECT_TABLE_SFLIGHT
form show_alv  .

  check lt_yabap_check_002[] is not initial.
* call dialog screen and display new alv control
  call screen 101
*  STARTING AT 10 20
  .
endform.                    " SHOW_ALV
*----------------------------------------------------------------------*
***INCLUDE ZXSEUF03.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Form  COMPARE_VERSIONS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form compare_versions  using ok_code like sy-ucomm .
  data:
    lt_sel_versions like vrsd occurs 0,
    lv_selnumber    type i,
    ls_vers_1       like vrsd,
    ls_vers_2       like vrsd,
    ls_infoline1a   like vrsinfolna,
    ls_infoline1b   like vrsinfolnb,
    ls_infoline2a   like vrsinfolna,
    ls_infoline2b   like vrsinfolnb,
    lv_objname1_l   like vrsd-objname,
    lv_objname2_l   like vrsd-objname.
  lv_selnumber = 2.
***这里是从屏幕上面勾选的两条并显示代码差异,我们这里不需要选的这段逻辑
*  PERFORM check_vers_selection TABLES lt_sel_versions
*                                 CHANGING lv_selnumber
*                                          ls_infoline1a
*                                          ls_infoline1b
*                                          ls_infoline2a
*                                          ls_infoline2b.
  check grid2 is not initial.
  data :lv_index_rows type lvc_t_row,
        lv_row_no     type lvc_t_roid.
  call method grid2->get_selected_rows
    importing
      et_index_rows = lv_index_rows
      et_row_no     = lv_row_no.
  if lv_row_no[] is initial.
* add your handling, for example
    call function 'POPUP_TO_INFORM'
      exporting
        titel = g_repid
        txt2  = sy-subrc
        txt1  = '比较时需要选中清单中任意一条'(500).
    exit.
  endif.
  break jordan.

  data:ls_row_no type lvc_s_roid.
  read table lv_row_no index 1  into ls_row_no.
  check sy-subrc is initial.

  data:lw_sel_versions type vrsd.

  data:lw_yabap_check_002 like line of lt_yabap_check_002[].
  check lt_yabap_check_002[] is not initial.
  read table lt_yabap_check_002[] index ls_row_no-row_id into lw_yabap_check_002.
  check sy-subrc is initial.
  data:lv_korrnum_is_not_initail type bool.
  case ok_code.
    when 'DEV2QAS'.
      perform check_korrnum_is_not_initail using lw_yabap_check_002-dev-korrnum lw_yabap_check_002-qas-korrnum changing lv_korrnum_is_not_initail.
      if lv_korrnum_is_not_initail eq abap_true.
        exit.
      endif.
      lw_sel_versions = lw_yabap_check_002-dev .
      ls_infoline1a-objname = lw_yabap_check_002-dev-objname.
      ls_infoline1b-korrnum = lw_yabap_check_002-dev-korrnum.
      ls_infoline1b-author  = lw_yabap_check_002-dev-author.
      ls_infoline1b-datum = lw_yabap_check_002-dev-datum.
      append lw_sel_versions  to lt_sel_versions.
      ls_infoline2a-objname = lw_yabap_check_002-qas-objname.
      ls_infoline2b-korrnum = lw_yabap_check_002-qas-korrnum.
      ls_infoline2b-author  = lw_yabap_check_002-qas-author.
      ls_infoline2b-datum = lw_yabap_check_002-qas-datum.
      lw_sel_versions = lw_yabap_check_002-qas .
      append lw_sel_versions  to lt_sel_versions.
    when 'DEV2PRD'.
      perform check_korrnum_is_not_initail using lw_yabap_check_002-dev-korrnum lw_yabap_check_002-prd-korrnum changing lv_korrnum_is_not_initail.
      if lv_korrnum_is_not_initail eq abap_true.
        exit.
      endif.
      lw_sel_versions = lw_yabap_check_002-dev .
      ls_infoline1a-objname = lw_yabap_check_002-dev-objname.
      ls_infoline1b-korrnum = lw_yabap_check_002-dev-korrnum.
      ls_infoline1b-author  = lw_yabap_check_002-dev-author.
      ls_infoline1b-datum = lw_yabap_check_002-dev-datum.
      append lw_sel_versions  to lt_sel_versions.
      lw_sel_versions = lw_yabap_check_002-prd .
      ls_infoline2a-objname = lw_yabap_check_002-prd-objname.
      ls_infoline2b-korrnum = lw_yabap_check_002-prd-korrnum.
      ls_infoline2b-author  = lw_yabap_check_002-prd-author.
      ls_infoline2b-datum = lw_yabap_check_002-prd-datum.
      append lw_sel_versions  to lt_sel_versions.
    when 'QAS2PRD'.
      perform check_korrnum_is_not_initail using lw_yabap_check_002-qas-korrnum lw_yabap_check_002-prd-korrnum changing lv_korrnum_is_not_initail.
      if lv_korrnum_is_not_initail eq abap_true.
        exit.
      endif.
      lw_sel_versions = lw_yabap_check_002-qas .
      ls_infoline1a-objname = lw_yabap_check_002-qas-objname.
      ls_infoline1b-korrnum = lw_yabap_check_002-qas-korrnum.
      ls_infoline1b-author  = lw_yabap_check_002-qas-author.
      ls_infoline1b-datum = lw_yabap_check_002-qas-datum.
      append lw_sel_versions  to lt_sel_versions.
      ls_infoline2a-objname = lw_yabap_check_002-prd-objname.
      ls_infoline2b-korrnum = lw_yabap_check_002-prd-korrnum.
      ls_infoline2b-author  = lw_yabap_check_002-prd-author.
      ls_infoline2b-datum = lw_yabap_check_002-prd-datum.
      lw_sel_versions = lw_yabap_check_002-prd .
      append lw_sel_versions  to lt_sel_versions.
    when others.
      exit.
  endcase.

  case lv_selnumber.
    when 0.
*      MESSAGE e102.                    "Bitte eine Version auswählen
    when 2.
      read table lt_sel_versions index 1 into ls_vers_1.
      read table lt_sel_versions index 2 into ls_vers_2.
      call function 'SVRS_SHORT2LONG_NAME'
        exporting
          objtype       = ls_vers_1-objtype
          objname_short = ls_vers_1-objname
        importing
          objname_long  = lv_objname1_l.

      call function 'SVRS_SHORT2LONG_NAME'
        exporting
          objtype       = ls_vers_2-objtype
          objname_short = ls_vers_2-objname
        importing
          objname_long  = lv_objname2_l.
      dir_f5_report = 'RSVRSRS3'.
*     compare report
      submit (dir_f5_report) and return
        with objname  = lv_objname1_l
        with objnam2  = lv_objname2_l
        with versno1  = ls_vers_1-versno
        with versno2  = ls_vers_2-versno
        with objtyp1  = ls_vers_1-objtype
        with objtyp2  = ls_vers_2-objtype
        with infoln1a = ls_infoline1a
        with infoln1b = ls_infoline1b
        with infoln2a = ls_infoline2a
        with infoln2b = ls_infoline2b.
    when others.
*      MESSAGE e103.
      "Bitte nur zwei Versionen miteinander vergleichen
  endcase.
  break jordan.
endform.                    " COMPARE_VERSIONS


*---------------------------------------------------------------------*
*       FORM CHECK_VERS_SELECTION_NEW                                 *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  PT_SEL_REQUESTS                                               *
*  -->  PO_SEL_NUMBER                                                 *
*  -->  PS_VERS_1                                                     *
*  -->  PS_VERS_2                                                     *
*  -->  PS_INFOLINE1A                                                 *
*  -->  PS_INFOLINE1B                                                 *
*  -->  PS_INFOLINE2A                                                 *
*  -->  PS_INFOLINE2B                                                 *
*---------------------------------------------------------------------*
form check_vers_selection tables pt_sel_versions structure vrsd
                              changing po_sel_number
                                       ps_infoline1a like vrsinfolna
                                       ps_infoline1b like vrsinfolnb
                                       ps_infoline2a like vrsinfolna
                                       ps_infoline2b like vrsinfolnb.
************************************************************************
* FUNKTION:
* Auswahl im Verzeichnis auswerten.
* Es werden die ausgewählten Versionen gelesen und in
* DIR_VERSNO_1 und DIR_VERSNO_2 abgelegt.
* PO_SEL_NUMBER gibt die Anzahl der ausgewählten Versionen an.
* PO_SEL_NUMBER = 3 falls mehr als zwei Versionen ausgewählt wurden.
************************************************************************
  data: ls_vrs_dir_vrs like vrs_dir_vrs,
        lv_markfield   like vrsdynpro-x.

  refresh pt_sel_versions.
  po_sel_number = 0.

  do.
    clear: vrsdynpro-x, vrs_dir_vrs.
    read line sy-index field value vrsdynpro-x.
    ls_vrs_dir_vrs = vrs_dir_vrs.
    lv_markfield = vrsdynpro-x.
    clear: vrs_dir_vrs, vrsdynpro-x.

    if sy-subrc <> 0.
*     end of list reached
      exit.
    endif.

    if ( lv_markfield = 'x' ) or ( lv_markfield = 'X' ).
*     marked lie found
*     store request number
      append ls_vrs_dir_vrs to pt_sel_versions.
      po_sel_number = po_sel_number + 1.
      if po_sel_number = 1.

*       neues make_info_line
        perform make_info_line_new
          using ls_vrs_dir_vrs-objname ls_vrs_dir_vrs-korrnum
                ls_vrs_dir_vrs-datum   ls_vrs_dir_vrs-author
          changing ps_infoline1a
                   ps_infoline1b.

      elseif po_sel_number = 2.

*       neues make_info_line
        perform make_info_line_new
          using ls_vrs_dir_vrs-objname ls_vrs_dir_vrs-korrnum
                ls_vrs_dir_vrs-datum   ls_vrs_dir_vrs-author
          changing ps_infoline2a
                   ps_infoline2b.

      endif.
    endif.
  enddo.

endform.
*---------------------------------------------------------------------*
*       FORM SELECT_OBJECT                                            *
*&---------------------------------------------------------------------*
*&      Form  CHECK_KORRNUM_IS_NOT_INITAIL
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_LW_YABAP_CHECK_002_DEV_KORRNUM  text
*      -->P_LW_YABAP_CHECK_002_QAS_KORRNUM  text
*----------------------------------------------------------------------*
form check_korrnum_is_not_initail  using    p_korrnum_left type verskorrno
                                            p_korrnum_right type verskorrno
                                     changing pv_korrnum_is_not_initail type bool.
  if p_korrnum_left is initial or p_korrnum_right is initial.
    call function 'POPUP_TO_INFORM'
      exporting
        titel = g_repid
        txt2  = sy-subrc
        txt1  = '比较的版本不允许为空'(501).
    pv_korrnum_is_not_initail = abap_true.
  endif.


endform.                    " CHECK_KORRNUM_IS_NOT_INITAIL
*&---------------------------------------------------------------------*
*&      Form  SKIP_TODAY
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_OK_CODE  text
*----------------------------------------------------------------------*
form skip_today  using    p_ok_code.
  data ls_yabap_check_001 type yabap_check_001.
  ls_yabap_check_001-bname = sy-uname.
  ls_yabap_check_001-datum = sy-datum.
  ls_yabap_check_001-object = gv_object.
  ls_yabap_check_001-objname = gv_objectname.
  if  p_ok_code = 'SKIP_TODAY'.
    ls_yabap_check_001-disregard = abap_true.
  endif.
  modify yabap_check_001 from ls_yabap_check_001.

endform.                    " SKIP_TODAY
*&---------------------------------------------------------------------*
*&      Form  LEAVE_SCREEN_101
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form leave_screen_101 .
  if grid2 is not initial.
*        CALL METHOD grid2->free.
    clear lt_yabap_check_002[].
  endif.
  leave to screen 0.
endform.                    " LEAVE_SCREEN_101

注意, 这两个变量,依各公司中的配置而定。具体看tmsmconf这个表中的配置
dir_destination_qas = ‘TMSADM@QA1.DOMAIN_DEV’.
dir_destination_prd = ‘TMSADM@TPV.DOMAIN_DEV’.
还有问题请留言

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/167994.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【年度总结】我的2022年-职业生涯大转折

【年度总结】我的2022年-职业生涯大转折2022总结大厂的苦与乐找工作的焦虑再起启航2023展望持续刷题持续学习捡起博客在漩涡中疯狂挣扎的一年 2022总结 大厂的苦与乐 上半年主要在搞中台&#xff0c;需要对接的其他团队比较多&#xff0c;每天都在对接需求、优化需求。同时还…

Python NumPy 创建数组(ndarray)

前言NumPy&#xff08;Numerical Python的缩写&#xff09;是一个开源的Python科学计算库。使用NumPy&#xff0c;就可以很自然地使用数组和矩阵。NumPy包含很多实用的数学函数&#xff0c;涵盖线性代数运算、傅里叶变换和随机数生成等功能。本文主要介绍使用Python NumPy 创建…

鉴源论坛 · 观辙丨基于机器学习的汽车CAN总线异常检测方法

作者 | 张渊策 上海控安可信软件创新研究院研发工程师 来源 | 鉴源实验室 目前机器学习是研究车辆网络入侵检测技术的热门方向&#xff0c;通过引入机器学习算法来识别车载总线上的网络报文&#xff0c;可实现对车辆已知/未知威胁的入侵检测。这种基于机器学习的异常检测技术普…

chrono_duration(一)

文章目录chrono简介std::chrono::durationduratio基本介绍基本概念使用引入std::ratio 参数深入特化的duratio改造之前的代码静态成员函数 count原型例子构造函数支持加减乘除运算编译细节支持比较运算符查询范围类型转换例子引入修改seconds的范围浮点类型系统特化的duratio自…

os模块的使用方法详解

os模块os模块负责程序与操作系统的交互&#xff0c;提供了访问操作系统底层的接口&#xff1b;即os模块提供了非常丰富的方法用来处理文件和目录。使用的时候需要导入该模块&#xff1a;import os常用方法如下&#xff1a;方法名作用os.remove(‘path/filename’)删除文件os.re…

Unidbg模拟执行某段子so实操教程(一) 先把框架搭起来

一、目标 最近又开始研究Unidbg了&#xff0c;费了好大劲&#xff0c;没有跑起来。今天就先找个软柿子捏捏看。 今天的目标是 之前研究的 某段子App签名计算方法(一) 某段子App版本 5.5.10 二、步骤 先搭起框架来 在 /unidbg/unidbg-android/src/test/java/ 下面新建一个 …

K8S 三种探针ReadinessProbe、LivenessProbe和StartupProbe 之探索

一、事件背景因为k8s中采用大量的异步机制&#xff0c;以及多种对象关系设计上的解耦&#xff0c;当应用实例数增加/删除、或者应用版本发生变化触发滚动升级时&#xff0c;系统并不能保证应用相关的service、ingress配置总是及时能完成刷新。在一些情况下&#xff0c;往往只是…

Python爬虫之Scrapy框架系列(4)——项目实战【某瓣Top250电影更多信息的获取】

前言&#xff1a; 上篇文章使用Scrapy框架简单爬取并下载了某瓣Top250首页的排名前25个电影的电影名。 太寒酸了&#xff0c;这篇文章咱就来仔细搞一搞&#xff0c;搞到更加详细的信息&#xff01;&#xff01;&#xff01; 目录&#xff1a;1.分析2.使用scrapy shell提取电影详…

进程信号--Linux

文章目录信号&#xff1f;kill -l 指令查看所有信号信号的工作流程信号产生1.通过终端按键产生信号2.通过系统调用接口产生信号3.通过软件产生信号4.硬件异常产生信号信号接收信号处理总结信号&#xff1f; 进程间的通信我们了解到有管道通信&#xff0c;有共享内存的通信。这…

flowable编译

git clone -b flowable-release-6.7.2 https://github.com/flowable/flowable-engine.git下载之后File-Open&#xff0c;打开工程&#xff0c;modules是核心代码模块 找到flowable-root.xml按下altf12 &#xff0c;启动Terminal终端输入命令&#xff1a;mvn clean package -Ds…

《Buildozer打包实战指南》第三节 安装Buildozer打包所需的依赖文件

目录 3.1 安装依赖软件包 3.2 安装Cython 3.3 设置环境变量 3.4 安装p4a、Android SDK、NDK以及其他编译文件 Buidozer这个打包库下载安装完毕之后&#xff0c;我们还需要下载一些打包安卓apk所需要的依赖文件。 3.1 安装依赖软件包 首先输入以下命令更新Ubuntu上的软件包…

使众人行:如何带领一群人把事做成?

你好&#xff0c;我是雷蓓蓓&#xff0c;一名程序员出身的项目经理&#xff0c;曾任网易杭研项目管理部总监。 我所带领的网易杭研项目管理部&#xff0c;从2011年成立以来&#xff0c;就一直在互联网项目管理领域深耕&#xff0c;为网易云音乐、网易严选、云计算、智慧企业等…

智慧社区管理系统改造方案

伴随着城市发展的持续加速&#xff0c;许多在建智慧社区和老旧小区智能化改造都在有规划的展开着。如今许多老旧小区在展开设备升级&#xff0c;许多小区智能安防设备、物业管理服务系统软件、社区综合服务平台及其监控器设备等都会展开智能化改造。但是&#xff0c;很多人对老…

17.优于select的epoll

优于select的epoll epoll 理解及应用 select复用方法其实由来已久&#xff0c;因此&#xff0c;利用该技术后&#xff0c;无论如何优化程序性能也无法同时接入上百个客户端&#xff08;当然&#xff0c;硬件性能不同&#xff0c;差别也很大&#xff09;。这种select方式并不适…

IIC驱动中景园0.96寸OLED

驱动硬件介绍 1、驱动电压3.3到5,但是正点的也是这个芯片说用3.3 5会烧坏掉。 2、RST 上的低电平,将导致OLED 复位,在每次初始化之前,都应该复位一下 OLED 模块。而我们使用四线,里面就没有复位了 3、裸屏有多种接口方式(驱动芯片为SSD1306) 6800、8080 两种并行接口方…

Redis应用2(Redison)

不推荐使用application的配置方式,因为会替代spring内部的对于redis的配置方式 注意:如果redis数据库没有密码,不要使用 config.useSingleServer().setPassword("") 的形式,直接跳过setPassword()就可以,配置类写法如下: Configuration public class RedisConfig…

MySQL进阶——索引

一、索引及其分类 1.索引的概念 索引是一种特殊的文件&#xff0c;包含着对数据表中所有记录的引用指针通俗点说&#xff0c;索引就好比是一本书的目录&#xff0c;能加快数据库的查询速度例如需要遍历 200 条数据&#xff0c;在没有索引的情况下&#xff0c;数据库会遍历全部…

Spring之事务编程概述

目录 一&#xff1a;基本概念 搭建测试环境 基于xml声明式事务控制 二&#xff1a;事务相关配置 ​编辑 基于注解声明式事务控制 三&#xff1a;Spring事务角色 四&#xff1a;事务传播行为 五&#xff1a;案例&#xff1a;转账业务追加日志 一&#xff1a;基本概念 事…

Vue.nextTick核心原理

相信大家在写vue项目的时候&#xff0c;一定会发现一个神奇的api&#xff0c;Vue.nextTick。为什么说它神奇呢&#xff0c;那是因为在你做某些操作不生效时&#xff0c;将操作写在Vue.nextTick内&#xff0c;就神奇的生效了。那这是什么原因呢&#xff1f; 让我们一起来研究一…

手把手教你写Dockerfile以及测试

Dockerfile是什么&#xff1f; dockerfile就是用来构建docker镜像的构建文件,命令参数脚本。 如何使用Dockerfile&#xff1f; 1、编写一个Dockerfile文件2、docker build构建成 基础使用&#xff08;此处罗列一些我们经常用到的&#xff09; # 指定依赖镜像版本&#xff…