注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

XINBO'S SAP BLOG

你所浪费的今天,是昨天死去的人奢望的明天。你所厌恶的现在,是未来的你回不去的曾经

 
 
 

日志

 
 

程序生成IDOC例子  

2009-06-24 09:41:27|  分类: ALE &&EDI && IDo |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
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
  评论这张
 
阅读(791)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017