- 浏览: 271978 次
- 性别:
- 来自: 杭州
文章分类
最新评论
-
sunlin:
水文 其他erp就没这样的问题? 不能单方面拿sap说 ...
【转】揭秘SAP在华真相:天价收费与用户之灾 -
zjut_xiongfeng:
用当前日期所在月的第一天,比如2010-7-30的当前月第一天 ...
pb函数库之日期、时间函数 -
550627069:
你好!问下 在PB中显示当前日期的前一个月 应该怎么做?求教
pb函数库之日期、时间函数
1. Introduction to ALE development
Developing a new custom ALE scenario comprises 5 steps: Below is a visual representation of the flow of a complete ALE scenario from the sending system to the receiving system. 1.1. ALE Example For the purposes of this example we will develop a small ALE scenario. This scenario is described below. We will develop a custom IDoc to carry the billing number from the Service Receiver's system to the Service Provider's system. We will populate the IDoc in a user exit on the sending side and we will process the transaction on the receiving side using a custom function module and a BDC transaction call. No rule conversion, segment filtering or version conversion will be implemented in the model as described in Figure 1. Requirements NOTES: 1. All IMG references to transactions are located in the transaction SALE which is the ALE portion of the IMG 2. Outbound processing 2.1. Create IDoc type (WE30) Client independent The IDoc type refers to the IDoc structure that you will require for your development. In our case the IDoc type is called ZINVRV01. This IDoc type will have one segment called Z1INVRV with 2 fields, LIFNR & XBLNR, in this segment. If you require many segments or nested segments then they are also created using the same procedure. We will create the IDoc of the following structure: To create the IDoc type, follow these next few steps: Your IDoc is now ready for use. If you need to add fields or segments to your IDoc type, you will need to cancel the release of the IDoc type as well as the segment release using a similar procedure followed above (except now you uncheck the release box for the segment and you choose cancel release for the IDoc type). 2.2. Create message type (WE81) Client independent To create a new message type, follow these next few steps: 2.2.1. Link message to IDoc type (WE82 & BD69) Client independent To link the message type to the IDoc type follow these next few steps: Your IDoc is now linked to your message type. We still need to link object types and add the message to the model before we can use the message. 2.2.2. Maintain object type for message type (BD59) Client independent The ALE objects are used to create links between IDocs and applications objects, to control the serialisation, to filter messages in the customer model and to use listings. For our own message type and IDoc you must maintain object types for the links. If you want to check the serialisation for the message type, then you must maintain object types for the serialisation. If no serialisation object has been maintained for a given message type, then the serialisation will not be checked for this message type. To add an object type to our message type, follow these next few steps: Enter transaction BD59 (ALE -> Extensions -> ALE object maintenance -> Maintain object types) You have now created an object that we'll use as a filter object in the customer model to direct the flow of messages to the various logical systems based on the vendors in the filter of the message type ZINVRV. We now need to add our new message type to the distribution model. 2.3. Configuring the Distribution Model This task is performed on your ALE reference client. 2.3.1. Manual Configuration (BD64) Client dependent To manually configure the customer distribution model, read the ALE configuration procedure, and follow these steps: NOTES: You cannot maintain a message type between the same sender and receiver in more than one customer distribution model. Only the owner is authorised to modify the model. To change the owner of a model, choose the 'Maintain ownership of customer distribution model' function. Make sure that all changes will be distributed to all systems that know the corresponding model. To do so, you can use the correction and transport system. To transport the customer distribution model you should use the Distribute customer model function of the IMG as described below. 2.3.2. Distribute customer model (BD71) Client dependent After the customer model has been created centrally, it must be distributed to the other remote systems. This entails first of all setting up the communication for the distributed systems and then sending the model. 2.3.2.1. Distribute Model (BD71) Client dependent This task is performed on your ALE reference client. To distribute the customer distribution model, read the ALE configuration procedure and follow these steps: NOTES: In later versions of SAP you distribute the Distribution model from the Distribution Model editor using BD64. You perform this task from the menu option within the model you wish to distribute and you can distribute it to as many systems as you wish in one action. 2.3.2.2. Maintain sending system partner profile (WE20) Client dependent With this function, you define the partner profiles for all outbound and inbound messages on the basis of the customer distribution model. After you have defined and distributed the customer model, you will have to maintain the partner profiles locally. To do this read the ALE configuration procedure. * Enter the output mode (background, immediately) and the package size for outbound processing. Requirements 2.4. Populate & distribute IDoc using ABAP An IDoc consists of a control record with structure edidc and one or more data records with structure edidd. The control record contains the sender and recipient of the IDoc, as well as information on the type of message. To be able to pass an IDoc to the ALE layer, you must set up a field string with structure edidc and an internal table with structure edidd. They are used to call function module master_idoc_distribute, which performs the save to the database and triggers the dispatch if necessary. 2.4.1. Example code The code displayed below does the following: *--- Move the document header into a structure *--- Move the document item data into a structure *--- Populate the IDoc segment's field with the required data *--- Move the control data info required for the distribution *--- Call the distribute function with the required parameters NOTE: For debugging purposes, use transaction WE05 (IDoc overview) to see whether an IDoc was created and to check on it's status. 3. Inbound processing 3.1. Create Function Module This function module is called when a message type, of type ZINVRV, comes into the receiving system. This needs to be configured and is dealt with later in this section. The function module is passed the IDoc as a parameter. Example parameters Example code The code displayed below does the following: 3.1.1. Debugging inbound FM Use transaction WE19 to test inbound function module in debugging mode. Also use WE05 to view the IDocs and their statuses. 3.2. Maintain ALE attributes The inbound function module needs to be linked to the message type and the message type needs to be linked to the appropriate inbound process code at the partner profile level before the scenario is enabled. These steps are described below in detail. 3.2.1. Link Message Type to Function Module (WE57) Client independent To link a message (ZINVRV) type to a function module (Z_IDOC_INPUT_ZINVRV) follow these steps: 3.2.2. Define FM settings (BD51) Client independent 3.2.3. Maintain process codes (WE42) Client dependent A process code needs to be maintained on each client. It then needs to be linked to the message via the partner profiles on each client. This allows the various clients to use a unique function module for the same message type. To maintain the process code follow these steps: NOTE: The next 6 steps are used in workflow error handling. You will need to determine the task associated with object IDOCINVOIC, and then assign the appropriate position to it. This position will then receive the application error messages via workflow. To set up the workflow area please consult the Workflow config guide. 3.3. Create inbound partner profile For each message type you need to maintain the inbound partner profiles. 3.3.1. Maintain receiving system partner profile (WE20) Client dependent To maintain inbound partner profiles read the document ALE configuration procedure: 3.4. Test Once the inbound function module has been debugged the scenario should be ready to test in its entirety. If problems occur, read through the relevant areas of this document to check your configuration or code. Kevin Wilson is a senior interface consultant for QData USA Inc. and founder of SAPGenie.com
Figure 1: ALE Scenario model
"The receiver of an internal service must be able to reverse (cancel) the invoice receipt which will then cancel the applicable billing document automatically on the service provider's system."
Figure 2: Example Purchasing & Selling scenario
2. This is one way of developing a scenario where no message control exists. If message control exist (EG. On purchase orders) then NAST can be used to call an outbound function module that would create the required IDocs.
Figure 3: IDoc type ZINVRV01
Your message type has now been created. The next step will be to link it to the IDoc.
*--- Data declaration statements
DATA: C_INVREV_SEGNAME(7) TYPE C VALUE 'Z1INVRV',
C_INVREV_MESTYPE(6) TYPE C VALUE 'ZINVRV',
C_INVREV_IDOC_TYPE(8) TYPE C VALUE 'ZINVRV01',
Z1INVRV LIKE Z1INVRV,
C_INVREV_DOCTYPE LIKE BKPF-BLART VALUE 'YY',
IDOC_CONTROL LIKE EDIDC,
T_COMM_CONTROL LIKE EDIDC OCCURS 0 WITH HEADER LINE,
IDOC_DATA LIKE EDIDD OCCURS 0 WITH HEADER LINE.
LOOP AT DOC_HEAD_TAB INTO DOC_HEAD.
ENDLOOP.
LOOP AT DOC_ITEM_TAB INTO DOC_ITEM WHERE NOT ( LIFNR IS INITIAL ).
ENDLOOP.
CLEAR Z1INVRV.
Z1INVRV-LIFNR = DOC_ITEM-LIFNR. "Store vendor number for filter
Z1INVRV-XBLNR = DOC_HEAD-XBLNR. "Billing number
IDOC_DATA-SEGNAM = C_INVREV_SEGNAME. "Segment name
IDOC_DATA-SDATA = Z1INVRV. "Segment data
APPEND IDOC_DATA. "Populate IDoc internal table
IDOC_CONTROL-MESTYP = C_INVREV_MESTYPE.
IDOC_CONTROL-DOCTYP = C_INVREV_IDOC_TYPE.
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE' IN UPDATE TASK
EXPORTING
MASTER_IDOC_CONTROL = IDOC_CONTROL
TABLES
COMMUNICATION_IDOC_CONTROL = T_COMM_CONTROL
MASTER_IDOC_DATA = IDOC_DATA
EXCEPTIONS
ERROR_IN_IDOC_CONTROL = 1
ERROR_WRITING_IDOC_STATUS = 2
ERROR_IN_IDOC_DATA = 3
SENDING_LOGICAL_SYSTEM_UNKNOWN = 4
OTHERS = 5.
Figure 4: Outbound processing example code
EXTRACT FROM: Z_IDOC_INPUT_ZINVRV
*--- Declaration of local variables
DATA: C_SEGNAM(10) TYPE C VALUE 'Z1INVRV'.
*-Loop through the IDOCs
LOOP AT IDOC_CONTRL.
*---Loop through the data for the IDOC
LOOP AT IDOC_DATA WHERE DOCNUM = IDOC_CONTRL-DOCNUM.
CASE IDOC_DATA-SEGNAM.
WHEN C_SEGNAM.
* Here we get the info from the idoc table
IT_Z1INVRV = IDOC_DATA-SDATA.
ENDCASE.
PERFORM REV_INV.
ENDLOOP.
PERFORM UPDATE_IDOC_STATUS.
ENDLOOP.
FORM REV_INV "Reverse invoice form
*--- Local variables & constants
DATA: C_TCODE LIKE BKPF-TCODE VALUE 'VF11'. "BDC transaction code
*--- Now we can build the bdc table to call the reversal transaction start of screen 109
CLEAR BDC_TAB.
BDC_TAB-PROGRAM = 'SAPMV60A'.
BDC_TAB-DYNPRO = '109'.
BDC_TAB-DYNBEGIN = 'X'.
APPEND BDC_TAB.
*--- Document number
CLEAR BDC_TAB.
BDC_TAB-FNAM = 'KOMFK-VBELN(01)'.
BDC_TAB-FVAL = IT_Z1INVRV-XBLNR. "Billing document number
APPEND BDC_TAB.
*--- OK Code for screen 109
CLEAR BDC_TAB.
BDC_TAB-FNAM = 'BDC_OKCODE'.
BDC_TAB-FVAL = 'SICH'.
APPEND BDC_TAB.
*--- Now we can call transaction 'VF11' with the populated bdc table.
The transaction is called inside the idoc-contrl loop, so a transaction will be called for every idoc (journal).
the transaction is called in no-display mode ('N') because this code runs in background as it is called by ale.
The update is specified to be synchronous ('S') because we have to wait for the result to update the idoc status correctly.
CALL TRANSACTION C_TCODE USING BDC_TAB MODE 'N' UPDATE 'S'.
*--- Store the return code for use in another form (status update)
RETURN_CODE = SY-SUBRC.
*--- Here we check the return code, if there was an error, we put the transaction in a bdc session for the user to review and correct.
IF SY-SUBRC NE 0.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = 'ZINVRV'
USER = C_ALE_USER
KEEP = 'X'.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = C_TCODE
TABLES
DYNPROTAB = BDC_TAB.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3.
ELSE. "No problems
C_EXISTS = 'N'.
* Select from the billing document table to get sales doc number
SELECT * FROM VBRP WHERE VBELN = IT_Z1INVRV-XBLNR.
* Select from the sales document table to get user status number
SELECT SINGLE * FROM VBAP WHERE VBELN = VBRP-AUBEL AND
POSNR = VBRP-AUPOS.
* Select from the status table to change the user status to pending
SELECT * FROM JEST WHERE OBJNR = VBAP-OBJNR AND
STAT LIKE C_USER_STATUS.
IF JEST-STAT = C_US_PENDING. "User status is pending
JEST-INACT = C_UNCHECKED. "Make pending the active status
UPDATE JEST.
C_EXISTS = 'Y'. "I.E. An entry is already in table
ELSEIF JEST-INACT = C_UNCHECKED AND JEST-STAT NE C_US_PENDING.
JEST-INACT = C_CHECKED. "Make everything else inactive
UPDATE JEST.
ENDIF.
ENDSELECT.
IF C_EXISTS = 'N'. "I.E. Pending has never been a status before
JEST-OBJNR = VBAP-OBJNR.
JEST-STAT = C_US_PENDING.
JEST-INACT = C_UNCHECKED. "Make pending the active status
INSERT JEST.
ENDIF.
ENDSELECT. "Select from VBRP (Billing document table)
ENDIF.
ENDFORM. " REV_INV
FORM UPDATE_IDOC_STATUS.
*--- Now we check the CALL TRANSACTION return code and set IDOC status
CLEAR IDOC_STATUS.
IF RETURN_CODE = 0.
WORKFLOW_RESULT = '0'.
IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
IDOC_STATUS-STATUS = '53'.
IDOC_STATUS-UNAME = SY-UNAME.
IDOC_STATUS-REPID = SY-REPID.
IDOC_STATUS-MSGTY = SY-MSGTY.
IDOC_STATUS-MSGID = SY-MSGID.
IDOC_STATUS-MSGNO = SY-MSGNO.
IDOC_STATUS-MSGV1 = SY-MSGV1.
IDOC_STATUS-MSGV2 = SY-MSGV2.
IDOC_STATUS-MSGV3 = SY-MSGV3.
IDOC_STATUS-MSGV4 = SY-MSGV4.
RETURN_VARIABLES-WF_PARAM = 'Processed_IDOCs'.
RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
APPEND RETURN_VARIABLES.
ELSE.
WORKFLOW_RESULT = '99999'.
IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
IDOC_STATUS-STATUS = '51'.
IDOC_STATUS-UNAME = SY-UNAME.
IDOC_STATUS-REPID = SY-REPID.
IDOC_STATUS-MSGTY = SY-MSGTY.
IDOC_STATUS-MSGID = SY-MSGID.
IDOC_STATUS-MSGNO = SY-MSGNO.
IDOC_STATUS-MSGV1 = SY-MSGV1.
IDOC_STATUS-MSGV2 = SY-MSGV2.
IDOC_STATUS-MSGV3 = SY-MSGV3.
IDOC_STATUS-MSGV4 = SY-MSGV4.
RETURN_VARIABLES-WF_PARAM = 'ERROR_IDOCS'.
RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
APPEND RETURN_VARIABLES.
ENDIF.
APPEND IDOC_STATUS.
ENDFORM. " UPDATE_IDOC_STATUS
Figure 5: Inbound processing example code
Figure 5: Inbound processing example code
发表评论
-
ranges 语法
2011-06-23 13:17 863RANGES语句:要用与选择表相同的结构创建内表,可使 ... -
开发的误区
2011-06-22 23:28 7781.传输请求号的时候按传输序列号大小 传输绝对没问题,这是一个 ... -
ALV 颜色
2011-06-22 09:06 964关于ALV GRID的颜色 A ... -
数据库左连接与右连接
2011-06-09 11:48 2899左连接与右连接 左 ... -
co02权限增强
2011-06-09 11:12 1190CO02 有无撤销技术实现权限的增强 标 ... -
EXIT 出口查找程序
2011-06-03 11:23 1067SPAN { font-family: "Co ... -
将SmartForms转换为PDF保存到本地
2011-05-25 11:03 2799REPORT ZSMARTFORMS_TO_PDF.* Va ... -
abap动态内表
2011-05-20 11:43 1148This Tutorial details about c ... -
DYNP_VALUES_UPDATE 實時更新 Selection Screen
2011-05-19 15:56 1758DYNP_VALUES_UPDATE 實時更新 Selecti ... -
Smartforms 中更改默认编辑器的两种方法
2011-04-12 19:07 1741Smartforms 中更改默认编辑器的两种方法(Tow Me ... -
Implicit enhancement points
2011-03-22 14:35 1176SAP Implicit enhancement poin ... -
如何将应用程序文档加进SAP R/3并有效利用?
2011-03-21 18:31 854如何将应用程序文档加进SAP R/3并有效利用? sap ... -
sap 长文本
2011-03-21 18:13 1660SAP长文本编辑 在 ... -
获取当前 GRID
2011-03-21 11:36 782SPAN { font-family: "Co ...
相关推荐
ale_scenario_development_procedure
win10下出现Could not find module atari_py\ale_interface\ale_c.dll 解决时需要下载该文件,然而下载其需要科学上网,如果不能,那可以在这下
ABAQUS中在非线性切削这一块儿中关于ABAQUS中ALE的设置非常重要
edi/ale idoc SAP数据交换技术 EDI主要用于系统之间的数据交换,ALE一般用于系统内部数据交换,IDOC则是一种数据格式
ale_c.dll文件
单片机ALE引脚的用单片机ALE引脚单片机ALE引脚的用法用法
这个信号线的信号生成是MCU硬件电路实现的,不可以人工控制。 在某些内置TOM的MCU里,可以关闭ALE信号输出,以降低EMI
Notes for ALE, EDI, & IDOC Technologies for SAP
ALE 学习记录
ALE, EDI, & IDoc Technologies for SAP, 2nd Edition
讲诉ALE的概念,适合对ale已经有一点掌握的同学阅读
短波3G-ALE信号链路层数据编码分析.pdf
宽带信号 DOA估计 BASS-ALE 该算法优于CSM 和 ISM、
一篇不错的基于ALE的RFID中间件的设计与实现的论文,论文由浅入深,由面到点,很有参考价值
lsdyna ale方法模拟侵彻问题
ale idoc ale idoc ale idoc ale idoc
单片机上的ALE引脚作用不只是有一个,有多个,这里做一些简单的使用,正好了解该引脚的所有作用。
SAP IDOC ALE 经典教程 IBM咨询公司内部专用教程
idoc ale 配置,啊啊啊啊啊啊啊啊啊啊啊啊啊