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: 

How to deal with long text ?

1190_5939_439
Active Participant
0 Kudos
216

Hi Experts

Recently I am developing an interface . I need deal with long text and send it to external system.

The raw data format is following :

I will get following format data.

1,2,3,4,5,6,7

Can you help me ?Thanks.

7 REPLIES 7

Sandra_Rossi
Active Contributor
0 Kudos
131

What is your issue with the "long text"? What "long text" are you talking about? What interface is it?

1190_5939_439
Active Participant
0 Kudos
131

Hi Sandra.

I am sorry that I don't upload the attachment just now. Now I have uploaded it . the interface is that SAP sending data to externla system.

FredericGirod
Active Contributor
0 Kudos
131

Search for READ_TEXT function module.

After you just have to make a loop on the internal table & a concatenate

1190_5939_439
Active Participant
131

Hi Fredeic

First, I must split it and then concatenate it. how to add comma ?




DATA: f_tdname TYPE tdobname,                                           " add it by jingguilin 20211014

        tab_sap_script_text TYPE tline OCCURS 10,

        s_sap_script_text   TYPE tline,

        lw_name TYPE string.



    CONCATENATE  sy-mandt it_data-AUFNR  into  f_tdname .

        CALL FUNCTION 'READ_TEXT'                         " Add it by jingguilin 20211014

     EXPORTING

          ID              = 'KOPF'

          LANGUAGE        = sy-langu

          NAME            = f_tdname

          OBJECT          = 'AUFK'



     TABLES

         lines    = tab_sap_script_text

     EXCEPTIONS

          ID              = 01

          LANGUAGE        = 02

          NAME            = 03

          NOT_FOUND       = 04

          OBJECT          = 05

          REFERENCE_CHECK = 06.



  IF sy-subrc = 0.

      READ TABLE tab_sap_script_text INTO s_sap_script_text INDEX 1.


    ENDIF.

matt
Active Contributor
0 Kudos
131

In the ABAP keyword help, there is exactly how to convert strings in a table into a delimited string, using REDUCE.

FredericGirod
Active Contributor
131
Loop at ... reference into data(o_...).
if sy-tabix ne 1.
concatenate my_string my_split o_..->tdline into my_string.
else .
my_string = o_...->tdline.
endif.
endloop.

something like that

matthew.billingham, I need to check this REDUCE, I never use it.

matt
Active Contributor
131

https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abenreduce_text_abexa.htm

DATA(sentence) = REDUCE string( INIT text = `` sep = `` 
                                 FOR word IN words        
                                NEXT text = |{ text }{ sep }{ word }| sep = `,` ).