Chinaunix首页 | 论坛 | 博客
  • 博客访问: 126043
  • 博文数量: 60
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 0
  • 用 户 组: 普通用户
  • 注册时间: 2014-03-25 18:14
个人简介

ABAP 小店http://ymhtea.taobao.com

文章分类

全部博文(60)

分类:

2014-03-29 11:26:16

REPORT  z_barry_test LINE-SIZE 140 NO STANDARD PAGE HEADING .

DATA :return TYPE bapiret2 OCCURS 0 WITH HEADER LINE,
      poschedule TYPE bapimeposchedule OCCURS 0 WITH HEADER LINE,
      poschedulex TYPE bapimeposchedulx OCCURS 0 WITH HEADER LINE,
      pocomponents LIKE bapimepocomponent OCCURS 0 WITH HEADER LINE,
      pocomponentsx LIKE bapimepocomponentx OCCURS 0 WITH HEADER LINE.

PARAMETERS p_ebeln LIKE ekko-ebeln.

START-OF-SELECTION.

  CALL FUNCTION 'BAPI_PO_GETDETAIL1'
    EXPORTING
      purchaseorder = p_ebeln
    TABLES
      return        = return
      pocomponents  = pocomponents
      poschedule    = poschedule.

  READ TABLE poschedule INDEX 1.
  CLEAR poschedule[].

  poschedule-quantity = poschedule-quantity - 1 .
  APPEND poschedule.
  poschedulex-po_item = poschedule-po_item.
  poschedulex-sched_line = poschedule-sched_line .
  poschedulex-quantity = 'X'.
  APPEND poschedulex TO poschedulex.

  READ TABLE pocomponents WITH KEY po_item = poschedule-po_item
                                   sched_line = poschedule-sched_line.
  DELETE pocomponents WHERE po_item = poschedule-po_item AND
                                      sched_line = poschedule-sched_line .
  pocomponents-entry_quantity = pocomponents-entry_quantity - 1 .
  pocomponents-change_id = 'U'.
  APPEND pocomponents .
  pocomponentsx-po_item = pocomponents-po_item .
  pocomponentsx-sched_line = pocomponents-sched_line .
  pocomponentsx-item_no = pocomponents-item_no .
  pocomponentsx-entry_quantity = 'X'.
  pocomponentsx-change_id = 'X'.
  APPEND pocomponentsx.

  poschedule-sched_line = poschedule-sched_line + 1 .
  poschedule-delivery_date = '2010.11.11'.
  poschedule-quantity = 1.
  APPEND poschedule.
  poschedulex-po_item = poschedule-po_item.
  poschedulex-sched_line = poschedule-sched_line .
  poschedulex-quantity = 'X'.
  poschedulex-delivery_date = 'X'.
  APPEND poschedulex TO poschedulex.
  READ TABLE pocomponents WITH KEY po_item = poschedule-po_item
                                   sched_line = poschedule-sched_line.
  DELETE pocomponents WHERE po_item = poschedule-po_item AND
                                      sched_line = poschedule-sched_line .
  pocomponents-entry_quantity = 1 .
  pocomponents-sched_line = pocomponents-sched_line + 1 .
  pocomponents-change_id = 'I'.
  APPEND pocomponents .
  pocomponentsx-po_item = pocomponents-po_item .
  pocomponentsx-sched_line = pocomponents-sched_line  .
  pocomponentsx-item_no = pocomponents-item_no  .
  pocomponentsx-entry_quantity = 'X'.
  pocomponentsx-material = 'X'.
  pocomponentsx-change_id = 'X'.
  APPEND pocomponentsx.

  CALL FUNCTION 'BAPI_PO_CHANGE'
    EXPORTING
      purchaseorder = p_ebeln
    TABLES
      return        = return
      poschedule    = poschedule
      poschedulex   = poschedulex
      pocomponents  = pocomponents
      pocomponentsx = pocomponentsx.

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      wait = 'X'.

  WRITE 'OK'.

阅读(1145) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~