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: 

Concatenate Long Text Into String for smart form Printing.

Former Member
0 Kudos

Hi ,

I want to move the data of long text into the string in the exporting and importing process i the module pool , i have the defined the

DATA NEC TYPE TABLE OF char255. for exporting and importing the text in which i could able to concatenate the line item of the text in the NEC ,please suggest me the solution for this .



Regards

Vishnu Ravi

1 ACCEPTED SOLUTION

Jelena
Active Contributor
0 Kudos

A bit confused by the choice of a helpful reply here... Instead of "wrapping" and "unwrapping" text why not just let the Smartform refer to the include text (as Mehwish suggested)? Or why not just pass a table to the Smartform (doesn't have to be a string)? Or even using the FM mentioned by Rajkumar would still be better than counting characters...

15 REPLIES 15

pavanm592
Contributor
0 Kudos

Hi Vishnu,

As per my understanding you want to print this long text table in smart by sending it in string from driver program if it is the case i would suggest you to export the NEC table to smart form and there use the Program lines code and separate as per your requirement.

Please let me know if i am wrong.

Regards,

Pavan

anubhab
Active Participant
0 Kudos

Hello Vishnu,

     You can transfer the content of the NEC table to some string variable by LOOPing. Import that string to smartform. Print the string as follow:

v_length = 255.

&v_ltext(v_length)&&v_ltext+255(v_length)&&v_ltext+510(v_length)& and so on.

Hope this helps.

Regards,

Anubhab

former_member188827
Active Contributor
0 Kudos

Instead of concatenating the text in string, use "include text" option of text node. fill the text object, ID and name and long text would be displayed accordingly.

former_member187651
Active Participant
0 Kudos

Dear Ravi,

I I have faced the similar issue and found there is single way to print line item in smartform.

you have to get each line of the table in variable and Concatenate them in a single variable(you can loop on itab and concatenate the work area) and then split them on "." or some special character to store in different variable.

Print these variable to the smartform text.

In case of PO header text, you have the similar solution in smartform.

Regards,

Chandan

Former Member
0 Kudos

Thank you for all your replies

Regards

Vishnu Ravi

rajkumarnarasimman
Active Contributor

Dear Vishnu,

To convert the Internal Table into String, use the following Function module 'IDMX_DI_TLINE_INTO_STRING'.

"Function to convert the Internal Table to String

CALL FUNCTION 'IDMX_DI_TLINE_INTO_STRING'

   EXPORTING

     it_tline                        = nec

  IMPORTING

    EV_TEXT_STRING       = l_mat_desc.

Regards

Rajkumar Narasimman

0 Kudos


thanks raj I am also had the same issue this has worked for me

Jelena
Active Contributor
0 Kudos

A bit confused by the choice of a helpful reply here... Instead of "wrapping" and "unwrapping" text why not just let the Smartform refer to the include text (as Mehwish suggested)? Or why not just pass a table to the Smartform (doesn't have to be a string)? Or even using the FM mentioned by Rajkumar would still be better than counting characters...

Former Member
0 Kudos

Hi Jelena,

As per you and Mehwish suggestion that of adding the Include text into the smart forms is quite fine but is that possible to fetch the data from INDX table.

Regards

Vishnu Ravi

0 Kudos

Please share your requirement in detail. Are you using FM "READ_TEXT" to read text in your NEC internal table? How is your NEC internal table being populated?

Regards

Former Member
0 Kudos

Hi Mehwish,

The exporting code :


DATA NEC TYPE TABLE OF char255.

FORM SAVE_NECDATA .

CLEAR NEC[].

   CALL METHOD EDIT_QRY->GET_TEXT_AS_R3TABLE

*            EXPORTING

*              only_when_modified     = FALSE

     IMPORTING

         TABLE                  =   NEC.

   IF SY-SUBRC <> 0.

*           MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*                      WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

   ENDIF.

   CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

     EXPORTING

       INPUT  = IT_VAT-SANCTION_NO

     IMPORTING

       OUTPUT = V_CAPN1.

   MOVE V_CAPN1 TO V_NCTP1.

   INDX-AEDAT = SY-DATUM.

   INDX-USERA = SY-UNAME.

   INDX-PGMID = SY-REPID.

   SELECT *

     FROM INDX

     WHERE RELID = 'CP'

     AND  SRTFD = V_NCTP1.

   ENDSELECT.

   IF SY-SUBRC <> 0.

     CLEAR WA_REF.

     WA_REF-RELID = 'SANCT_ENT'.

     WA_REF-KEYNO = IT_VAT-SANCTION_NO.

     WA_REF-PGMID = INDX-PGMID.

     WA_REF-REF1 = V_NCTP1.

     INSERT YEXREF FROM WA_REF .

     IF SY-SUBRC = 0.

       EXPORT NEC TO DATABASE INDX(CP) ID V_NCTP2.

     ENDIF.

   ENDIF.

   FREE : V_CAPN1, V_NCTP1.

ENDFORM.                    " SAVE_NECDATA


THE IMPORTING CODE:


SELECT SRTFD

                  INTO V_ITKTX1

                  FROM INDX AS A INNER JOIN YEXREF AS B

                  ON  B~REF1 = A~SRTFD

                  WHERE A~RELID = 'CP'

                    AND SRTFD = V_SAN.

                  ENDSELECT.

               IF SY-SUBRC = 0.

               IMPORT NEC  FROM DATABASE INDX(CP) ID V_SAN.

               ENDIF.

       IF  SY-SUBRC NE 0.

         MESSAGE 'Data not Found' TYPE 'E'.

       ENDIF.

Jelena
Active Contributor
0 Kudos

Plot thickens... I'm honestly having trouble understanding this setup. What is it that you're trying to achieve exactly and why do you have to use INDX table and IMPORT/EXPORT? Surely there must be a simpler solution for a simple text...

0 Kudos

You won't believe what kind of solutions for text output and persistence a highly qualified and capable programmers can come up with, given a cl_gui_textedit and a lowly smartform to work with, and enough freedom and time on their hands to get exactly where they think they will need to be after couple of years of changing requirements. Real ABAP programmers, having not found the requisite stuff in their /namespace/, start implementing their first "I want to have a note on that order form" requirement by coming up with cutting edge /namespace/cl_longtext and /namespace/cl_gui_control_editor. Learning along the way that maximum output length of string in SAP Smarform is 255 only doubles their determination to "do it right" 

cheers

Janis

0 Kudos

EDIT_QRY->get_textstream should return the text as string (it's cl_gui_textedit class, right?). String can be converted to "SapScript" or so called ITF Text using FM CONVERT_STREAM_TO_ITF_TEXT, which takes string table as input when LF = 'X'. The text in this format can then be relatively conveniently output in Smartform using Dynamic Text node:

where IT_TEXT is of type TLINE_T. I'm not sure if character formatting is preserved during conversion, but the Smartform would bind the values to variables (something like &sy-uname&) if those are found somewhere in the text.

Would something like this suit your requirement?

cheers

Janis

Former Member
0 Kudos

Thank you for all your replies

Problem Solved .

Regards

Vishnu Ravi