保存数据至后台表

news2024/11/24 15:30:39

保存数据至后台表-供大数据平台使用-JOB程序

*&---------------------------------------------------------------------*
*&程序名称                    :ZBD_JOB_001
*&程序描述                    : 保存数据至后台表-供大数据平台使用-JOB程序
*&---------------------------------------------------------------------*
*&Date         Developer           ReqNo       Descriptions            *
*& ==========  ==================  ==========  ========================*
*& 2024.06.24                        创建               *
*&---------------------------------------------------------------------*
REPORT zbd_job_001.
*--------数据定义 ------------------------------------------------------*
TABLES:sscrfields.
DATA:gs_001 TYPE ztbd_001,
     gt_001 TYPE TABLE OF ztbd_001,
     gv_xh  TYPE i,
     tc1    TYPE c LENGTH 15. "开始时间戳文本
DATA: functxt     TYPE smp_dyntxt.
FIELD-SYMBOLS: <fs_tab> TYPE STANDARD TABLE.
*----------选择屏幕 ----------------------------------------------------*
SELECTION-SCREEN: FUNCTION KEY 1."在屏幕定义功能码
SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE TEXT-001.
PARAMETERS:p_rname  TYPE ztbd_001-zrname,
           p_report TYPE ztbd_001-zreport,
           p_var    TYPE ztbd_001-variant,
           p_del    TYPE c AS CHECKBOX.

SELECTION-SCREEN END OF BLOCK a1.

*-------初始化----------------------------------------------------------*
INITIALIZATION.
*  functxt-icon_id   = icon_table_settings.
*  functxt-quickinfo = TEXT-007.
*  functxt-icon_text = TEXT-007.
*  sscrfields-functxt_01 = functxt.
*------屏幕事件---------------------------------------------------------*
AT SELECTION-SCREEN.
  CASE sscrfields-ucomm.
    WHEN 'FC01'.
      IF p_rname IS NOT INITIAL.
        DELETE FROM ztbd_status WHERE zrname = p_rname AND zdate = sy-datum.
        IF sy-subrc EQ 0.
          MESSAGE '状态表删除成功' TYPE 'S'.
        ELSE.
          MESSAGE '状态表删除失败' TYPE 'S'.
        ENDIF.
      ELSE.
        MESSAGE '请输入需求名称' TYPE 'S' DISPLAY LIKE 'E'.
      ENDIF.

    WHEN OTHERS.
  ENDCASE.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_rname."需求名称 F4
  PERFORM frm_f4_p_rname.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_report."执行报表 F4
  PERFORM frm_f4_p_report.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_var."变式 F4
  PERFORM frm_f4_p_var.

AT SELECTION-SCREEN OUTPUT.
  PERFORM frm_set_required."屏幕必输设置

START-OF-SELECTION.

  IF p_rname IS INITIAL."需求名称 必输 检查
    MESSAGE TEXT-002 TYPE 'S' DISPLAY LIKE 'E'.
    LEAVE LIST-PROCESSING.
  ENDIF.
  IF p_report IS INITIAL."执行报表名称 必输 检查
    MESSAGE TEXT-003 TYPE 'S' DISPLAY LIKE 'E'.
    LEAVE LIST-PROCESSING.
  ENDIF.
  IF p_var IS INITIAL."变式 必输 检查
    MESSAGE TEXT-005 TYPE 'S' DISPLAY LIKE 'E'.
    LEAVE LIST-PROCESSING.
  ENDIF.

  PERFORM frm_exe."执行程序

END-OF-SELECTION.

  INCLUDE zbd_job_001_f01.

ZBD_JOB_001_F01

*----------------------------------------------------------------------*
***INCLUDE ZBD_JOB_001_F01.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form FRM_F4_P_RNAME
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_f4_p_rname .
  TYPES: BEGIN OF ty_rname,
           zrname TYPE ztbd_001-zrname,
         END OF ty_rname.
  DATA: lt_rname TYPE TABLE OF ty_rname .

  SELECT zrname FROM ztbd_001 INTO CORRESPONDING FIELDS OF TABLE lt_rname WHERE zactivate = 'X'.
  IF sy-subrc EQ 0.

    SORT lt_rname BY zrname.
    DELETE ADJACENT DUPLICATES FROM lt_rname COMPARING zrname.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING
        retfield    = 'ZRNAME'
        dynpprog    = sy-repid
        dynpnr      = sy-dynnr
        dynprofield = 'P_RNAME'
        value_org   = 'S'
      TABLES
        value_tab   = lt_rname.

  ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_F4_P_REPORT
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_f4_p_report .
  TYPES: BEGIN OF ty_report,
           zrname  TYPE ztbd_001-zrname,
           zreport TYPE ztbd_001-zreport,
           ztable  TYPE ztbd_001-ztable,
           variant TYPE ztbd_001-variant,
         END OF ty_report.
  DATA: lt_report TYPE TABLE OF ty_report .
  DATA:lt_fields TYPE TABLE OF dynpread,
       ls_fields TYPE dynpread.
  CLEAR:lt_fields,ls_fields.
* 获取屏幕上字段输入的值:此字段还没有更新到对应的内表或工作区中
  ls_fields-fieldname = 'P_RNAME'.
  APPEND ls_fields TO lt_fields.
  "获取屏幕值
  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname               = sy-cprog
      dynumb               = sy-dynnr
    TABLES
      dynpfields           = lt_fields
    EXCEPTIONS
      invalid_abapworkarea = 1
      invalid_dynprofield  = 2
      invalid_dynproname   = 3
      invalid_dynpronummer = 4
      invalid_request      = 5
      no_fielddescription  = 6
      invalid_parameter    = 7
      undefind_error       = 8
      double_conversion    = 9
      stepl_not_found      = 10
      OTHERS               = 11.
  IF sy-subrc EQ 0.
    CLEAR:ls_fields.
    READ TABLE lt_fields INTO ls_fields WITH KEY fieldname = 'P_RNAME' .
    IF sy-subrc = 0.
      p_rname  = ls_fields-fieldvalue.
    ENDIF.
  ENDIF.

  IF p_rname IS NOT INITIAL.

    SELECT * FROM ztbd_001 INTO CORRESPONDING FIELDS OF TABLE lt_report
     WHERE zrname EQ p_rname.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING
        retfield    = 'ZREPORT'
        dynpprog    = sy-repid
        dynpnr      = sy-dynnr
        dynprofield = 'P_REPORT'
        value_org   = 'S'
      TABLES
        value_tab   = lt_report.
  ELSE.
    MESSAGE TEXT-004 TYPE 'S' DISPLAY LIKE 'W'.
  ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_SET_REQUIRED
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_set_required .
  LOOP AT SCREEN.
    IF screen-name = 'P_RNAME' OR screen-name = 'P_REPORT' OR screen-name = 'P_VAR'.
      screen-required = '2'.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_GET_REPORT_DATA
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_get_report_data CHANGING pv_error TYPE c.

  DATA:ls_data    TYPE REF TO data,
       ls_target  TYPE REF TO data,
       lo_table   TYPE REF TO data,
       dny_line   TYPE REF TO data,
       descr_ref  TYPE REF TO cl_abap_structdescr,
       gt_dfies   TYPE ddfields,
       gw_dfies   TYPE dfies,
       iv_tabname TYPE tabname.

  FIELD-SYMBOLS: <fs_target>     TYPE any,
                 <dny_wa>        TYPE any,
                 <fs_value_sour> TYPE any,
                 <fs_value_tar>  TYPE any,
                 <lt_data>       TYPE STANDARD TABLE,
                 <ls_data>       TYPE any.

  UNASSIGN:<lt_data>,<ls_data>,<fs_target>.
  CLEAR:iv_tabname.

  cl_salv_bs_runtime_info=>set( display = '' metadata = '' data = 'X'  ).
  "根据配置信息获取报表数据
  IF gs_001-sub_variant IS NOT INITIAL.
    SUBMIT (gs_001-zreport) USING SELECTION-SET gs_001-sub_variant AND RETURN.
  ELSE.
    SUBMIT (gs_001-zreport) USING SELECTION-SET gs_001-variant AND RETURN.
  ENDIF.

  "组装返回的报表数据
  CREATE DATA ls_target TYPE TABLE OF (gs_001-ztable).  " 创建动态结构
  ASSIGN ls_target->* TO <fs_target>.                " 将动态结构赋给字段符号

  iv_tabname = gs_001-ztable.
  CALL METHOD zcl_hcm_public_service=>hrpa_dynamic_itab
    EXPORTING
      iv_tabname    = iv_tabname
    IMPORTING
*     eo_data_struc = lo_struc
      eo_data_table = lo_table.

  ASSIGN lo_table->* TO <fs_tab>.
  CREATE DATA dny_line  LIKE LINE OF <fs_tab>.

  ASSIGN dny_line->*  TO  <dny_wa>.
  descr_ref ?= cl_abap_typedescr=>describe_by_name( gs_001-ztable ).

  CALL METHOD cl_salv_data_descr=>read_structdescr
    EXPORTING
      r_structdescr = descr_ref
    RECEIVING
      t_dfies       = gt_dfies[].
  TRY.
      cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data = ls_data ).
      ASSIGN ls_data->* TO <lt_data>.
      IF <lt_data> IS ASSIGNED.
        "锁底表
        PERFORM frm_lock_table CHANGING pv_error.
        IF pv_error IS INITIAL. "锁表成功,组装数据
          IF p_del NE 'X'."获取底表最大序号值
            SELECT MAX( zxh ) INTO gv_xh FROM (gs_001-ztable) WHERE zcdate = sy-datum.
            IF sy-subrc EQ 0.
              gv_xh = gv_xh + 1.
            ENDIF.
          ENDIF.
          LOOP AT <lt_data> ASSIGNING <ls_data>.
            LOOP AT gt_dfies INTO gw_dfies.
              UNASSIGN:<fs_value_tar>,<fs_value_sour>.
              ASSIGN COMPONENT gw_dfies-fieldname OF STRUCTURE <dny_wa> TO <fs_value_tar>.  " 将目标结构的值赋给动态结构-底表
              ASSIGN COMPONENT gw_dfies-fieldname OF STRUCTURE <ls_data> TO <fs_value_sour>.  " 将原始结构的值赋给动态结构-报表alv结构
              IF <fs_value_tar> IS ASSIGNED AND <fs_value_sour> IS ASSIGNED.
                <fs_value_tar> = <fs_value_sour>.
              ENDIF.

              IF gs_001-zcus_fm IS NOT INITIAL AND <fs_value_tar> IS ASSIGNED.

                TRY.
                    CALL FUNCTION gs_001-zcus_fm
                      EXPORTING
                        i_value = <ls_data>
                        i_name  = gw_dfies-fieldname
                      CHANGING
                        o_value = <dny_wa>.
                  CATCH cx_no_flight_found .
                ENDTRY.

              ENDIF.
            ENDLOOP.

            UNASSIGN:<fs_value_tar>.
            ASSIGN COMPONENT 'ZRNAME' OF STRUCTURE <dny_wa> TO <fs_value_tar>.  " 需求名称
            IF <fs_value_tar> IS ASSIGNED .
              <fs_value_tar> = p_rname.
            ENDIF.

            UNASSIGN:<fs_value_tar>.
            ASSIGN COMPONENT 'ZXH' OF STRUCTURE <dny_wa> TO <fs_value_tar>.  " 序号
            IF <fs_value_tar> IS ASSIGNED .
              <fs_value_tar> = gv_xh.
              gv_xh = gv_xh + 1.
            ENDIF.

            UNASSIGN:<fs_value_tar>.
            ASSIGN COMPONENT 'ZCDATE' OF STRUCTURE <dny_wa> TO <fs_value_tar>.  " 序号
            IF <fs_value_tar> IS ASSIGNED .
              <fs_value_tar> = sy-datum.
            ENDIF.

            APPEND <dny_wa> TO <fs_tab>.
          ENDLOOP.
        ENDIF.
      ENDIF.
    CATCH cx_salv_bs_sc_runtime_info.
      MESSAGE '执行报表没有数据返回' TYPE 'E'.
  ENDTRY.
  cl_salv_bs_runtime_info=>clear_all( ).
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_SAVE_TABLE
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_save_table .
  DATA:lv_error TYPE c,
       tc2      TYPE c LENGTH 15, "结束时间戳文本
       td1      TYPE d, "开始时间:日期
       td2      TYPE d, "结束时间:日期
       th1      TYPE i, "开始时间:时
       th2      TYPE i, "结束时间:时
       tm1      TYPE i, "开始时间:分
       tm2      TYPE i, "结束时间:分
       ts1      TYPE p , "开始时间:秒
       ts2      TYPE p . "结束时间:秒.
  CLEAR:lv_error.
  "全量更新,先删除数据.
  IF <fs_tab> IS NOT INITIAL AND p_del = 'X' AND gs_001-sub_variant IS INITIAL.
    SELECT COUNT(*) FROM (gs_001-ztable) WHERE zrname = p_rname.
    IF sy-subrc EQ 0.
      DELETE FROM (gs_001-ztable) WHERE zrname = p_rname.
      IF sy-subrc NE 0.
        MESSAGE '删除数据失败' TYPE 'E'.
      ENDIF.
    ENDIF.
  ENDIF.
  "保存数据
  IF <fs_tab>[] IS NOT INITIAL.
    MODIFY (gs_001-ztable) FROM TABLE <fs_tab>.
    IF sy-subrc NE 0.
      MESSAGE '保存数据失败' TYPE 'S' DISPLAY LIKE 'E'.
    ELSE.
      MESSAGE '保存数据成功' TYPE 'S' .
    ENDIF.
  ELSE.
    MESSAGE '没有需要保存的数据' TYPE 'S' DISPLAY LIKE 'E'.
  ENDIF.

  PERFORM frm_lock_status_table CHANGING lv_error."锁状态表

  IF lv_error IS INITIAL.
    "再次获取执行日期,避免在执行期间内有其他job重复执行 以至于重复计算已执行job总数 ZTBD_STATUS-ZRNUM.
    SELECT SINGLE zexe_date INTO gs_001-zexe_date FROM ztbd_001
     WHERE zrname = gs_001-zrname AND zactivate = 'X' AND variant = gs_001-variant AND sub_variant = gs_001-sub_variant AND zreport = gs_001-zreport.

    CLEAR:tc2,td1,td2,th1,th2,tm1,tm2,ts1,ts2.

    td1 = tc1+0(8).
    th1 = tc1+8(2).
    tm1 = tc1+10(2).
    ts1 = tc1+12(2).
    tc2 =  sy-datum && sy-uzeit.
    td2 = tc2+0(8).
    th2 = tc2+8(2).
    tm2 = tc2+10(2).
    ts2 = tc2+12(2).

    gs_001-zrun_time = ( td2 - td1 ) * 24 * 3600 + ( th2 - th1 ) * 3600 + ( tm2 - tm1 ) * 60 + ( ts2 - ts1 ).

    IF gs_001-zexe_date NE sy-datum.
      gs_001-zexe_date = sy-datum.
      gs_001-zexe_time = sy-uzeit.
      PERFORM frm_update_status. "更新状态表
    ELSE.
      gs_001-zexe_time = sy-uzeit.
      MODIFY ztbd_001 FROM gs_001.
      COMMIT WORK AND WAIT.
      MESSAGE '当前日期已执行过程序,状态表无需更新' TYPE 'S'.
    ENDIF.

    PERFORM frm_unlock_status_table."释放锁对象
  ELSE.
    MESSAGE '锁定状态表失败,状态表未更新' TYPE 'S' DISPLAY LIKE 'E'.
  ENDIF.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_LOCK_STATUS_TABLE
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_lock_status_table CHANGING p_error TYPE c.
  DO 30 TIMES.
    CALL FUNCTION 'ENQUEUE_EZTBD_STATUS'
      EXPORTING
        mode_ztbd_status = 'E'
        mandt            = sy-mandt
        zrname           = p_rname
        zdate            = sy-datum
      EXCEPTIONS
        foreign_lock     = 1
        system_failure   = 2
        OTHERS           = 3.
    IF sy-subrc <> 0.
      WAIT UP TO 1 SECONDS.
      p_error = 'X'.
    ELSE.
      CLEAR:p_error.
      EXIT.
    ENDIF.

  ENDDO.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_UPDATE_STATUS
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_update_status .

  "统计当前需求有几个job
  SELECT COUNT(*) INTO @DATA(lv_count) FROM ztbd_001 WHERE zrname = @p_rname AND zactivate = 'X'.
  "获取当前需求状态
  SELECT SINGLE * FROM ztbd_status INTO @DATA(ls_status) WHERE zrname = @p_rname AND zdate = @sy-datum.

  IF ls_status IS NOT INITIAL.
    ls_status-zrnum = ls_status-zrnum + 1."执行报表数+1
  ELSE.
    ls_status-zrname = p_rname.
    ls_status-zrnum = 1.
  ENDIF.

  IF ls_status-zrnum = lv_count."报表全执行完
    ls_status-zfinish = 'X'."完成标识
  ENDIF.

  ls_status-zdate = sy-datum.
  ls_status-ztime = sy-uzeit.
  "保存状态
  MODIFY ztbd_status FROM ls_status.
  IF sy-subrc EQ 0.
    MODIFY ztbd_001 FROM gs_001.
    COMMIT WORK AND WAIT.
    MESSAGE '更新状态表成功' TYPE 'S'.
  ELSE.
    MESSAGE '更新状态表失败' TYPE 'S' DISPLAY LIKE 'E'.
  ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_UNLOCK_STATUS_TABLE
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_unlock_status_table .

  CALL FUNCTION 'DEQUEUE_EZTBD_STATUS'
    EXPORTING
      mode_ztbd_status = 'E'
      mandt            = sy-mandt
      zrname           = p_rname
      zdate            = sy-datum.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_F4_P_VAR
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_f4_p_var .
  TYPES: BEGIN OF ty_var,
           report  TYPE varid-report,
           variant TYPE varid-variant,
           ename   TYPE varid-ename,
         END OF ty_var.
  DATA: lt_var TYPE TABLE OF ty_var.
  DATA:lt_fields TYPE TABLE OF dynpread,
       ls_fields TYPE dynpread.
  CLEAR:lt_fields,ls_fields.
* 获取屏幕上字段输入的值:此字段还没有更新到对应的内表或工作区中
  ls_fields-fieldname = 'P_REPORT'.
  APPEND ls_fields TO lt_fields.
  "获取屏幕值
  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname               = sy-cprog
      dynumb               = sy-dynnr
    TABLES
      dynpfields           = lt_fields
    EXCEPTIONS
      invalid_abapworkarea = 1
      invalid_dynprofield  = 2
      invalid_dynproname   = 3
      invalid_dynpronummer = 4
      invalid_request      = 5
      no_fielddescription  = 6
      invalid_parameter    = 7
      undefind_error       = 8
      double_conversion    = 9
      stepl_not_found      = 10
      OTHERS               = 11.
  IF sy-subrc EQ 0.
    CLEAR:ls_fields.
    READ TABLE lt_fields INTO ls_fields WITH KEY fieldname = 'P_REPORT' .
    IF sy-subrc = 0.
      p_report  = ls_fields-fieldvalue.
    ENDIF.
  ENDIF.

  IF p_report IS NOT INITIAL.

    SELECT * FROM varid INTO CORRESPONDING FIELDS OF TABLE lt_var
     WHERE report EQ p_report AND transport NE 'B'.
    IF sy-subrc EQ 0.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield    = 'VARIANT'
          dynpprog    = sy-repid
          dynpnr      = sy-dynnr
          dynprofield = 'P_VAR'
          value_org   = 'S'
        TABLES
          value_tab   = lt_var.
    ELSE.
      MESSAGE TEXT-006 TYPE 'S' DISPLAY LIKE 'W'.
    ENDIF.
  ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_EXE
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_exe .
  DATA:ls_001   TYPE ztbd_001,
       lv_error TYPE c.
  CLEAR:gt_001,gs_001,gv_xh,ls_001.
  gv_xh = 1.
  "获取配置表数据
  SELECT * INTO TABLE gt_001 FROM ztbd_001 WHERE zrname = p_rname AND zreport = p_report AND variant = p_var AND zactivate = 'X'.
  IF sy-subrc EQ 0.
    SORT gt_001 BY sub_variant ztable.
    LOOP AT gt_001 INTO gs_001.
      CLEAR:lv_error,tc1.
      tc1 = sy-datum && sy-uzeit.
      IF gs_001-ztable NE ls_001-ztable.
        gv_xh = 1.
      ENDIF.

      "获取报表数据
      PERFORM frm_get_report_data CHANGING lv_error.
      IF lv_error IS INITIAL.
        "保存报表数据 更新状态表
        PERFORM frm_save_table.
        "释放底表
        PERFORM frm_unlock_table.
      ENDIF.
      ls_001 = gs_001.
      CLEAR:gs_001.
    ENDLOOP.
  ENDIF.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_UNLOCK_TABLE
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_unlock_table.
  DATA:lv_name TYPE rstable-tabname.
  CLEAR:lv_name.
  lv_name = gs_001-ztable.
  CALL FUNCTION 'DEQUEUE_E_TABLE'
    EXPORTING
      mode_rstable = 'E'
      tabname      = lv_name.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_LOCK_TABLE
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_lock_table CHANGING p_error TYPE c.
  DATA:lv_msg  TYPE string,
       lv_name TYPE rstable-tabname.
  CLEAR:lv_msg,lv_name.
  lv_name = gs_001-ztable.
  DO 60 TIMES.
    CALL FUNCTION 'ENQUEUE_E_TABLE'
      EXPORTING
        mode_rstable   = 'E'
        tabname        = lv_name
      EXCEPTIONS
        foreign_lock   = 1
        system_failure = 2
        OTHERS         = 3.
    IF sy-subrc <> 0.
      WAIT UP TO 1 SECONDS.
      p_error = 'X'.
    ELSE.
      CLEAR:p_error.
      EXIT.
    ENDIF.

  ENDDO.

  IF p_error EQ 'X'.
    lv_msg = '表' && gs_001-ztable && '锁定失败' .
    MESSAGE lv_msg TYPE 'S' DISPLAY LIKE 'E'.
  ENDIF.

ENDFORM.

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

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

相关文章

[Linux] 什么是 Shell?

一、什么是 shell ? shell在英语中的意思就是外壳&#xff0c;所以我们习惯称shell程序为壳程序。那为什么又会被叫做壳程序呢&#xff1f;那是因为shell程序是在内核上面的&#xff0c;属于操作系统的外壳部分&#xff0c;因此我们就称之为壳程序(shell)。 在 Linux 中&#…

增材制造正在加速赋能模具产业转型升级

模具&#xff0c;作为制造业的基石&#xff0c;正随着经济的蓬勃发展与产业的深度转型而面临更高要求。特别是注塑模具的冷却系统&#xff0c;传统工艺在面对随形冷却水路时显得力不从心&#xff0c;导致冷却效率无法进一步提升。而3D打印技术的崛起&#xff0c;则为模具领域开…

财务会计与管理会计(七)

文章目录 电商快递费用计算IF、VLOOKUP函数的应用 交费分布统计表SUMPRODUCT函数的应用 考勤签到统计系统OFFSET、MATCH函数的应用 出入库余额自动核算系统SUMPRODUCT、LOOKUP函数的应用 分段收费的典型案例VLOOKUP函数、MIN函数、MAX函数的应用 全额累进与超额累进计算提成全额…

《走走停停》,观后感

他这辈子看起来&#xff0c;好像就不是很成功。但是我们都很怀念这个人。 我们的文化太过强调永远&#xff0c;并把“永远”和“成功”牢牢捆绑了起来。 比如你开了一家咖啡店&#xff0c;这家店给你带来了很多快乐。但后来成本变高了&#xff0c;经营压力也变大了&#xff0…

求个位数(c语言)

1./描述 //给你一个数&#xff0c;让他进行巴啦啦能量&#xff0c;沙鲁沙鲁&#xff0c;小魔仙大变身&#xff0c;如果进行变身的数不满足条件的话&#xff0c;就继续让他变身。。。直到满足条件为止。 //巴啦啦能量&#xff0c;沙鲁沙鲁&#xff0c;小魔仙大变身&#xff1a;对…

2024/8/15 英语每日一段

A new Google update will make it simpler to request the removal of fake explicit images, as public figures, teachers and ordinary people increasingly contend with targeted abuse in the form of “deepfakes,” or realistic-looking images made with AI. While …

C# 学习笔记17:上位机助手_页面生成多控件滚动效果_保存与加载控件文本到文件_多字符串发送界面

今日继续完善更新我的上位机助手&#xff0c;这次完善多字符串发送的部分&#xff1a; 目前上位机助手支持以下功能&#xff1a; 1、 普通的16进制\ASCLL显示收发 2、 全页更新HEX显示&#xff08;会自动断串口&#xff09; 3、 日志辅助显示报错 4、 必要的清除日志区、接…

Hbase图形化界面

分享一个好用的hbase图形化界面 安装包&#xff1a;链接: https://pan.baidu.com/s/11Y2cDlme-P2xe--pYqy6MQ?pwdguag 提取码: guag 1、上传项目到linux 2、修改数据库配置信息 application-druid.yml 修改url、username、password为数据库连接信息 3、创建数据库(注意字符集…

display:flex布局,最简单的案例

1. 左右贴边 <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><title>Title</title><style>#parent{width: 800px;background: red;height: 200px;display: flex;justify-content: space-between…

vscode 远程免密登录

Windows R 输入 cmd在命令行终端中输入 ssh-keygen 一直回车、确定 生成秘钥 3. C:\用户\xxx.ssh 拷贝公钥内容 id_rsa.pub 4. 在虚拟机~/.ssh/ 下创建文件touch authorized_keys,拷贝公钥内容 id_rsa.pub粘贴到authorized_keys里即可。

某市-2024【网安·理论】初赛-web1-扫雷-wp

进来是个简单的扫雷 看源码是纯js写的 看了下主要格子之类的生成逻辑在jms.js里 其中flag的输出条件也包含在jms.js 格式化了一下 看特征是base64了&#xff0c;然后又经过了别的操作&#xff0c;不过他混淆了一下就懒得看了。 知道的是每过一个难度的都可以拿到1/3个fl…

【网络】UDP回显服务器和客户端的构造,以及连接流程

回显服务器&#xff08;Echo Server&#xff09; 最简单的客户端服务器程序&#xff0c;不涉及到业务流程&#xff0c;只是对与 API 的用法做演示 客户端发送什么样的请求&#xff0c;服务器就返回什么样的响应&#xff0c;没有任何业务逻辑&#xff0c;没有进行任何计算或者…

【操作系统】什么是进程?什么是线程?两者有什么区别(面试常考!!!)

什么是进程/任务&#xff08;Process/Task&#xff09; 当我们打开我们的电脑的任务管理器就可以看到我们的电脑正在执行的进程。 每个应用程序运行于现代操作系统之上时&#xff0c;操作系统会提供一种抽象&#xff0c;好像系统上只有这个程序在运行&#xff0c;所有的硬件资…

基于Springboot 和Vue 的高校宿舍管理系统源码

网络上很多宿舍管理系统都不完整&#xff0c;大多数缺少数据库文件&#xff0c;所在使用极其不方便&#xff0c;由于本人程序员&#xff0c;根据代码&#xff0c;自己花时间不全了数据库文件&#xff0c;并且可以完美运行&#xff01;&#xff01;&#xff01;&#xff01;&…

使用MQ的考量:系统可用性与复杂性

使用MQ的考量&#xff1a;系统可用性与复杂性 一、降低系统可用性二、增加系统复杂性 &#x1f496;The Begin&#x1f496;点点关注&#xff0c;收藏不迷路&#x1f496; 消息队列&#xff08;MQ&#xff09;在软件开发中扮演重要角色&#xff0c;但其使用也带来一些问题。本文…

原型与原型链与继承

原型、原型链与继承 构造函数 构造函数创建实例的过程 1.创建一个新对象 2.将空对象的__proto__指向构造函数的原型 3.修改构造函数中this指向&#xff0c;将构造函数中的this指向实例对象&#xff0c;执行构造函数中的代码&#xff0c;给这个新对象添加属性和方法&#x…

机器学习笔记:注意力机制中多头注意力的实现

目录 介绍 模型 代码实现 引入库 单个注意力头 多个注意力头的实现 测试 思考 介绍 在注意力机制中&#xff0c;单个注意力学到的东西有限&#xff0c;可以通过对不同的注意力进行组合&#xff0c;学到不同的知识&#xff0c;以达到想要的目的。因此采用”多头注意力…

windows 安装 Mysql

一、安装Mysql 下载完成后直接双击进行安装 安装一路默认 如下图所示&#xff0c;在MySQL Servers/MySQL Server/MySQL Server 5.7的下方找到MySQL Server 5.7.41 - X64&#xff0c;然后选中它&#xff0c;点击两框之间的第一个箭头&#xff0c;将其移到右边的框中 点击Exe…

接口基础知识8_详解response header(响应头)

课程大纲 一、定义 HTTP响应头&#xff08;HTTP Response Header&#xff09;&#xff1a;在HTTP协议中用于描述服务器响应的元数据。 它是服务器在响应客户端请求时&#xff0c;发送给客户端的一部分响应信息&#xff0c;包含了服务器的相关配置和响应内容的描述。 二、常见…

[机器学习]--KNN算法(K邻近算法)

KNN (K-Nearest Neihbor,KNN)K近邻是机器学习算法中理论最简单,最好理解的算法,是一个 非常适合入门的算法,拥有如下特性: 思想极度简单,应用数学知识少(近乎为零),对于很多不擅长数学的小伙伴十分友好虽然算法简单,但效果也不错 KNN算法原理 上图是每一个点都是一个肿瘤病例…