【ABAP】alv双击跳转事务码(穿透),修改保存功能

FORM user_exit_comm USING handle      "TYPE es_variant-handle r_ucomm TYPE sy-ucomm rs_selfield TYPE slis_selfield. CASE r_ucomm. WHEN '&IC1'."双击
      READ TABLE gt_items INTO gs_items INDEX rs_selfield-tabindex.
      IF  gs_items IS NOT INITIAL.
        SET PARAMETER ID 'MAT' FIELD gs_items-matnr.  "物料号 SET PARAMETER ID 'WRK' FIELD gs_items-werks. "工厂
        SET PARAMETER ID 'CSV'  FIELD gs_items-stlan.  "BOM用途 CALL TRANSACTION 'CS03' AND SKIP FIRST SCREEN. ENDIF. WHEN 'CHAN' ."更改按钮
      PERFORM frm_chan_data.
      PERFORM frm_save_data .
*    WHEN 'SAVE' OR '&DATA_SAVE'. "保存按钮 * PERFORM frm_save_data . WHEN OTHERS. ENDCASE. ENDFORM . "user_exit_comm

*&---------------------------------------------------------------------*
*&      Form  frm_fieldcat_usexit
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_IT_FIELDCAT  text
*----------------------------------------------------------------------*
FORM frm_fieldcat_usexit CHANGING p_it_fieldcat TYPE lvc_t_fcat.

ENDFORM.                    "frm_fieldcat_usexit *&---------------------------------------------------------------------* *& Form FRM_CHAN_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM frm_chan_data . FIELD-SYMBOLS:<fs_item> LIKE LINE OF gt_items. READ TABLE gt_items WITH KEY sel='X'. IF sy-subrc <> 0. MESSAGE '不存在需要更改的数据!' TYPE 'S' DISPLAY LIKE 'E'. LEAVE LIST-PROCESSING. ENDIF. LOOP AT gt_items ASSIGNING <fs_item> WHERE sel='X'. <fs_item>-stlst='1'. * IF sy-subrc=0. * <fs_item>-icon='@08@'. * <fs_item>-txt='更改BOM状态成功!'. * ELSE. * <fs_item>-icon='@0A@'. * <fs_item>-txt='更改BOM状态失败!'. * ENDIF. ENDLOOP. ENDFORM. " FRM_CHAN_DATA
*&---------------------------------------------------------------------*
*&      Form  FRM_SAVE_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM frm_save_data .



  FIELD-SYMBOLS:<fs_item> LIKE LINE OF gt_items.
  gs_stko-base_quan = 1 .
  gs_stko-bom_status = '01' .
  LOOP AT gt_items ASSIGNING <fs_item> WHERE stlst = '1'.
    p_datuv = <fs_item>-datuv.
    CALL FUNCTION 'CSAP_MAT_BOM_MAINTAIN'
      EXPORTING
        material      = <fs_item>-matnr
        plant         = <fs_item>-werks
        bom_usage     = <fs_item>-stlan
        alternative   = <fs_item>-stlal
        valid_from    = p_datuv
        change_no     = <fs_item>-aennr             "V1-7 ADD * I_STKO=GT_STKO "V1-5 RMK
        i_stko        = gs_stko           "V1-5 ADD * FL_BOM_CREATE='X' * TABLES * t_stpo=gt_stpo[] EXCEPTIONS error=1 OTHERS=2. IF sy-subrc <> 0. ROLLBACK WORK. <fs_item>-icon='@0A@'. ELSE. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait='X'. <fs_item>-icon='@08@'. ENDIF. CALL FUNCTION 'MESSAGE_TEXT_BUILD' EXPORTING msgid=sy-msgid msgnr=sy-msgno msgv1=sy-msgv1 msgv2=sy-msgv2 msgv3=sy-msgv3 msgv4=sy-msgv4 IMPORTING message_text_output=<fs_item>-txt. ENDLOOP. " MESSAGE '功能未完善!' TYPE 'S' DISPLAY LIKE 'E'.
ENDFORM.          

给TA打赏
共{{data.count}}人
人已打赏
SAP

【SAP】GUI端目录中显示事务代码

2020-11-13 11:08:23

ABAPSAP

【ABAP】程序回档改动之前的版本

2021-1-8 21:24:42

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索