这是在中联混凝土那边搞的。。。。

method create_prd.
  data: lt_return type bapiret2_tab,
        ls_return like line of lt_return.
  data: gt_maintain_ext type comt_product_maintain_api_extt,
        gs_maintain_ext like line of gt_maintain_ext.
  data ls_product_api  type comt_product_maintain_api.
  data:lt_short_text type comt_pr_shtext_maintain_tab,
       ls_short_text type comt_pr_shtext_maintain.
  data:lt_categories type comt_prod_cat_rel_maintain_tab,
       ls_categories type line of comt_prod_cat_rel_maintain_tab,
       ls_category type comt_category.
  data gv_logical_system type tbdls-logsys.

*  data lt_price type table of comm_il_prcmpt.
*  data ls_price type comm_il_prcmpt.

*& 获取客户端
  call function 'OWN_LOGICAL_SYSTEM_GET'
    importing
      own_logical_system             = gv_logical_system
    exceptions
      own_logical_system_not_defined = 1
      others                         = 2.
  if sy-subrc <> 0.
  endif.

*& 产品抬头信息
  ls_product_api-com_product-competitor_prod = '1'.     "标记是否是竞争产品
  ls_product_api-com_product-product_type  = '01'.
  ls_product_api-com_product-product_guid  = cl_com_product=>guid_create( ).
  ls_product_api-com_product-product_id    = iv_product_id.
  ls_product_api-com_product-logsys        = gv_logical_system.
  ls_product_api-update_type               = 'I'.

select single * into ls_category from comm_category where category_id = 'MAT_WETT'.
*
  ls_categories-data-client         = sy-mandt.
  ls_categories-update_type         = 'I'.
  ls_categories-data-category_guid  = ls_category-category_guid.
  ls_categories-data-category_id    = 'MAT_WETT'.
  ls_categories-data-hierarchy_guid = ls_category-hierarchy_guid.
  ls_categories-data-logsys         = gv_logical_system.
  insert ls_categories into table lt_categories.
  ls_product_api-categories = lt_categories.

*& 产品描述
  ls_short_text-data-product_guid = ls_product_api-com_product-product_guid.
  ls_short_text-data-langu        = sy-langu.
  ls_short_text-update_type       = 'I'.
  ls_short_text-data-short_text   = iv_product_desc.
  ls_short_text-data-logsys       = gv_logical_system.
  ls_short_text-data_x-short_text = 'X'.
  append ls_short_text to lt_short_text.
  ls_product_api-short_texts = lt_short_text.

**& 竞品供价
*  ls_price-data-product_guid = ls_product_api-com_product-product_guid.
*  ls_price-data-langu        = sy-langu.
*  ls_price-update_type       = 'I'.
*  ls_price-data-short_text   = iv_product_desc.
*  ls_price-data-logsys       = gv_logical_system.
*  ls_price-data_x-short_text = 'X'.
*  append ls_price to lt_price.
*  ls_product_api-price = lt_price.

refresh gt_maintain_ext.
  gs_maintain_ext-header = ls_product_api.
  append gs_maintain_ext to gt_maintain_ext.

call function 'COM_PRODUCT_MAINTAIN_MULT_API'
    exporting
      iv_check_only  = ''
    importing
      et_bapireturn  = lt_return
    changing
      ct_product     = gt_maintain_ext
    exceptions
      internal_error = 1
      others         = 2.

read table lt_return into ls_return with key type = 'E'.
  if sy-subrc = 0.
    call function 'BAPI_TRANSACTION_ROLLBACK'.
    call function 'COM_PRODUCT_FREE_API'.
    ev_msg = 'E'.
    et_return[] = lt_return[].
    exit.
  else.
    call function 'COM_PRODUCT_SAVE_API'
      exporting
        iv_update_task   = 'X'
      exceptions
        internal_error   = 1
        save_not_allowed = 2
        others           = 3.
    if sy-subrc <> 0.
      call function 'BAPI_TRANSACTION_ROLLBACK'.
      call function 'COM_PRODUCT_FREE_API'.
      ev_msg = 'E'.
      et_return[] = lt_return[].
      exit.
    else.
      call function 'BAPI_TRANSACTION_COMMIT'.
      call function 'COM_PRODUCT_FREE_API'.
      ev_msg = 'S'.
      et_return[] = lt_return[].
    endif.
  endif.

endmethod.

CRM创建物料FM1的更多相关文章

  1. CRM创建物料FM2

    这是在佛山好帮手时受启发而研究出来的,创建物料,带单位,类型组 经测试....算了,不说了,有什么限制自己测去...今天心情不好... FUNCTION ZLY_CREATE_PRODUCT_UNIT ...

  2. SAP 创建物料主数据分类视图特性

    1.CL01创建物料分类 2.去CT04中去创建特性值 创建完成之后保存, 3.创建物料的分类视图,选择相应的特性值

  3. SAP MM01 创建物料主数据 [关注公众号后回复MM01获取更多资料]

    操作内容 物料主数据,适用于所有有物料编码物料相关信息的系统维护 业务流程 新项目设计冻结后—M公司 PD用-物料编码申请表D-BOM Material Number  Application部门内部 ...

  4. crm创建报告补充导航

    报告导航实现动态交互体验报告. 通过使用各种类型的操作的,报告允许用户导航到特定的报告.Microsoft Dynamics CRM 记录或其它网站 动态钻取到 Microsoft Dynamics ...

  5. crm创建和编辑全局选项集

    一个选项集就是可包含在一个实体中的某种类型的字段.它定义一组选项.当一个选项集显示在窗口中时,将使用下拉列表控件.当在 Advanced Find 中显示时,则使用选择列表控件.有时,开发者将选项集称 ...

  6. CRM创建BP(END USER)

    FUNCTION ZCRM_BP_CRT. *"---------------------------------------------------------------------- ...

  7. crm创建启用停用用户

    public static readonly string entityName = "systemuser";         public Guid userId = Guid ...

  8. crm创建基于fetch自己的自定义报告

    在解决方案资源管理器,右键点击"报表"目录.然后点击"增加了新的报告". 打开"报表向导". 在"欢迎来到报表向导"前, ...

  9. SAP 设置屏幕字段的隐藏、显示、必填和可选,以设置物料组为例

    1.事务码MM01,把物料组设为选填字段. 2.找到物料组的屏幕字段. 3.在后台根据屏幕字段找到对应字段组.后台路径:后勤-常规—物料主数据—字段选择—给字段组分配字段.点击后面的箭头进入下一屏幕. ...

随机推荐

  1. Oracle VM VirtualBox 虚拟机与主机共享文件

    安装增强功能(参考文档) VirtualBox自带了一个增强工具Sun VirtualBox Guest Additions,这是实现虚拟机与真实主机共享的关键.启动虚拟机后,点击控制菜单“设备”→“ ...

  2. 常用的jquery

    获取一组radio被选中项的值 var item = $('input[@name=items][@checked]').val(); 获取select被选中项的文本 var item = $(&qu ...

  3. HttpClient的CircularRedirectException异常原因及解决办法

    HttpClient的CircularRedirectException异常原因及解决办法 这两天在使用我自己爬虫抓取网页的时候总是出现 org.apache.http.client.ClientPr ...

  4. JavaWeb学习总结(三)—Servlet

    1. 什么是Servlet * Servlet是JavaWeb三大组件之一(Servlet.Filter.Listener) ,Servlet是用来处理客户端请求的动态资源,按照一种约定俗成的称呼习惯 ...

  5. Lua了解 & 为什么游戏开发用Lua

    参考这篇文章 https://www.zhihu.com/question/21717567 看来就是网易风云为了让人写外挂不方便而采用的冷门语言.当然冷门的语言不代表不好用啦. Lua 虚拟机小,嵌 ...

  6. c#动态创建ODBC数据源

    使用C#有两种方法可以动态的创建ODBC数据源,这里我用比较常用的SQL2000作为例子. 方法1:直接操作注册表,需要引用Microsoft.Win32命名空间 /// <summary> ...

  7. iOS开发 仿淘宝,京东商品详情3D动画

    - (void)show { [[UIApplication sharedApplication].windows[0] addSubview:self.projectView]; CGRect fr ...

  8. LinuxShell脚本攻略--第九章 管理重任

    收集进程信息 $ ps PID TTY TIME CMD pts/ :: bash pts/ :: ps$ ps -f  #-f 显示更详细的信息UID PID PPID C STIME TTY TI ...

  9. (转)springAOP解析-1

    原文:http://hzbook.group.iteye.com/group/wiki/2261-Spring 3.1  Spring AOP概述 3.1.1  AOP概念回顾AOP是Aspect-O ...

  10. dede标签调用

    关键描述调用标签: <meta name="keywords" content="{dede:field name='keywords'/}">&l ...