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

Adding a field containing multiple comment lines to a table

Former Member
0 Likes
1,486

Hi,

I am creating a Z-table and have a requirement to add comments against each record of this table. The comments can span multiple lines and can contain bullet points as well ( just as the texts for a header or item in a SAP document). How to achieve this?

I am thinking of creating standard texts or long texts and bind the same against each record. Is this feasible? Has someone done something similar before?

Regards,

Rahul.

Hi,

I am creating a Z-table and have a requirement to add comments against each record of this table. The comments can span multiple lines and can contain bullet points as well ( just as the texts for a header or item in a SAP document). How to achieve this?

I am thinking of creating standard texts or long texts and bind the same against each record. Is this feasible? Has someone done something similar before?

Regards,

Rahul.

6 REPLIES 6
Read only

Former Member
0 Likes
1,390

This is the normal way of doing things and if you search SCN you'll find plenty of examples of how to do it.

Rob

Read only

joltdx
Active Contributor
0 Likes
1,390

Hello!

Of course, you could also use a string datatype for that field.

That depends on how you intend to get the data input and how to present in output. If you want to use long text editor as well, of course go with that option. If you just want some text, maybe a string is the simplest way?

Best regards

// Jörgen

Read only

Former Member
0 Likes
1,390

Thanks for the replies..I tried searching SDN for some examples as to how to link Standard texts to a z table but could not find any..Do you have an example of how it is used??

Read only

0 Likes
1,390

Well, you don't really link them to the table. You use key fields common to both.

Have a look at the documentation for the various TEXT FMs.

Rob

Read only

0 Likes
1,390

You don't actually need to store the texts in your z table but can use function modules SAVE_TEXT and READ_TEXT.

I don't have the syntax in front of me but you need an id and an object for the "type of text" and an object key that uniquely identifies the data object to which your text should belong.

They're really simple and straight forward FMs. Try them in SM37.

Best regards

// Jörgen

Read only

0 Likes
1,390

Hi Rahul,

Foy your reference,  i have used the below code to fetch SAPSCRIPT text lines

data:  gw_stxl   TYPE  stxl,


*Types Declaration
TYPES: BEGIN OF t_line,
         tdformat TYPE tdformat,
         tdline TYPE tdline,
        END OF t_line,


*Tables Declaration
DATA:  gt_line   TYPE  STANDARD TABLE OF t_line,   ""Table for TLINE
          gw_line    TYPE  t_line,

           gw_header TYPE  thead,



CALL FUNCTION 'READ_TEXT'
     EXPORTING
*    CLIENT                        = SY-MANDT
       id                            = gw_stxl-tdid
       language                      = gw_stxl-tdspras
       name                          = gw_stxl-tdname
       object                        = gw_stxl-tdobject
    IMPORTING
      header                         = gw_header
     TABLES
       lines                         = gt_line



or else, goto SE37 ->provide the FM name Read_text , after that utilities -> where used list - u can get list of programs ,as which FM used.



Regards,

Kannan