The following post is regarding an issue encountered when trying to extract Bill Of Material Item information from the ECC, where some of the fields show correct values in the ECC system (RSA3) and incorrect decimal place in the PSA in the BW system.

This issue relates to use of the standard function CSAP_MAT_BOM_ITEM_SELECT under certain conditions, but the solution may be relevant for other similar cases.

In short, the standard function populates certain fields using the WRITE function, which caused a problem with the formatting of the data in our system. Instead we’ve enhanced the return structure of the function with new fields and populated them with direct assignment.

Issue And Solution In Detail

For our purposes, we’ve used the code for the function YCPS_BOM_ITM detailed in the document. CSAP_MAT_BOM_ITEM_SELECT is called within that function.

The field “comp_qty” was showing incorrect values in the PSA – some of the results were multiplied by 1000, some weren’t. The values in RSA3 were correct. Notice that this is following a replacement of “,” with “.” in the code in theaforementioned document. removing that replacement, we got results with a comma where the decimal point should be. In either case, the result in the PSA was incorrect in our system.

The field “comp_unit” was showing correct values in the PSA, however values were causing a run-time error at the BEX level (and were also showing wrong when running se37 for CSAP_MAT_BOM_ITEM_SELECT in the source system – as asterisks – ** ).

In an answer from SAP, it was suggested that we examine the decimal notation setting of ALEREMOTE. Creating an additional user for extraction with different settings was considered.

Instead we found an ABAP solution for this. Debugging into CSAP_MAT_BOM_ITEM_SELECT, we saw that the values of those fields were transferred using WRITE into the output structure in program LCSAPFC1, form convert_stpo_to_extern_format .

The solution was to add new fields in an append for the output structure STPO_API02 , and populate them with assignment in the enhancement in that form, without using the WRITE function. See code below.

Fix for incorrect quantity values – Enhancement in LCSAPFC1

Following is the part in the form “convert_stpo_to_extern_format” in LCSAPFC1 where the original fields are populated:

write i_stpo–menge to o_stpo–comp_qty unit i_stpo–meins.

write i_stpo–meins to o_stpo–comp_unit.

And here is the code for populating the new fields, just before the endform statement: