CRM创建物料FM2
这是在佛山好帮手时受启发而研究出来的,创建物料,带单位,类型组
经测试。。。。算了,不说了,有什么限制自己测去。。。今天心情不好。。。
FUNCTION ZLY_CREATE_PRODUCT_UNIT.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(IN_PRODUCT_ID) TYPE COMT_PRODUCT_ID
*" REFERENCE(IN_PRODUCT_TYPE) TYPE COMT_PRODUCT_TYPE DEFAULT '01'
*" REFERENCE(IN_SHORT_TEXT) TYPE COMT_PRSHTEXTX DEFAULT
*" 'CRM CREATE PRODUCT'
*" REFERENCE(IN_CATEGORY_ID) TYPE COMT_CATEGORY_ID DEFAULT
*" 'MAT_ROH'
*" EXPORTING
*" REFERENCE(RT_RETURN) TYPE BAPIRET2_TAB
*"----------------------------------------------------------------------
*--> Structures
DATA : ls_product TYPE comt_product_mat_maintain_api,
ls_comt_prod TYPE comt_product_maintain_api,
ls_prod TYPE comt_product,
ls_prod_categ2 TYPE comt_prod_cat_rel,
ls_srv_maintain TYPE comt_prod_mat_maintain_api,
ls_pr_unit TYPE comt_pr_unit_maintain,
ls_unit TYPE comt_pr_unit,
ls_shtext TYPE comt_pr_shtext_maintain,
ls_text TYPE comt_prshtext,
ls_ret_prod TYPE comt_product_mat_maintain_api,
ls_return TYPE bapiret2.
*--> Internal Tables
**----------------------------------------------------------------------
*----------
DATA : lt_product TYPE comt_product_mat_maintain_apit,
lt_ret_prod TYPE comt_product_mat_maintain_apit,
lt_prod_categ TYPE comt_prod_cat_rel_maintain_tab,
lt_pr_unit TYPE comt_pr_unit_maintain_tab,
lt_shtext_maint TYPE comt_pr_shtext_maintain_tab.
*-->logsys get
DATA iv_logsys TYPE TBDLS-LOGSYS.
CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
IMPORTING
OWN_LOGICAL_SYSTEM = iv_logsys
EXCEPTIONS
OWN_LOGICAL_SYSTEM_NOT_DEFINED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
ENDIF.
**--> Maintain Category relevant data
DATA:ls_category TYPE comm_category .
CLEAR ls_prod_categ2.
SELECT SINGLE * FROM comm_category INTO ls_category WHERE category_id = IN_CATEGORY_ID." 'ZMNFG'.
ls_prod_categ2-category_id = ls_category-category_id.
ls_prod_categ2-category_guid = ls_category-category_guid.
ls_prod_categ2-logsys = iv_logsys.
APPEND ls_prod_categ2 TO lt_prod_categ.
**--> Maintain Product-general data
ls_prod-product_id = in_product_id.
ls_prod-product_type = in_product_type.
ls_prod-client = sy-mandt.
ls_prod-logsys = iv_logsys.
MOVE ls_prod TO ls_comt_prod-com_product.
MOVE lt_prod_categ TO ls_comt_prod-categories.
**--> Maintain Units of measure data
* LOOP AT it_unit INTO ls_unit.
* ls_unit-logsys = iv_logsys.
* MOVE ls_unit TO ls_pr_unit-data.
* APPEND ls_pr_unit TO lt_pr_unit.
* ENDLOOP.
ls_unit-unit = 'PC'.
ls_unit-numerator = '1'.
ls_unit-denominator = '1'.
ls_unit-is_base_unit = 'X'.
ls_unit-logsys = iv_logsys.
MOVE ls_unit TO ls_pr_unit-data.
APPEND ls_pr_unit TO lt_pr_unit.
MOVE lt_pr_unit TO ls_srv_maintain-comm_pr_unit.
MOVE ls_srv_maintain TO ls_product-data.
**--> Maintain Short texts
ls_text-langu = sy-langu.
ls_text-short_text = in_short_text.
ls_text-logsys = iv_logsys.
MOVE ls_text TO ls_shtext-data.
APPEND ls_shtext TO lt_shtext_maint.
MOVE lt_shtext_maint TO ls_comt_prod-short_texts.
MOVE ls_comt_prod TO ls_product-header.
APPEND ls_product TO lt_product.
**--> Create Product
CALL FUNCTION 'COM_PRODUCT_MAT_MAINT_MULT_API'
EXPORTING
it_product = lt_product
iv_check_only = ' '
iv_suppress_inactive = ' '
iv_activate_inactive_products = ' '
iv_application = ' '
IMPORTING
et_product = lt_ret_prod
et_bapireturn = rt_return
EXCEPTIONS
internal_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
type = 'E'
cl = sy-msgid
number = sy-msgno
IMPORTING
return = ls_return.
APPEND ls_return TO rt_return.
CLEAR ls_return.
ENDIF.
**--> Save Product
DATA : lv_product_id TYPE symsgv.
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.
** MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
** WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* lv_product_id = in_product_id.
* CALL FUNCTION 'BALW_BAPIRETURN_GET2'
* EXPORTING
* type = 'E'
* cl = gc_msg_class
* number = '002'
* par1 = lv_product_id
* IMPORTING
* return = ls_return.
* APPEND ls_return TO xt_return.
* CLEAR ls_return.
ENDIF.
**--> Commit transaction
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
IMPORTING
return = ls_return.
IF ls_return IS NOT INITIAL.
APPEND ls_return TO rt_return.
ENDIF.
**--> Refresh buffer
CALL FUNCTION 'COM_PRODUCT_FREE_API'.
ENDFUNCTION.
CRM创建物料FM2的更多相关文章
- CRM创建物料FM1
这是在中联混凝土那边搞的.... method create_prd. data: lt_return type bapiret2_tab, ls_return like line o ...
- SAP 创建物料主数据分类视图特性
1.CL01创建物料分类 2.去CT04中去创建特性值 创建完成之后保存, 3.创建物料的分类视图,选择相应的特性值
- SAP MM01 创建物料主数据 [关注公众号后回复MM01获取更多资料]
操作内容 物料主数据,适用于所有有物料编码物料相关信息的系统维护 业务流程 新项目设计冻结后—M公司 PD用-物料编码申请表D-BOM Material Number Application部门内部 ...
- crm创建报告补充导航
报告导航实现动态交互体验报告. 通过使用各种类型的操作的,报告允许用户导航到特定的报告.Microsoft Dynamics CRM 记录或其它网站 动态钻取到 Microsoft Dynamics ...
- crm创建和编辑全局选项集
一个选项集就是可包含在一个实体中的某种类型的字段.它定义一组选项.当一个选项集显示在窗口中时,将使用下拉列表控件.当在 Advanced Find 中显示时,则使用选择列表控件.有时,开发者将选项集称 ...
- CRM创建BP(END USER)
FUNCTION ZCRM_BP_CRT. *"---------------------------------------------------------------------- ...
- crm创建启用停用用户
public static readonly string entityName = "systemuser"; public Guid userId = Guid ...
- crm创建基于fetch自己的自定义报告
在解决方案资源管理器,右键点击"报表"目录.然后点击"增加了新的报告". 打开"报表向导". 在"欢迎来到报表向导"前, ...
- SAP 设置屏幕字段的隐藏、显示、必填和可选,以设置物料组为例
1.事务码MM01,把物料组设为选填字段. 2.找到物料组的屏幕字段. 3.在后台根据屏幕字段找到对应字段组.后台路径:后勤-常规—物料主数据—字段选择—给字段组分配字段.点击后面的箭头进入下一屏幕. ...
随机推荐
- [SAP ABAP开发技术总结]Function远程、同步、异步调用
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...
- 02~ 一步一步教你使用 SVN之SVN 的介绍
SVN的介绍 一.学习SVN的主要内容的介绍 1.基本操作:学习SVN有哪些基本操作 2.服务器端的安装配置:SVN中必不可少的2个环境之一,会在下面的课程中介绍服务器如何去安装和配置 3.客户端软件 ...
- MyEclipse启动Tomcat服务器时老是跳到Debug调试上
window->preferences->Myeclipse->Servers->Tomcat 然后找到你的相应的Tomcat服务器的版本, 选中然后展开其下面的子菜单会发现有 ...
- Yii框架第一步-- 安装
0.首次安装请看 这里 下面的为非首次安装,不需要token的步骤 1.下载composer 官网下载: https://getcomposer.org/download/ 2.开启PHP的opens ...
- 个人博客作业WEEK 1
一.项目时间规划与实际用时 PSP2.1 Personal Software Process Stages 预计时间/h 实际时间/h Planning 计划 · Estimate · 估计这个任 ...
- 图文解说 Dijkstra.
Dijkstra 太多文章了,有些简练,有些一笔带过.自己还是花了些时间才明白,刚脆自己写个图文说明的,希望能让还没明白的,尽快清楚. 问题:求某点到图中其他所有点的最短路径(权值和最小) Dijks ...
- 14 Using Indexes and Clusters
do not build indexes unless necessary. 索引是非常占资源的To maintain optimal performance, drop indexes that a ...
- (转)Java + Excel 接口自动化
最近项目比较悠闲,想找点事干,写了个 Excel 接口测试的 "框架" 以前用 python 写过一个,这次用 java, 应该说框架都不算,反正就是写了,能帮我解决问题就行. 当 ...
- uploadify多图片上传实例
upload.php <html> <head> <meta http-equiv="Content-Type" content="text ...
- C++中构造函数调用构造函数
今天想做道矩阵的题目时,却卡在一些编程细节上了,找了好久才发现原来是在构造函数处出了问题,然后上网百度了下,发现这篇文章说得很好:从一道题谈C++中构造函数调用构造函数,很棒! 还补充一点: 看来自己 ...