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

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. Android——android必看 各个控件属性(网上看到的文字,觉得挺好的,珍藏了)

    属性 值 说明 Android:orientation horizontal/vertical 设置布局水平还是垂直,默认是垂直 android:checked true/false 标记默认选中,如 ...

  2. kakfa源码编译打包

    kakfa项目编译: cd /home/zhaofuxin/workspace/kafka-0.8.2.1-src ./gradlew releaseTarGz 会出现如下异常: zhaofuxin@ ...

  3. ruby的正则表达式-scan方法

    irb(main):001:0> str_vps=%Q{viewpoint_ids: [{"id":"260e053b-d728-4785-888d-eb4f1ca ...

  4. ZOJ-3725 Painting Storages 动态规划

    题意:给定一个数N,表示有N个位置,要么放置0,要么放置1,问至少存在一个连续的M个1的放置方式有多少? 分析:正面求解可能还要考虑到重复计算带来的影响,该题适应反面求解.设dp[i][j]表示到前 ...

  5. Redis核心知识之—— 时延问题分析及应对、性能问题和解决方法【★★★★★】

    参考网址: Redis时延问题分析及应对:http://www.cnblogs.com/me115/p/5032177.html Redis常见的性能问题和解决方法:http://www.search ...

  6. c function

    /* #include<stdio.h> int is_prime(int n) { for(int i = 2; i <= n/2; i ++) if(n % 2 == 0) re ...

  7. php生成mysql的数据字典

    <?php header('content-type:text/html;charset=utf-8'); define('DB_HOST','localhost'); define('DB_U ...

  8. UIImageView 的contentMode属性

    UIViewContentModeScaleToFill UIViewContentModeScaleAspectFit UIViewContentModeScaleAspectFill UIView ...

  9. centos 解压rar文件

    默认情况下centos是不支持winrar的解压与打包的,需要安装winrar的linux版本程序 首先得下载解压软件 wget http://www.rarsoft.com/rar/rarlinux ...

  10. 【官方方法】xcode7免证书真机调试

    [官方方法]xcode7免证书真机调试 步骤比较简单,我就简单总结一下. 1. 进入xcode,菜单栏选择xcode –> preferences (快捷键 command + ,)在Accou ...