DBC recording screen

(1) run the transaction code " SHDB ", enter the following interface, a new record - to fill in the record name, transaction code name calling - to start recording, you can go to the next screen:

 

(2) any input a delivery order number, enter, click on the function key "Delete" to enter the next interface:

  

 

(3) to save and return to:

  

(4) select their own records, click on "Programs":

 

(5) Enter the name of the program, as shown, to:

  

(6) As shown, save the program to:

(7) into the program, the program only needs to record this screen, the rest can be abridged:

the perform bdc_dynpro a using 'SAPMV50A' '4004'. "screen SAPMV50A, screen number 4004
the perform bdc_field a using 'BDC_CURSOR' 'LIKP-VBELN'. " a reference to the field LIKP-VBELN
the perform bdc_field a using 'BDC_OKCODE' '/ 00'. " applied to the function keys to enter
the perform bdc_field a using 'LIKP-VBELN' '80,000,783'. "required outbound delivery number
the perform bdc_dynpro a using 'SAPMV50A' '1000'. " enter the screen SAPMV50A, screen number 1000
the perform bdc_field a using ' BDC_OKCODE '' / ELOES_T '. "applied to the function keys to delete
the perform bdc_transaction a using' VL02N '. " call up the transaction code VL02N

(8) test, enter the account number for the over-delivery of 80,000,675 :

Eventually modify the program as follows:

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 'E',
   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."Fail
    READ TABLE it_bdcmsg WITH KEY msgtyp = '
    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

Guess you like

Origin www.cnblogs.com/moqi222/p/11770069.html