Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7203312
  • 博文数量: 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
阅读(5138) | 评论(7) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-08-13 15:57:52

请问老白老师,idoc id 是如何生成的?

qdbarry2010-07-22 18:22:28

没有什么好解释的吧,就是生成IDOC然后发送到指定的PARTNER而已

chinaunix网友2010-07-21 17:03:11

对啊,老白老师给点解释吧

chinaunix网友2009-08-03 10:10:06

我开始研究了,白老大来点解释说明最好了。

chinaunix网友2009-07-01 22:16:28

正在学习idoc,谢谢白老师无私共享~~O(∩_∩)O~