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

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. ettercap

    作者: 官网:http://ettercap.github.io/ettercap/ 源码:https://github.com/Ettercap/ettercap 功能:arp欺骗

  2. Linux c 下使用getopt()函数

    命令行参数解析函数 —— getopt() getopt()函数声明如下: #include <unistd.h> int getopt(int argc, char * const ar ...

  3. Codeforces Round #382 (Div. 2) D. Taxes 歌德巴赫猜想

    题目链接:Taxes D. Taxes time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  4. js操作cookie,实现登录密码保存 [转]

    转自:http://blog.csdn.net/zyujie/article/details/8727828 ( 谢谢博主了) js操作cookie,实现登录密码保存.cookie的存放方式是以键值对 ...

  5. css 背景色渐变---和背景色透明

    1 背景色渐变 background:#fb0000; background: -webkit-gradient(linear, left top, left bottom, color-stop(0 ...

  6. 转 C编译: 使用gdb调试

    C编译: 使用gdb调试   作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! gdb是the GNU Debugger的简称.它是 ...

  7. SQL Povit

    ),) ,,@logistics_code='All',@fee_type='All' ),) ,@strDateList='',@from_date=cast((ltrim(@yr)+'-'+ltr ...

  8. poj1927Area in Triangle

    链接 物理渣只能搜题解了.. 分三种情况 1.len>=a+b+c 2.len<内切圆半径 圆的面积是最大的 -->以len为周长的圆 3.看这篇http://blog.sina.c ...

  9. poj1696Space Ant(逆时针螺旋形)

    链接 贪心做法,没次找最外面的点,也就是相对前面那条线偏转角度最小的点,除第一个点需要找到最下面的点即Y坐标最小,其余的每次进行极角排序. #include <iostream> #inc ...

  10. ListFragment

    ListFragment http://developer.android.com/reference/android/app/ListFragment.html extends Fragment C ...