Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7185391
  • 博文数量: 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-06-23 22:01:03

REPORT  zrs08235    .
 
DATA: g_idoc_ctl LIKE edidc,
      g_e1maram LIKE e1maram,
      g_e1maktm LIKE e1maktm.
DATA: gi_ret_ctl LIKE edidc OCCURS 0,
      gi_idoc_data LIKE edidd OCCURS 0 WITH HEADER LINE.
 
* BUILD IDOC_CTL RECORD
PERFORM build_idoc_ctl.
* BUILD ICOC_SEGMENT DATA
PERFORM build_idoc_seg.
* CALL FUNCTION AND CREATE IDOC
PERFORM create_idoc.

*&---------------------------------------------------*
*& form BUILD_IDOC_CTL
*&--------------------------------------------------*
FORM build_idoc_ctl.
* TYPE
  g_idoc_ctl-idoctp = 'ZMMIDOC'. "IDOC TYPE
  g_idoc_ctl-mestyp = 'ZMMCRT'. "MESSAGE TYPE
* RECEIVER
  g_idoc_ctl-rcvprt = 'LS'. "PARTNER TYPE
  g_idoc_ctl-rcvprn = 'MMRECV800'. "PARTNER NO
* SENDER
  g_idoc_ctl-sndprt = 'LS'. "PARTNER TYPE
  g_idoc_ctl-sndprn = 'T90CLNT090'. "PARTNER NO
  g_idoc_ctl-sndpor = 'SAPC11'. "PORT
ENDFORM. " BUILD_IDOC_CTL
 
*&---------------------------------------------------*
*& form BUILD_IDOC_SEG
*&---------------------------------------------------*
FORM build_idoc_seg.
* HEAD DATA
  gi_idoc_data-segnam = 'E1MARAM'. "SEGMENT NAME
  gi_idoc_data-segnum = 1. "SEGMENT NO
  g_e1maram-matnr = 'IDOCTEST15'. "MM NO
  g_e1maram-meins = '10'. "BASE UOM
  g_e1maram-mbrsh = 'M'. "INDUSTRY
  g_e1maram-mtart = 'DIEN'. "MM TYPE
  MOVE g_e1maram TO gi_idoc_data-sdata.
  APPEND gi_idoc_data.
* DESCRIPTION
  gi_idoc_data-segnam = 'E1MAKTM'. "SEGMENT NAME
  gi_idoc_data-segnum = 2. "SEGMENT NO
  g_e1maktm-spras = sy-langu. "LANGUAGE
  g_e1maktm-maktx = 'IDOC TEST'. "DESCRIPTION
  MOVE g_e1maktm TO gi_idoc_data-sdata.
  APPEND gi_idoc_data.
ENDFORM. " BUILD_IDOC_SEG
 
*&---------------------------------------------------*
*& form CREATE_IDOC
*&---------------------------------------------------*
FORM create_idoc.
  CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
    EXPORTING
      master_idoc_control            = g_idoc_ctl
    TABLES
      communication_idoc_control     = gi_ret_ctl
      master_idoc_data               = gi_idoc_data
    EXCEPTIONS
      error_in_idoc_control          = 1
      error_writing_idoc_status      = 2
      error_in_idoc_data             = 3
      sending_logical_system_unknown = 4
      OTHERS                         = 5.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ELSE.
    COMMIT WORK.
  ENDIF.
ENDFORM. " CREATE_IDOC
阅读(5102) | 评论(7) | 转发(0) |
给主人留下些什么吧!~~

upc20082009-06-26 08:23:19

学习了

chinaunix网友2009-06-24 13:14:52

正在研究呢,谢谢,volcano留