实现效果:销售订单明细表,双击单元格进入 va03 事务代码
1.alv 显示报表调用函数 i_callback_user_command 加上方法名
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = sy-repid
* i_callback_pf_status_set = 'FRM_PF_STATUS'
i_callback_user_command = 'FRM_USER_COMMAND'
is_layout_lvc = gs_layout_lvc
it_fieldcat_lvc = gt_fcat_lvc
i_save = 'A'
TABLES
t_outtab = it_main
EXCEPTIONS
program_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.
2.用户处理命令方法如下:
*&---------------------------------------------------------------------*
*& Form FRM_USER_COMMAND
*&---------------------------------------------------------------------*
* 自定义的用户命令处理
*----------------------------------------------------------------------*
* -->PV_UCOMM 用户命令类型
* -->PS_SELFIELD 用户命令信息
*----------------------------------------------------------------------*
FORM frm_user_command USING pv_ucomm TYPE sy-ucomm
ps_selfield TYPE slis_selfield.
CASE pv_ucomm.
WHEN '&IC1'. " "双击事件
READ TABLE it_main INDEX ps_selfield-tabindex.
IF sy-subrc = 0 ."AND it_main-color = 'C610'.
PERFORM frm_set_bdc_data.
CALL TRANSACTION 'VA03' USING bdcdata
MODE 'E'
MESSAGES INTO messtab.
ENDIF.
ENDCASE.
ENDFORM.
3.调用bdc文章来源:https://www.toymoban.com/news/detail-578096.html
*&---------------------------------------------------------------------*
*& Form FRM_SET_BDC_DATA
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM frm_set_bdc_data .
DATA:lv_etenr LIKE vbep-etenr.
REFRESH:bdcdata,messtab.
PERFORM bdc_dynpro USING 'SAPMV45A' '0102'.
PERFORM bdc_field USING 'VBAK-VBELN' it_main-vbeln.
PERFORM bdc_field USING 'BDC_OKCODE' '=ENT2'.
SELECT SINGLE etenr INTO lv_etenr FROM vbep
WHERE vbeln = it_main-vbeln AND posnr = it_main-posnr.
IF lv_etenr IS NOT INITIAL .
PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.
PERFORM bdc_field USING 'BDC_OKCODE' '=POPO'.
PERFORM bdc_dynpro USING 'SAPMV45A' '0251'.
PERFORM bdc_field USING 'RV45A-POSNR' it_main-posnr.
PERFORM bdc_field USING 'BDC_OKCODE' '=POSI'.
PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.
PERFORM bdc_field USING 'RV45A-VBAP_SELKZ(01)' 'X'.
PERFORM bdc_field USING 'BDC_OKCODE' '=PEIN'.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form BDC_DYNPRO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->PROGRAM text
* -->DYNPRO text
*----------------------------------------------------------------------*
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "BDC_DYNPRO
*----------------------------------------------------------------------*
* Insert field *
*----------------------------------------------------------------------*
FORM bdc_field USING fnam fval.
DATA: lv_fval TYPE string.
lv_fval = fval.
CONDENSE lv_fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = lv_fval.
APPEND bdcdata.
ENDFORM. "BDC_FIELD
SAP BDC 录屏及 ABAP 调用 BDC 参见此链接文章来源地址https://www.toymoban.com/news/detail-578096.html
到了这里,关于SAP ALV 点击单元格跳转事务代码的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!