Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 1.97 KB | None | 0 0
  1. report ztrigger_ordrsp.
  2. tables: nast,
  3.         tnapr,
  4.         toa_dara,
  5.         zorderqueue.
  6. data: gv_returncode type sysubrc,
  7.       gv_end(1).
  8.  
  9. form entry  using cv_returncode  type sysubrc
  10.                   uv_screen      type char1.
  11.  
  12.   data: "lt_vbdpr TYPE tbl_vbdpr,
  13.     ls_comwa           type vbco3,
  14.     lv_task(10)        type c,
  15.     lv_message_type    type kschl,
  16.     lv_message_partner type nast-parnr,
  17.     rcv_jobs           type i,
  18.     snd_jobs           type i.
  19.  
  20.   ls_comwa-mandt = sy-mandt.
  21.   ls_comwa-spras = nast-spras.
  22.   ls_comwa-kunde = nast-parnr.
  23.   ls_comwa-parvw = nast-parvw.
  24.  
  25.   if nast-objky+10(6) ne space.
  26.     ls_comwa-vbeln = nast-objky+16(10).
  27.   else.
  28.     ls_comwa-vbeln = nast-objky.                        "#EC CI_CONV_OK
  29.   endif.
  30.  
  31. *--------#981361------insert data on ZORDERQUEUE ----------
  32.   data: ls_queue type zorderqueue,
  33.         ls_aubel type vbrp,
  34.         lt_vbup  type table of vbup,
  35.         lt_vbrp  type table of vbrp,
  36.         ls_vbrp  type vbrp,
  37.         lt_queue type table of zorderqueue.
  38.  
  39.   select * from vbrp into table lt_vbrp where vbeln = ls_comwa-vbeln.
  40.   cv_returncode = 0.
  41.   if sy-subrc = 0.
  42. *  READ TABLE lt_vbrp INTO ls_vbrp INDEX 1.
  43.     loop at lt_vbrp into ls_vbrp.
  44.  
  45. * IF sy-subrc = 0.
  46.       ls_queue-vbeln = ls_vbrp-vbeln.
  47.       ls_queue-aubel = ls_vbrp-aubel.
  48.       ls_queue-dater = sy-datum.
  49.       ls_queue-timer = sy-uzeit.
  50.  
  51.       append ls_queue to lt_queue.
  52.     endloop.
  53.  
  54. *    SELECT COUNT(*) FROM zorderqueue WHERE vbeln = ls_comwa-vbeln.
  55. *
  56. *    IF sy-dbcnt IS INITIAL.
  57.  
  58.     loop at lt_queue into data(ls_queue2).
  59.       select single * from zorderqueue into @data(ls_conf) where vbeln = @ls_comwa-vbeln and aubel = @ls_queue2-aubel.
  60.  
  61.       if sy-subrc <> 0.
  62.         insert zorderqueue from ls_queue2.
  63. *        append ls_queue2 to lt_queue2.
  64.         clear ls_queue2.
  65.       endif.
  66.     endloop.
  67.  
  68. *      INSERT zorderqueue FROM TABLE lt_queue2.
  69.     cv_returncode = sy-subrc.
  70.  
  71.  
  72.   endif.
  73.  
  74. endform.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement