Application Development 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: 

FORMAT_TEXTLINES FM for RFC

albertino87
Explorer
0 Kudos

Hi I'm trying to retrieve the long text report for several objects by using RFC_READ_TEXT in a python script. it works as expected but the text report is split in several lines with a formatting. I want to format the text and I'm trying to use RFC_FORMAT_TEXTLINES or FORMAT_TEXTLINES but I get an error as if they didn't exist.

Does it maybe have a different name?

1 ACCEPTED SOLUTION

DominikTylczyn
Active Contributor

Hello albertino87

RFC_FORMAT_TEXTLINES does not exist and FORMAT_TEXTLINES is not RFC enabled. Thus you can not call them from the Python script.

Why don't you format the text lines directly in the Python script using the following information on Structure TLINE of the Lines Table?

Best regards

Dominik Tylczynski

4 REPLIES 4

venkateswaran_k
Active Contributor
0 Kudos

Hi

Please show your code how you are calling this FM ( how you are assigning the import and table parameters)

Also show the error message / output you received.

DominikTylczyn
Active Contributor

Hello albertino87

RFC_FORMAT_TEXTLINES does not exist and FORMAT_TEXTLINES is not RFC enabled. Thus you can not call them from the Python script.

Why don't you format the text lines directly in the Python script using the following information on Structure TLINE of the Lines Table?

Best regards

Dominik Tylczynski

albertino87
Explorer
0 Kudos

Hi @venkateswaran.k,

I start the code like this:

After creating the connection to SAP with:

rfcCtl = Dispatch("sap.functions.unicode")

and logging in,

I call the function module with:

rfcCtl.Add("FORMAT_TEXTLINES")

I cannot pass the imports and tables parameters because it fails already at that line.

This approach works with both FM RFC_READ_TEXT and BBP_RFC_READ_TABLE.

Many thanks

venkateswaran_k
Active Contributor
0 Kudos

Oh, it is because FORMAT_TEXTLINES is not RFC enabled, that is why the trouble.

So, what you may have to do as work around, the read_text function would have return the table parameter as output. You need to loop that table and concainate each line to a single line.

This is what exactly the format_textlines also doing.