Generación de LSMW utilizando BAPI
Generación de LSMW utilizando BAPI ... 1
Crear Proyecto ... 1
Activar Puerto de archives para IDOCS ... 2
Creating Ports ... 3
Partner Types ... 5
Partner Numbers ... 6
Checking the Workflow Customizing ... 9
Maintain Source Structures ... 11
Maintain Source Fields ... 13
Maintain Structure Relations ... 15
Maintain Field Mapping and Conversion Rules ... 16
Specify Files ... 17
Assign Files ... 18
Read Data ... 19
Display Read Data ... 19
Convert Data ... 20
Display Converted Data ... 20
Start IDoc Generation ... 21
Start IDoc Processing ... 22
Create IDoc Overview ... 24
Recomendaciones ... 25
Crear Proyecto
Activar Puerto de archives para IDOCS
Para esto nos podemos basar en la help sap
http://help.sap.com/saphelp_erp2004/helpdata/en/91/08e5ba2def11d3bc3600105a658 8b2/frameset.htm
IDoc Inbound Processing
UseIDocs (intermediate documents) have been developed for the exchange of messages between different systems. Providing a standard interface with the SAP system, this technique can also be used to transfer data.
For more information, choose IDoc Interface in transaction WEDI. . See also: Starting IDoc Generation
Prerequisites
To be able to use IDoc inbound processing, you have to define settings and perform preparatory tasks. These tasks are grouped on the initial screen of the LSM Workbench under Settings → IDoc Inbound Processing.
To use IDoc inbound processing, you must first perform the following steps: 1. Define or select a file port for transporting the file. Optionally, you can also create a tRFC port.
See Creating Ports
2. The partner type has to be defined or selected. See Partner Types
3. The partner number has to be defined or selected. See Partner Numbers
4. IDoc inbound processing must be activated, and the workflow customizing must be checked. Both of these tasks are performed once in each system.
Creating Ports
UseA port has to be available for a transfer of data from a legacy system to the SAP System by means of IDocs. As well as the file port, you can also specify a tRFC port. For data conversion, you can decide whether a file should be created or whether the data should be passed to inbound processing by "packages" directly.
See Starting IDoc Generation Prerequisites
You have chosen Settings → IDoc inbound processing on the LSMW initial screen, and
the IDoc inbound processing: Preparations screen is displayed. Procedure
We recommend to maintain the following entries: ...
Choose Maintain ports.
The WF-EDI: Port Definition screen appears. Activate the change mode.
Position the cursor on File and choose Create.
Fill in the given fields. Recommendation: Port:
LSMW
Description: Legacy System Migration Workbench Version: IDoc record types: SAP Release 4.x
If you additionally want to create the transactional RFC port:
Position the cursor on Transactional RFC and choose Create. Fill in the given fields.
Save your entries.
Choose F3 or Back to return to the IDoc inbound processing: Preparations screen. Si exportas un LSMW de alguno existente debes de refrescar el proceso de creacion para que actualice los perfiles
Result
The partner port has been created. More Information
See also: Partner Types See also: Partner Numbers
Partner Types
UseYou must select a partner type when you transfer data from an external system or legacy system to an SAP system in IDocs. For the LSMW, we recommend that you use the partner type US.
Prerequisites
You have chosen Settings → IDoc Inbound Processing on the LSMW initial screen, and
you are on the screen IDoc Inbound Processing: Preparatory Measures. Procedure
Enter US as the partner type. To do this, proceed as follows:
1. Choose Maintain Partner Types. 2. Activate the change mode. A table is displayed.
4. Fill in the fields. Recommended values:
Partner type: US
Report name: /SAPDMC/SAP_LSMW_PARTNERTYPES
Form routine: READ_USER
Short text: <any>
5. Save your data and choose F3 or Back to return to the screen IDoc Inbound
Processing: Preparatory Measures.
See also: Transaction WE20 → Maintain Partner Profiles Result
The partner type has been created.
Partner Numbers
UseYou must select a partner number when you transfer data from an external system or legacy system to an SAP system in IDocs.
Prerequisites
You have chosen Settings → IDoc inbound processing on the LSMW initial screen, and
Procedure
Enter LSMW as partner number. Or:
...
1. Choose Maintain partner numbers. The Partner Profiles screen appears. 2. Choose Create.
3. Fill in the given fields. Recommendation:
Partner number:
LSMW Partner type: US
Partner status: A (active)
Type: US
Language: EN or DE
ID: Your user ID
4. Save your data and choose F3 or Back to return to the IDoc inbound processing:
Preparations screen.
Result
Checking the Workflow Customizing
UseWorkflow Customizing defines the requirements for using IDoc inbound processing. Prerequisites
You have chosen Settings → IDoc inbound processing on the LSMW initial screen, and
the IDoc inbound processing: Preparations screen is displayed. Procedure
...
1. Choose Workflow customizing.
The Workflow Customizing screen appears.
2. Choose Perform Automatic Workflow Customizing. The auto customizing log for the runtime system is displayed. 3. Check the entries.
The following entries of the workflow runtime system must have a green checkmark assigned to them:
– Maintain System Administrator for Workflow.
– Configure RFC Destination.
– Classify Decision Task as General.
– Activate Send to Objects and HR Objects.
Maintain Object Attributes
Se da click al botón y se selecciona la opción Business Object Method (BAPI)
En el campo Business Object se selecciona el objeto, para este ejemplo utilizare BUS1001006, para crear material estandar
Una vez seleccionado, en el campo Method, se selecciona la BAPI que se desea utilizar
Y se puede grabar el primer paso.
Maintain Source Structures
Se da click al boton de modificar y luego al de crear. Cuando se genera una
estructura para una grabación en batch, se crea una estructura única; para el caso de las bapis se deben crear mas estructuras; esto depende de las estructuras de import que maneja la BAPI.
Para este ejemplo se manejan dos estructuras. Se crea la estructura de cabecera
Maintain Source Fields
Se deben indicar los campos del layout; lo que diferencia este proceso con BAPI al del BATCH es que se debe generar un indicador para la cabecera y las posiciones en la BAPI.
Indicador para cabecera
Indicador para posición
Debido a que se generan dos estructuras, el layout contempla dos líneas para cada dato maestro que se desea generar.
BAPI.xlsx
Maintain Structure Relations
Se da click a la opción Maintain Structure Relations
Se da click al botón de modificar y se asignan las estrucutras de origen con las estructuras de la BAPI.
Maintain Field Mapping and Conversion Rules
Se debe considerar que algunas de las bapis tienen estructuras de confirmación, ejemplo:
Los datos capturados en la bapi E1BP_MARC deben ser confirmados con una X en al estructura E1BP_MARCX, de lo contrario no se actualizaran.
En este punto es imprescindible entrar a la transacción SE37 para validar el trabajo estándar de la BAPI, una vez conociendo su funcionamiento, es más fácil generar su LSMW
Specify Files
Se debe tener cuidado en seleccionar la opción de datos para multiples estructuras de origen
Este es el archivo que se cargara en el ejemplo
BAPI.txt
Assign Files
Aquí se asigna el archivo dos veces, una por cada estructura, solo se puede hacer si existen 2 estructuras de origen y si se selecciono la opción indicada en el punto 8.
Read Data
Se ejecuta la opción de manera normal
Display Read Data
Convert Data
Se ejecuta la opción de manera normal
Display Converted Data
Cada línea verde representa un documento generado y abajo las estructuras que se ocupan para el envío de datos.
Start IDoc Generation
El proceso genera un IDOC por cada registro que se va crear
Start IDoc Processing
Create IDoc Overview
Se ejecuta la opción de manera normal; esta opción permite visualizar los mensajes de los IDOCS ejecutados
Recomendaciones
Buscar la bapi y ejecutarla en la transacción se37, el objetivo es conocerla y saber la totalidad de campos0020a llenar y la estructura de labapi.