cancel
Showing results for 
Search instead for 
Did you mean: 

SRM Longtexts in smartform: loop at it_text vs. include text

matteo_montalto
Contributor
0 Kudos

Hello gurus,

I'm facing an odd problem in SAP SRM 7.

Basically; I'm dealing with a custom smartform which should be able to print eventual notes which are part of the purchasing document (PO, or Contract).

The problem is as follows:

when I get the text from the system, these are filled with '#' to represent the carriage return. I've seen that the standard smartform has a routine to get rid of these separators, so in a certain way we could say that this problem could be solved using a code routine.

BUT....

..the problem: once I have the text stored in an internal table, the only way to print it on the smartforms is a LOOP routine. And doing so, the alignment is completely lost. Just to provide an example, suppose I have an internal table which contains the following text:

row 1: This is just an example which shows that a very long line without any Carriage Return leads to a problematic print

row 2: and that's a problem.#

row 3: Alignment/text formatting seems not to be good.#

I could work on that text and rebuild the following structure:

row 1: This is just an example which shows that a very long line without any Carriage Return leads to a problematic print

row 2: and that's a problem.

row 3: Alignment/text formatting seems not to be good.

Now; to print this text, I would LOOP on the table, but supposing the space in the form for the text is too short for the first line, that's the output I'd get:

This is just an example which shows that a very long line without any Carriage Return leads to a probl

ematic print

and that's a problem.

Alignment/text formatting seems not to be good.

That's because:

  1. The LOOP iteration processes a row at time, so the routine cannot "understand" that row 2 has to be concatenated to the first one.
  2. Moreover, there's no TDFORMAT indication that could be used to provide an elementary formatting convention.

What if I use INCLUDE TEXT directly using an access key to the DB standard table (STXH)?

There TDFORMAT field is considered, so text formatting could be ok. The problem is that i get a sharp char # on any Carriage Return or unknown char.

Has anyone a suggestion on how to overcome the problem?

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member209818
Active Contributor
0 Kudos

Hi Matteo,

I think while creating the notes, you should avoid putting the "#" in the notes. It may requirement for your other system where carriage return is required. But as SAP can handle it using include text, you should find a way to get rid of that character while loading the notes in the Contract OR PO.

Alternatively, can you try Read_text? get all the details in a internal table. Replace all your # in that internal table. This will keep your formats as it is.

Then with modified Internal table, create a new Temporary Text using "Create_text" or Save_text and use this text for printing. After your use, you can delete this temporary text.

- Harshad

matteo_montalto
Contributor
0 Kudos

thanks harshad, I solved the problem by adapting a couple of standard SAP OSS notes smartforms

Former Member
0 Kudos

Dear Matteo,

I am facing similar problem in one of my custom smartforms.

Can you please share details of the standard OSS notes which you implemented to resolve this issue.

It will be very helpful for me.

Thanks,

Bhavesh

matteo_montalto
Contributor
0 Kudos

Hi Bhavesh,

if you're referring to the '#' problem, then note 1546761 is what you're looking for:

https://service.sap.com/sap/support/notes/1546761

Consider that there are a couple of notes as prerequisite, and that the note applies to standard Smartform so you'll have to "adapt" it to you own customs.

Consider also:

https://service.sap.com/sap/support/notes/1740523

https://service.sap.com/sap/support/notes/1740705

Hope this helps, in case you don't get the solution please refer further details on your specific problem.
At the moment I cannot access the system but maybe it could be helpful to see how I solved text-related problems.