BSAO Text formating – part 1
When connecting SAP ECC to the Ariba Network, many customers face a discrepancy between how long text data is formatted in SAP and the Ariba Network.
Out of the box, we can configure the Ariba Network integration for SAP Business Suite (or Business Suite Add On – BSAO) to map each document header and item long texts to the cXML comments. Same things goes for the inbound documents.
We do this on SPRO Activity: “Map Texts of SAP ERP and Ariba Network”.
On the ECC PO, the long text are stored in text groups (Text IDs). This is highly configurable, and much of this information comes from presets, from the material master and from previous documents, such as the Purchase requisition.
The challenge here is that all the Text elements available on a SAP document will be mapped to a single Comments tag on Header and Item level. Here is a sample of the PO text mapping. All header texts are mapped to the Comments tag, the same goes for the item-level texts.
If only this configuration is done, the PO text on the AN will be displayed as a single string of text with no formatting to differentiate between the texts.
There is however a simple way to differentiate between the text types. In the BADI ARBERP_BADI_OUTB_MAP, method FORMAT_COMMENTS; we can set a separator string (40 characters) to be inserted between each text element.
Here is how it works:
For each Text ID you configured on the BSAO SPRO text mapping, this BADI is going to be called twice. One time before the text content is processed and another time after the text content is processed, so we can add a placeholder before and after each text.
The parameters bellow will identify if it is the beginning of the Text ID, end of Text ID, Beginning of Comment section (Header Comments or Item Comments), or end of Comment section.
Furthermore, we can also use the ABAP constant cl_abap_char_utilities=>cr_lf to add a line break to the text. Trust me. That improves A LOT readability.
In order to make the text content eve better to read, my suggestion is to add the Text ID description and a line break to separate each text. The snippet bellow will do just that.
DATA lc_header TYPE TDTEXT. * beginning of text IF IV_AT_START_OF_TDID = 'X'. * Get the Text ID description SELECT SINGLE TDTEXT INTO lc_header FROM TTXIT WHERE tdspras = IV_LANGU_ISO AND tdobject = IV_TDOBJECT AND tdid = IV_TDID. CV_TEXT = lc_header && cl_abap_char_utilities=>cr_lf. * End of text ELSEIF IV_AT_END_OF_TDID = 'X'. CV_TEXT = cl_abap_char_utilities=>cr_lf && cl_abap_char_utilities=>cr_lf. ENDIF.
With this quick development, now we have a nice formatted long text presentation to the Supplier.
What? So you noticed that the text lines still being treated as a single string of text within each text group? Well noticed. 🙂
Surely there is a way to do this, and it is fairly more complicated. I explain how it can be done in the follow on post BSAO Text formating – part 2.