Skip to Content
0
Nov 24 at 11:54 AM

Keep the whitespaces in the internal table, which receives data from Excel

86 Views

Hello experts,

We have a Z program, which uploads XLSX file to SAP. The program calls FM ALSM_EXCEL_TO_INTERNAL_TABLE, which uploads the excel file to SAP. According to the debugger - in an inner step (9) DP_GET_STREAM_FROM_FRONT calls to FM DP_GET_CLIENT_TABLE45A.

image.png

In DP_GET_STREAM_FROM_FRONT

image.png

When DP_GET_CLIENT_TABLE45A finds a whitespace in the file, the FM replaces it by # character. i.e., the internal table DATA (line 152 above), which is returned by the FM, has # instead of white space.

image.png

Later when ALSM_EXCEL_TO_INTERNAL_TABLE receives this internal table, it considers the # as separator and therefore divides the data into two. For example if the cell in the Excel file contains o/<whitespace>p it is sperated into “o/ AND p”

image.png

The code in ALSM_EXCEL_TO_INTERNAL_TABLE, which divides the data into two is:

image.png

This behavior (that the data in one cell is divided into two) disrupt the data, which is uploaded into SAP.

My goal is to find the whitespaces in the file and to notify the user. (He will fix the file). The problem is that the data which, is returned from the FMs, do not include the whitespaces (they were replaced by #).

How can I upload Excel file to internal table with the whitespace? (and then check if it has whitespace by cl_abap_char_utilities=>get_simple_spaces_for_cur_cp( ))

FYI

When looking in the excel file

1. 1. In the cell the whitespace is not seen (red)

2. In the yellow area you can see the whitespace

image.png

Thank you in advance

Hagit

Attachments

image.png (115.1 kB)
image.png (262.6 kB)
image.png (28.1 kB)
image.png (42.6 kB)
image.png (81.7 kB)
image.png (19.1 kB)