SAP PI/PO, SFTP to SOAP scenario, sending a csv file

In this entry I’m going to share the configuration to convert a simple CSV file to XML using a File Sender Adapter (SFTP), as following:

Source file (CSV):

Num_empleado,Infotipo,Subtipo,Fecha_inicio,Fecha_fin,Cantidad
00049250,2002,0752,20220617,20220617,9
00049250,2002,2005,20220613,20220613,6

Output (XML):

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ns0:MT_CargaIncidenciasFile xmlns:ns0="http://dummy.com/LGCYHR/enviarCargaIncidenciasFile">
    <Datos>
        <num_emp>00049250</num_emp>
        <infotipo>2002</infotipo>
        <subtipo>0752</subtipo>
        <fecha_inicio>20220617</fecha_inicio>
        <fecha_fin>20220617</fecha_fin>
        <cantidad>9</cantidad>
    </Datos>
    <Datos>
        <num_emp>00049250</num_emp>
        <infotipo>2002</infotipo>
        <subtipo>2005</subtipo>
        <fecha_inicio>20220613</fecha_inicio>
        <fecha_fin>20220613</fecha_fin>
        <cantidad>6</cantidad>
    </Datos>
</ns0:MT_CargaIncidenciasFile>

First, the Message Mapping, is a simple one to one field mapping:

Now, into the sender Communication Channel, the File Content Conversion must be selected in Message protocol, then go to Content Convertion tab and set the next values in the fields and the parameters:


** Content Conversion **
----------------------------------------------------------------------------
| Name                | Value                                              |
|:--------------------|:---------------------------------------------------|
| Document Name       | MT_CargaIncidenciasFile                            |
| Document Namespace  | http://dummy.com/LGCYHR/enviarCargaIncidenciasFile |
| Document Offset     | 1                                                  |
| Recordset Name      | Datos                                              |
| Recordset Namespace | http://dummy.com/LGCYHR/enviarCargaIncidenciasFile |
| Recordset Structure | Datos,*                                            |

** Parameters **

----------------------------------------------------------------------------------------
| Name                      | Value                                                    |
|:--------------------------|:---------------------------------------------------------|
| Datos.fieldNames          | num_emp,infotipo,subtipo,fecha_inicio,fecha_fin,cantidad |
| Datos.fieldSeparator      | ,                                                        |
| Datos.endSeparator        | 'nl'                                                     |
| Datos.keyFieldInStructure | ignore                                                   |
| ignoreRecordsetName       | true                                                     |


If you want to archive files:

  • Into Advanced Tab set the parameter Archive Name = /path/to/archive/%TIME_%SEQNUM
  • Into Processing Tab check Delete File option

That’s it, a very simple file convertion, bye =)

References

Deja un comentario

Este sitio utiliza Akismet para reducir el spam. Conoce cómo se procesan los datos de tus comentarios.