SHARE
TWEET

Untitled

a guest Jan 23rd, 2020 106 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. FORM confirm_delivery USING iv_deliv TYPE vbeln iv_vbtyp TYPE vbtypl.
  2.  
  3.   DATA: ls_vbkok  TYPE vbkok,
  4.         lt_vbpok  TYPE TABLE OF vbpok,
  5.         ls_vbpok  TYPE vbpok,
  6.         lv_error  TYPE c,
  7.         lt_return TYPE TABLE OF prott.
  8.  
  9.   FIELD-SYMBOLS <fs_status> TYPE zsd_pod_status.
  10.   CLEAR lt_prot.
  11.  
  12.   "Pobranie pozycji z dostawy
  13.   SELECT vbeln, posnr, vgbel, vgpos, matnr, werks, lfimg
  14.        FROM lips
  15.        INTO TABLE @DATA(lt_deliv)
  16.        WHERE vbeln = @iv_deliv.
  17.  
  18.   CHECK sy-subrc = 0.
  19.  
  20.   ASSIGN COMPONENT gv_log_name OF STRUCTURE ls_logs TO <fs_status>.
  21.  
  22. *  CHECK <fs_status> = 'D' OR <fs_status> = 'E'.
  23.  
  24.   SELECT SINGLE wbstk
  25.   FROM likp
  26.   INTO @DATA(lv_wbstk)
  27.   WHERE vbeln = @iv_deliv.
  28.   IF sy-subrc = 0 AND lv_wbstk = 'C'.
  29.     "Ta dostawa już jest potwierdzona, idziemy do kolejnego kroku
  30.     <fs_status> = 'X'.
  31.     EXIT.
  32.   ENDIF.
  33.  
  34.   ls_vbkok-vbeln_vl = iv_deliv.
  35.   ls_vbkok-vbtyp_vl = iv_vbtyp.
  36.   ls_vbkok-wabuc    = 'X'.
  37.   ls_vbkok-komue    = 'X'.
  38.  
  39.   IF r_late = 'X'.
  40.     ls_vbkok-wadat_ist = sy-datum.
  41.   ELSE.
  42.  
  43.     ls_vbkok-wadat_ist = ls_likp-wadat.
  44.  
  45.     IF ls_vbkok-wadat_ist < sy-datum.
  46.       ls_vbkok-bldat     = ls_likp-wadat.
  47.     ENDIF.
  48.  
  49.   ENDIF.
  50.  
  51.   LOOP AT lt_deliv INTO DATA(ls_lips).
  52.  
  53.     CLEAR ls_vbpok.
  54.     ls_vbpok-vbeln_vl = ls_lips-vbeln. " Delivery No
  55.     ls_vbpok-posnr_vl = ls_lips-posnr. " Delivery Item
  56.     ls_vbpok-vbeln    = ls_lips-vgbel. " Sales order - Ref Doc
  57.     ls_vbpok-posnn    = ls_lips-vgpos. " SO Line item - Ref doc item
  58.     ls_vbpok-matnr    = ls_lips-matnr. " Material No
  59.     ls_vbpok-werks    = ls_lips-werks. " Plant
  60.     ls_vbpok-pikmg    = ls_lips-lfimg. " Delivery Qty
  61.  
  62.     APPEND ls_vbpok TO lt_vbpok.
  63.  
  64.   ENDLOOP.
  65.  
  66.   CALL FUNCTION 'WS_DELIVERY_UPDATE'
  67.     EXPORTING
  68.       vbkok_wa                 = ls_vbkok
  69.       delivery                 = iv_deliv
  70.       if_error_messages_send_0 = space
  71.     IMPORTING
  72.       ef_error_any_0           = lv_error
  73.     TABLES
  74.       vbpok_tab                = lt_vbpok
  75.       prot                     = lt_return.
  76.  
  77.   COMMIT WORK AND WAIT.
  78.  
  79. endform.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top