0
votes

We are writing a tool in Java that parses and transforms ABAP code. We therefore have no intention to write new ABAP code but our tool has to handle all of ABAP, even obsolete statements. Furthermore, I'm not an ABAP expert.

We have an ABAP tool that extracts a system and writes it to XML. This program does not hold logic, so that I believe that the XML actually corresponds to the system.

I'm looking at the data generated by reading the text pool. The latter is read by READ TEXTPOOL; if existing, the attributes LANGU, ID, KEY, ENTRY, and LENGTH are written to the XML.

Now, I'm seeing text element entries in the XML that seem to violate the format as explained in the ABAP keyword documentation.

  • id=I, key is not of length 3. In particular, keys are like 01100001, SH010001, SF010001

  • id=R, key is present. Example: key="027". I even see an example where all attributes are the same but the key.

  • id=S, text element does neither start with " " (eight blanks) nor "D " (a 'D' followed by seven blanks)

  • text element length exceeds the maximum. We use the upper limits H=255, I=132, S=38, R=70, T=70. (Here, I'm not sure where our numbers come from)

As we transform text entries, we validate existing ones and cannot use existing ones that are too long. Can someone clarify?

2
Can you provide a reproducible example of such erroneous text pool entries? Unless it can be reproduced natively by using just READ TEXTPOOL on some report, it is more likely that your XML transformation is buggy, e.g. someone didn't account correctly for unicode or other codepage conversions since all the components of TEXTPOOL are character-like. - ACuriousMind

2 Answers

1
votes

You can use READ TEXTPOOL programname to get texts used in ABAP programs. According to the ABAP documentation:

| ID | KEY                                        | ENTRY                       | 
| H  | 001 through 004                            | List header Column headers  | 
| I  | ID of a text symbol                        | Text of the text symbol     | 
| R  | -                                          | Program title               | 
| S  | Name of a parameter or selection criterion | Selection text              | 
| T  | -                                          | List header Title bar       | 
  • id=I, key is not of length 3. In particular, keys are like 01100001, SH010001, SF010001 --> according to the definition above it is the name of a text symbol, means: the reference to the text used in the program (pointing on a text). So where did you get length = 3 ? Can't support this one.

  • id=R, key is present. Example: key="027". I even see an example where all attributes are the same but the key. --> normalle should be the executed programs title ... which is definitely capable to be longer then 3 digits

  • id=S, text element does neither start with " " (eight blanks) nor "D " (a 'D' followed by seven blanks) --> some of them might be auto-generated in ABAP and thus have some strange naming.

  • text element length exceeds the maximum. We use the upper limits H=255, I=132, S=38, R=70, T=70. (Here, I'm not sure where our numbers come from) Compared to your issues. --> text elements have a maximum of 255 characters, you can see that in abap STRUCTURE: TEXTPOOL has one field: TEXTPOOLTX CHAR 255

I think these would rather be the definitions to be checked:

ID      Type    TEXTPOOLID  CHAR    1
KEY     Type    TEXTPOOLKY  CHAR    8
ENTRY   Type    TEXTPOOLTX  CHAR    255
LENGTH  Type    TEXTPOOLLN  INT4    10

Hope this helps!

1
votes

I think the explanations you are mentioning are valid for text pools recently generated, but maybe there was an old logic when the XML was generated.

Moreover, it's not certain that the XML is the exact image of the text pool extracted by READ TEXTPOOL, and so it's difficult to answer.

It would be better that you execute READ TEXTPOOL today, and if there's something strange then maybe we can investigate.

About your existing XML, simply apply a workaround to get the right text elements :

  • for the lines with ID='I', take the first 3 characters of KEY
  • for the line with ID='R', ignore KEY (and ignore the extra lines)
  • for the lines with ID='S' try to see if the other values correspond to a text or to a
  • for the text elements, I completely agree with the lengths you have given, but if that doesn't work then either take the text based on the length or take the whole text and ignore the length.