Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7186121
  • 博文数量: 655
  • 博客积分: 10264
  • 博客等级: 上将
  • 技术积分: 8278
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-04 17:47
个人简介

ABAP顾问

文章分类

全部博文(655)

文章存档

2017年(2)

2014年(8)

2013年(3)

2012年(2)

2011年(18)

2010年(102)

2009年(137)

2008年(274)

2007年(134)

分类:

2010-11-02 20:36:42

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'.

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