壹佰网|ERP100 - 企业信息化知识门户

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 749|回复: 0

sap部分开发笔记15

[复制链接]
发表于 2010/1/8 14:29:41 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622  。

您需要 登录 才可以下载或查看,没有帐号?注册

x

【通过程序来调用 BDC自动导入数据】  


*-----------------------------------------------------------------------

* Program ID
:ZTEST904_BDC

* Program Name
:ZTEST904_BDC

*-----------------------------------------------------------------------

* CREATED DATE
:2004/09/04

* CREATED BY
iuGang

* DESCRIPTION
:
这个程序是学习如何通过程序来调用

*
BDC
自动导入数据的。

*-----------------------------------------------------------------------

* MODIFICATION
:

* DATE MODIFIED
MODIFIED BY
TRANSPORT REQUEST
DESCRIPTION

* 2004/09/04
LiuGang
VERSION
01/01
学习

*-----------------------------------------------------------------------

REPORT ZTEST904_BDC.

* 定义个BDC格式的内表

**************************************************

DATA : BEGIN OF I_BDCDATA OCCURS 0,

*BDC的程序名字,比如事物码MM01的程序名字为SAPLMGMMsap标准程序)


PROGRAM LIKE BDCDATA-PROGRAM,

*BDC Dynpro 号码


DYNPRO LIKE BDCDATA-DYNPRO,

*BDC BDC Dynpro 開始


DYNBEGIN LIKE BDCDATA-DYNBEGIN,

*BDC 项目名字


FNAM LIKE BDCDATA-FNAM,

*BDC 项目名字的附加值


FVAL LIKE BDCDATA-FVAL,


END OF I_BDCDATA.

DATA: BEGIN OF ITAB OCCURS 0,


A(9),


END
OF ITAB.

ITAB-A = 'A0010'.

APPEND ITAB.

ITAB-A = 'A0011'.

APPEND ITAB.

* START-OF-SELECTION

START-OF-SELECTION.

LOOP AT ITAB.


PERFORM APPEND_MM01 USING ITAB-A.


PERFORM RUN_BDC.

ENDLOOP.

*---------------------------------------------------------------------*

*
FORM APPEND_DATA_MM01
*

*---------------------------------------------------------------------*

*
定义一个子程序里面,用来存放操作的各个步骤
*

*---------------------------------------------------------------------*

FORM APPEND_MM01 USING FVAL LIKE ITAB-A.


CLEAR I_BDCDATA.


CLEAR I_BDCDATA[].

*开始新的画面事件

*0173画面

*把程序名字和 BDC DYnpro号码,开始标志 写入内表表头,


I_BDCDATA-PROGRAM = 'SAPLMGMM'.


I_BDCDATA-DYNPRO = '0060'.


I_BDCDATA-DYNBEGIN = 'X'.


APPEND I_BDCDATA.


CLEAR I_BDCDATA.


I_BDCDATA-FNAM = 'BDC_CURSOR'.


I_BDCDATA-FVAL = 'RMMG1-MATNR'.


APPEND I_BDCDATA.


CLEAR I_BDCDATA.


I_BDCDATA-FNAM = 'BDC_OKCODE'.


I_BDCDATA-FVAL = '/00'.


APPEND I_BDCDATA.


CLEAR I_BDCDATA.


I_BDCDATA-FNAM = 'RMMG1-MATNR'.

*新建立的物料凭证号码

* I_BDCDATA-FVAL = 'A004'.


I_BDCDATA-FVAL = FVAL.


APPEND I_BDCDATA.


CLEAR I_BDCDATA.


I_BDCDATA-FNAM = 'RMMG1-MBRSH'.


I_BDCDATA-FVAL = 'C'.


APPEND I_BDCDATA.


CLEAR I_BDCDATA.


I_BDCDATA-FNAM = 'RMMG1-MTART'.


I_BDCDATA-FVAL = 'WERB'.


APPEND I_BDCDATA.


CLEAR I_BDCDATA.

*开始新的画面事件


I_BDCDATA-PROGRAM = 'SAPLMGMM'.


I_BDCDATA-DYNPRO = '0070'.


I_BDCDATA-DYNBEGIN = 'X'.


APPEND I_BDCDATA.


CLEAR I_BDCDATA.


I_BDCDATA-FNAM = 'BDC_CURSOR'.


I_BDCDATA-FVAL = 'MSICHTAUSW-DYTXT(01)'.


APPEND I_BDCDATA.


CLEAR I_BDCDATA.


I_BDCDATA-FNAM = 'BDC_OKCODE'.


I_BDCDATA-FVAL = '=ENTR'.


APPEND I_BDCDATA.


CLEAR I_BDCDATA.


I_BDCDATA-FNAM = 'MSICHTAUSW-KZSEL(01)'.


I_BDCDATA-FVAL = 'X'.


APPEND I_BDCDATA.


CLEAR I_BDCDATA.

*开始新的画面事件


I_BDCDATA-PROGRAM = 'SAPLMGMM'.


I_BDCDATA-DYNPRO = '4004'.


I_BDCDATA-DYNBEGIN = 'X'.


APPEND I_BDCDATA.


CLEAR I_BDCDATA.


I_BDCDATA-FNAM = 'BDC_OKCODE'.


I_BDCDATA-FVAL = '=BU'.


APPEND I_BDCDATA.


CLEAR I_BDCDATA.


I_BDCDATA-FNAM = 'BDC_CURSOR'.


I_BDCDATA-FVAL = 'MAKT-MAKTX'.


APPEND I_BDCDATA.


CLEAR I_BDCDATA.


I_BDCDATA-FNAM = 'MAKT-MAKTX'.


I_BDCDATA-FVAL = '
测试BDC导入数据'.


APPEND I_BDCDATA.


CLEAR I_BDCDATA.


I_BDCDATA-FNAM = 'MARA-MEINS'.


I_BDCDATA-FVAL = '000'.


APPEND I_BDCDATA.


CLEAR I_BDCDATA.


I_BDCDATA-FNAM = 'MARA-MTPOS_MARA'.


I_BDCDATA-FVAL = 'NORM'.


APPEND I_BDCDATA.


CLEAR I_BDCDATA.

ENDFORM.

*---------------------------------------------------------------------*

*
FORM RUN_BDC
*

*---------------------------------------------------------------------*

*
........
*

*---------------------------------------------------------------------*

FORM RUN_BDC.

*开始调用事务MM01,把做好的bdc对象传递过去,然后把模式设置为A,

*就是说所有窗口,均可以看见.

* N 表示不看见吧


CALL TRANSACTION 'MM01' USING I_BDCDATA MODE 'N'.

ENDFORM.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|手机版|壹佰网 ERP100 ( 京ICP备19053597号-2 )

Copyright © 2005-2012 北京海之大网络技术有限责任公司 服务器托管由互联互通
手机:13911575376
网站技术点击发送消息给对方83569622   广告&合作 点击发送消息给对方27675401   点击发送消息给对方634043306   咨询及人才点击发送消息给对方138011526

GMT+8, 2025/11/30 05:33 , Processed in 0.016711 second(s), 14 queries , File On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表