Você está na página 1de 7

Posted by feimster under LSMW, SAP | Tags: BAPI, EDI_PATH_CREATE_CLIENT_DOCNUM, IDoc, IDoc Inbound Processing, LSMW, partner, Partner

profile, Process code, SM59, tRFC, WE20, WE21, WE44 | Leave a Comment Ive come to realize the power of IDoc processing in LSMW. Processing IDocs directly or via BAPI provides a wide range of functionalities that cannot be replicated with recordings. I realized that I had not documented how to configure and activate inbound IDoc processing for use with an LSMW project. Even though the LSMW project itself is cross-client, the IDoc settings are not. These settings must be configured in each client and for each project where the IDocs are to be used. Several parameters are needed to allow inbound IDoc processing:

File port tRFC port Partner Partner profile

These settings can be executed in the LSMW transaction or independently through other transaction codes. Once the parameters have established, IDoc processing will need to be activated. The activation must be executed within the transaction LSMW. Upon completion of the steps, the LSMW project in that particular client will be able to use the IDoc processing parameters. After moving or transporting the LSMW project to another client, these settings must be configured again. Other projects can use the same parameters, but the activation is specific to a particular project. The settings mentioned above are stored in global variables which are referenced in the field mapping portion of the LSMW definition. These fields and their associated values are beyond the scope of this post. Suffice it to say that they provide the necessary structural information in the IDoc header segments and are commonly populated by the system in the mapping. Inbound IDoc Processing Use transaction LSMW to access the initial selection screen for LSMW. The parameters for inbound IDoc processing can be maintained via this screen. Remember that the parameters established here are specific to a project and the client. Be sure to enter at least the project name prior to beginning the process in order to establish the link between the parameters/activation and the project itself.

To access the inbound IDoc processing parameters and activation screen, use menu path Settings | IDoc Inbound Processing.

The resulting screen shows all of the necessary IDoc processing parameters for establishing this functionality.

Notice that the project field above is disabled indicating that the parameters below are specific to that project. Although only three of the four fields are mandatory, it is strongly recommended that valid entries for all four fields be created using the steps detailed below. As mentioned earlier, the parameters above can be created or maintained directly from this screen or via separate transactions. Maintain Ports Two ports should be maintained for full IDoc processing functionality via BAPI one File port and one tRFC port. The tRFC port is not mandatory, but is strongly

recommended to ensure that most BAPI functionality is covered. A Transactional RFC will help when attempting to submit your data directly to IDoc processing rather than creating a file first before submitting. I suggest creating both. Access the port maintenance screen by clicking on the button labeled Maintain Ports. Refer to the screenshot below. This screen can also be reached via transaction WE21. Although there are number of different ports that can be created via this transaction, the focus of this document is on the first and second options Transactional RFC and File.

Select the folder labeled Transactional RFC and click on the button Create. You can also copy an existing entry, if one exists. The tRFC port can be a system-generated name or your own name. The system-generated namespace begins with A followed by nine digits. Custom names can be up to ten characters. I prefer my own name LSMW_TRFC.

In the details of the tRFC port, you need to provide a description and destination.

The description is a free-form text field allowing up to 50 characters. Always use the Release 4.x version selection this should be the default. The RFC destination must be selected from the dropdown list of existing destinations. Although the definition of this list is beyond the scope of this document, you can create via transaction SM59. For my purposes, the destination has typically been the client in which I am working. If you create a tRFC port for the same RFC destination, the system provides a warning message indicating that a port already exists. Follow similar steps for the creation of the File port. Select the folder labeled File then click on the button Create. You can also copy an existing entry, if one exists.

I use a port name similar to the tRFC port above (LSMW_FILE) and a corresponding description. Use the Release 4.x version again as well as ensure that Unicode is selected these settings should be defaulted.

For the lower, tabbed section of the new entry, I suggest using the following selections and settings. You do not need to modify anything other than the first tab. Select the option for physical directory (selecting logical directory would require you to create a logical path refer to my previous post on this topic). When you clicked New entries, the system should have proposed a directory for you this field does not need

modification. Be aware that, upon saving, the system does not validate whether this is an actual directory or not. Best not to modify anything at all. The function module field is optional, but the one shown above (EDI_PATH_CREATE_CLIENT_DOCNUM) is recommended by SAP. The outbound file field is also optional. I suggest using something like shown in the screenshot above. Although these two fields are optional, at a minimum one or the other should be populated. Save and return to the IDoc processing screen. Populate the new ports in the appropriate fields. Maintain Partner Profiles There are two other fields that need values: partner type and partner number. Follow the instructions below to identify and create these required values. Click on the button Maintain Partner Types to start. You can also reach this via transaction WE44.

This table should not need maintenance simply validate that an entry for US (User) exists. Return to the IDoc processing screen and add US to the partner type. Continue by clicking on the button Maintain Partner Numbers (also reachable via transaction WE20).

Select partner type US and click on create.

There are three fields that need input here. The partner number is a ten digit field. I use the partner LSMW for no other reason than its simple. On the tab Post processing: permitted agent, both the Type field and the Agent field need values. I use US and my userid, respectively. No other entries are necessary. When you start working with a BAPI or IDoc based LSMW, an inbound parameter will be added automatically when you establish the Object Attributes. Be aware that sometimes this automatic creation does not always provide you the best settings for your LSMW. You may need to return here and tweak a setting (specifically, the process code) to make things run smoothly.

Save and return to the IDoc processing screen. Add the partner number you created. Press enter to validate the entries the system should automatically save your data. Click the button labeled Activate IDoc Inbound Processing to complete the preparation steps. The system should prompt you to confirm the activation. Once accepted, the system will confirm with a message indicating that the data populated above was saved to the database. Thats all! Now youre ready to start using the BAPI and IDoc selections in the Object Attributes of LSMW. I have some subsequent posts that will describe in detail some uses of BAPI and IDoc. Until then, give it a try yourself. Good luck!

Você também pode gostar