Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7202927
  • 博文数量: 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)

分类:

2009-03-15 16:04:36

REPORT  zmm026 NO STANDARD PAGE HEADING LINE-COUNT 120.

TABLES eban.

DATA: header TYPE bapimereqheader,
      headerx TYPE bapimereqheaderx ,
      number LIKE  bapimereqheader-preq_no,
      return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
      item LIKE bapimereqitemimp OCCURS 0 WITH HEADER LINE,
      itemx LIKE bapimereqitemx OCCURS 0 WITH HEADER LINE .

START-OF-SELECTION.

*  header-pr_type = 'NB'.
*  headerx-pr_type = 'X'.
*
*  item-preq_item = '00001'.
*  item-pur_group = 'J03'.
*  item-short_text = 'test'.
*  item-material = '001100000000017159'.
*  item-plant = '1020'.
*  item-store_loc = '2020'.
*  item-quantity = '21'.
*  item-deliv_date = '20090403'.
*  APPEND item.
*  itemx-preq_item = '00001'.
*  itemx-preq_itemx = 'X'.
*  itemx-pur_group = 'X'.
*  itemx-short_text = 'X'.
*  itemx-material = 'X'.
*  itemx-plant = 'X'.
*  itemx-store_loc = 'X'.
*  itemx-quantity = 'X'.
*  itemx-deliv_date = 'X'.
*  APPEND  itemx.
*
*
*  item-preq_item = '00002'.
*  item-pur_group = 'J03'.
*  item-short_text = 'test2'.
*  item-material = '001100000000031833'.
*  item-plant = '1010'.
*  item-store_loc = '1070'.
*  item-quantity = '31'.
*  item-deliv_date = '20090403'.
*  APPEND item.
*  itemx-preq_item = '00002'.
*  itemx-preq_itemx = 'X'.
*  itemx-pur_group = 'X'.
*  itemx-short_text = 'X'.
*  itemx-material = 'X'.
*  itemx-plant = 'X'.
*  itemx-store_loc = 'X'.
*  itemx-quantity = 'X'.
*  itemx-deliv_date = 'X'.
*  APPEND  itemx.

  SELECT MAX( erdat ) INTO eban-erdat FROM eban .
  SELECT SINGLE * FROM eban WHERE erdat = eban-erdat.

  header-pr_type = eban-bsart.
  headerx-pr_type = 'X'.

  item-preq_item = '00001'.
  item-pur_group = eban-ekgrp.
  item-short_text = 'test'.
  item-material = eban-matnr.
  item-plant = eban-werks.
  item-store_loc = eban-lgort.
  item-quantity = '4'.
  item-deliv_date = sy-datum + 10.
  IF eban-bwtar <> ''.
    item-val_type = eban-bwtar.
  ENDIF.
  item-preq_price = '12'.
  APPEND item.
  itemx-preq_item = '00001'.
  itemx-preq_itemx = 'X'.
  itemx-pur_group = 'X'.
  itemx-short_text = 'X'.
  itemx-material = 'X'.
  itemx-plant = 'X'.
  itemx-store_loc = 'X'.
  itemx-quantity = 'X'.
  itemx-deliv_date = 'X'.
  IF eban-bwtar <> ''.
    itemx-val_type = 'X'.
  ENDIF.
  itemx-preq_price = 'X'.
  APPEND  itemx.


  CALL FUNCTION 'BAPI_PR_CREATE'
    EXPORTING
      prheader  = header
      prheaderx = headerx
    IMPORTING
      number    = number
    TABLES
      return    = return
      pritem    = item
      pritemx   = itemx.

  COMMIT WORK AND WAIT .

  IF return[] IS INITIAL.
    WRITE: / 'no messages'.
  ELSE.
    LOOP AT return.
      WRITE: /    return-type,
             (2)  return-id,
                  return-number,
             (80) return-message,
             (20) return-parameter,
             (3)  return-row,
                  return-field.
    ENDLOOP.
  ENDIF.

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

chinaunix网友2010-05-24 11:14:33

有没有按单采购的实例,感谢