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

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. Cookie 总结

    设置Cookie //设置cookie Cookie cookie = new Cookie("TOM","111"); //设置有效期,默认秒为单位 cook ...

  2. 常用CMD命令

    查看电脑最大支持多大的内存:    wmic memphysical get maxcapacity   查询DNS:    nslookup a.root-servers.net   路由线路:  ...

  3. hdu 5943 Kingdom of Obsession 二分图匹配+素数定理

    Kingdom of Obsession Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Oth ...

  4. 不要温柔地走入AMD

    1.无依赖情况 <!DOCTYPE html> <html lang="en"> <head> <meta charset="U ...

  5. Android中的五大布局和logcat打印日志

    在android中的布局有五大类,有的时候你可能用到一种,但有的时候你也可能需要两种或者三种布局同时一起使用.这五种布局为别为:LinearLayout(线性布局),FrameLayout(框架布局) ...

  6. Runtime.getRuntime().addShutdownHook

      Runtime.getRuntime().addShutdownHook(shutdownHook); 这个方法的含义说明: 这个方法的意思就是在jvm中增加一个关闭的钩子,当jvm关闭的时候,会 ...

  7. spring校验和文件上传

    spring校验可以分为 vlidator和jsr303 vlidator实例 首先实现validatorjiekou 通过这个类转化为验证类,然后进行验证 在handler里通过创建进行验证 通过j ...

  8. 老笔记本_Win7_U盘_ReadyBoost

    老笔记本 Win7 U盘 ReadyBoost 值得尝试

  9. CSS规范之BFC & IFC

    元素是文档结构的基础,在CSS中,每个元素生成了一个包含了元素内容的框(box,也译为"盒子").但是不同的元素显示的方式会有所不同,例如<div>和<span& ...

  10. jquery_dialog实现效果

    jquery_dialog实现效果 jquery_dialog.js <!-- /******************************************************** ...