DBC 录屏

(1)运行事务码SHDB”,进入如下界面,新建记录—填写记录名称,调用的事务代码名—开始记录,即可进入下一界面:

 

(2)任意输入一个交货单号,回车,点击功能键“删除”,即可进入下一界面:

  

 

(3)保存,返回即可:

  

(4)选中自己的记录,点击“程序”:

 

(5)输入程序名称,如图,即可:

  

(6)如图,保存程序即可:

(7)进入程序中,需要的程序仅有这段录屏,其余的可以删略:

perform bdc_dynpro      using 'SAPMV50A'     '4004'   ."屏幕SAPMV50A,屏幕编号4004
perform bdc_field       using 'BDC_CURSOR'   'LIKP-VBELN'."引用到的字段为 LIKP-VBELN
perform bdc_field       using 'BDC_OKCODE'   '/00'    ."应用到的功能键为回车
perform bdc_field       using 'LIKP-VBELN'   '80000783'  ."需要的外向交货单号
perform bdc_dynpro      using 'SAPMV50A'     '1000'    ."进入屏幕SAPMV50A,屏幕编号1000
perform bdc_field       using 'BDC_OKCODE'   '/ELOES_T'  ."应用到的功能键为删除
perform bdc_transaction      using 'VL02N'                ."调用事务码VL02N

(8)测试,输入为过账的交货单号80000675

最终修改程序如下:

REPORT zdbcdeldelivery
       NO STANDARD PAGE HEADING LINE-SIZE 255.


DATA: gt_itab_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
DATA: it_bdcmsg  TYPE TABLE OF bdcmsgcoll WITH HEADER LINE,
   wa_return  TYPE bdcmsgcoll.
DATA: g_mode(1) VALUE 'N',
   g_updt(1) VALUE 'S'.

DATA: errmsg(1000).

START-OF-SELECTION.

  REFRESH: gt_itab_bdcdata, it_bdcmsg.
  PERFORM  frm_fill_bdcdata USING:'SAPMV50A'     '4004'        'X' ,
                     'BDC_CURSOR'   'LIKP-VBELN'  ''  ,"
                    'BDC_OKCODE'   '/00'         ''  ,"
                    'LIKP-VBELN'   '0080000695'  ''  ,"
                    'SAPMV50A'     '1000'        'X' ,"
                    'BDC_OKCODE'   '/ELOES_T'    ''  ."

  CALL TRANSACTION 'VL02N' USING         gt_itab_bdcdata
                           MODE          g_mode
                           UPDATE        g_updt
                           MESSAGES INTO it_bdcmsg.
  IF sy-subrc EQ 0.
    "提交所做得更改
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        wait = 'X'.

    READ TABLE it_bdcmsg INTO wa_return WITH KEY msgtyp  = 'S'.
    IF sy-subrc = '0'.

    ENDIF.
    EXIT.
  ELSE."运行失败
    READ TABLE it_bdcmsg WITH KEY msgtyp = 'E'.
    IF sy-subrc EQ 0.
      CALL FUNCTION 'MESSAGE_TEXT_BUILD'
        EXPORTING
          msgid               = it_bdcmsg-msgid
          msgnr               = it_bdcmsg-msgnr
          msgv1               = it_bdcmsg-msgv1
          msgv2               = it_bdcmsg-msgv2
        IMPORTING
          message_text_output = errmsg.
    ENDIF.
  ENDIF.

 


*  &--------------------------------------------------------------------*
*  & form frm_fill_bdcdata
*  &--------------------------------------------------------------------*
*   dbc录屏填值
*  ---------------------------------------------------------------------*
FORM frm_fill_bdcdata USING u_par1 u_par2 u_par3.
  CLEAR gt_itab_bdcdata.
  IF u_par3 IS INITIAL.
    gt_itab_bdcdata-fnam = u_par1.
    gt_itab_bdcdata-fval = u_par2.
    IF gt_itab_bdcdata-fnam CP 'LIKP-VBELN*'.
      SHIFT gt_itab_bdcdata-fval LEFT DELETING LEADING space.
    ENDIF.
  ELSE.
    gt_itab_bdcdata-program  = u_par1.
    gt_itab_bdcdata-dynpro   = u_par2.
    gt_itab_bdcdata-dynbegin = u_par3.
  ENDIF.
  APPEND gt_itab_bdcdata.
ENDFORM.                    " frm_fill_bdcdata

posted @ 2019-10-31 11:02  纱缚之印  阅读(381)  评论(0编辑  收藏  举报