Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

READ_TEXT parallel cursor

jeff_broodwar
Active Participant
0 Likes
2,899

Hi Experts,

I'm currently working on a simple report that will use READ_TEXT function module. Unfortunately the the parameters used returns more than one text for each document (TDLINE), I'm looping through the FM to process all my documents stored in select-options. Is there a way to avoid loop within a loop in reading the output table since TDLINE doesn't have unique key to use parallel cursor?

Thank you,

Jeffrey

1 ACCEPTED SOLUTION
Read only

jeff_broodwar
Active Participant
0 Likes
2,680

Agree with the use of 2 new FMs or using decompress and processing STXL discussed in this thread:

https://answers.sap.com/questions/8178100/mass-reading-standard-texts-stxh-stxl.html

Thanks everyone for sharing.

Jeffrey

8 REPLIES 8
Read only

Sandra_Rossi
Active Contributor
0 Likes
2,680

I guess you don't give the same meaning of "parallel cursor" as the one used frequently in this forum.

If your question is about how to concatenate all lines of the text into a STRING variable, it has been already asked in the forum: search CONVERT_ITF_TO_STREAM_TEXT.

Read only

BaerbelWinkler
SAP Champion
SAP Champion
2,680

Hi Jeff,

please see my comment in your related thread:

https://answers.sap.com/comments/13178269/view.html

Bottom line: you'll always end up with an internal table when retrieving the long texts via one of the available FMs like READ_TEXT. But looping through the provided TDLINE internal table is not an issue performance wise (and it's not considered "parallel cursor").

Cheers

Bärbel

Read only

0 Likes
2,680

Hi Barbel,

Read text FM is encapsulated inside a loop because of select-options containing the documents that need to be read, inside this loop is the loop for getting the records inside table TDLINE so therefore its gonna have loop inside a loop, since tdline doesn't have a key then I suppose getting the FMs as proposed earlier is the best case scenario or using Raymond's solution of not calling read_text at all and decompressing table.

Thanks for the inputs.


Jeffrey

Read only

0 Likes
2,680

jeff.broodwar

Hi Jeff,

Raymond suggests using one of the alternative FMs I also already mentioned (which you'd have to get into your 7.40 system via the OSS-Note mentioned in the other thread). There is no way to directly read the text lines from an SAP-table, you always need to use one of the FMs provided by SAP and regardless of which of these you use, you'll always have the text lines in an internal table which doesn't have a key.

Cheers

Bärbel

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,680

I propose to continue the discussion in your previous question: https://answers.sap.com/questions/13175145/using-read-text-with-range-for-name-without-table.html

NB: to be discussed in the other thread: what is impossible for me to understand is your fear of calling READ_TEXT several times, and even more why fearing the concatenation of lines (matter of microseconds). You should base your decisions on measured facts: performance measure and target maximum and average data volume. And if you have an old SAP without READ_MULTIPLE_TEXTS and you expect to read hundreds or say thousands of texts, Raymond proposed a blog post with code inside equivalent to READ_MULTIPLE_TEXTS (and I also extended the solution with my own gist code at github, as you can see in the comments).

Read only

jeff_broodwar
Active Participant
2,680

Hi Sandra,

2 points:

Parallel cursor - the design is looping through read_text since the documents are inside select-options. then getting tdline records will need another loop. since no key is present inside tdline then there's no way to read and use parallel cursor on this, my bad as I didn't explain fully the context.

Text to string - nope, but I agree with Raymond's solution. Furthermore, nothing to fear in read_text it's just the scenario provided where the output of tdline may contain several rows which will require loop while inside select-options loop. Its just standards that we're looking after, in terms of performance, it's just several records I don't think it will cause any issues.

Thanks for your time.

Jeffrey

Read only

jeff_broodwar
Active Participant
0 Likes
2,681

Agree with the use of 2 new FMs or using decompress and processing STXL discussed in this thread:

https://answers.sap.com/questions/8178100/mass-reading-standard-texts-stxh-stxl.html

Thanks everyone for sharing.

Jeffrey

Read only

0 Likes
2,680

As other community members have already tried to help you on your other question: https://answers.sap.com/questions/13175145/using-read-text-with-range-for-name-without-table.html we will close this question as it is a duplicate question. However, if you found the solution yourself, please let other community members know in the question linked above.