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: 

Remove space non character ### in smartforms

acetedi
Participant
0 Kudos
982

Dear All,

i need to remove space character from input free text in program displayed #### in table

so in smartforms display look like this

1. text exampel here

2. text exampel 2 here

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor
875

Line feeds must not be achieved using CRLF characters, they must be achieved by using SAPscript text format e.g.

TDFORMAT  TDLINE
*         1.RC still
          stopped.
*         2.Opportunity jobs

will show on separate lines in the Smart Form

1.RC still stopped.
2.Opportunity jobs

What is important is the meaning of TDFORMAT, i.e. "*" is new paragraph of type default.

Other values are explained in SAP Library - Structure TLINE of the Lines Table.

In parameters of Smart Form, define input parameter OPERATION_TEXT of type TSFTEXT (components TDFORMAT and TDLINE).

In the text field, choose "Dynamic text" and indicate &OPERATION_TEXT&

11 REPLIES 11

Sandra_Rossi
Active Contributor
0 Kudos
875

The origin of the issue starts where the input is stored, not in the Smart Form. Please clarify what's in table OR show debug of Smart Form parameter value, etc.

acetedi
Participant
0 Kudos
875

in the program input like this

thats is possible using cl_abap_char_utilities=>cr_lf replace # with space in smartforms.

Sandra_Rossi
Active Contributor
0 Kudos
875

What about debug value?

Sandra_Rossi
Active Contributor
0 Kudos
875

Sorry, not needed, I can answer already.

Sandra_Rossi
Active Contributor
876

Line feeds must not be achieved using CRLF characters, they must be achieved by using SAPscript text format e.g.

TDFORMAT  TDLINE
*         1.RC still
          stopped.
*         2.Opportunity jobs

will show on separate lines in the Smart Form

1.RC still stopped.
2.Opportunity jobs

What is important is the meaning of TDFORMAT, i.e. "*" is new paragraph of type default.

Other values are explained in SAP Library - Structure TLINE of the Lines Table.

In parameters of Smart Form, define input parameter OPERATION_TEXT of type TSFTEXT (components TDFORMAT and TDLINE).

In the text field, choose "Dynamic text" and indicate &OPERATION_TEXT&

0 Kudos
875

iam trying to add some code to get from table so i put in the initialization from global definition

wa_rmark1-tdline is value from table '1.RC still stopped.###########2.Oppurtunity jobs (ME) :###########'

so i also put operation_text of TYPE TSFTEXT in the global and create dynamic text

but the value still look like this

0 Kudos
875

1) Do you call this Smart Form from an ABAP program?

If yes, I strongly recommend to add the code in the ABAP program, right before calling the Smart Form, and then do as I said in the Smart Form, because it's very difficult to maintain ABAP code in Smart Form (high technical debt).

2) It seems that your text comes from a long text already (due to TDLINE in WA_RMARK1-TDLINE), you could then simplify. Could you explain more about the origin of the text?

3) It seems that you are STILL NOT translating line feeds into '*' (or you forget to remove them).

0 Kudos
875

Thank your for your advice, i will change my code into abap program.

the text is from other program so its already in wa_rmark1-tdline.

The tdline field is char132, so if inputing text and enter newline after saving the text in databased cannot read the enter space so the databased look like this #####

so in abap program i have the value store in work area (WA_RMARK1-TDLINE)

I dont know how to passing wa_rmark1-tdline to operation_text type of TSFTEXT and how to translating line feed '*' or remove them.

Thank you for your feedback.

0 Kudos
875

The other program which stores in WA_RMARK1-TDLINE is then functionally buggy and you or your colleagues should fix it: it's storing line feed characters in TDLINE = it stores non-long text format (line feeds) in long text container (TLINE structured type = TDFORMAT/TDLINE). Either store string with line feeds in STRING type, or convert string into long text format and store in TLINE format.

Note that I just see # in your screenshots which may represent any kind of "control characters", and you should analyze which control characters they are by debug + display the hexadecimal value of the string, because it may not be only line feed characters.

Concerning the transformation of string with line feeds into TLINE format (officially known as ITF), you may use CONVERT_STREAM_TO_ITF_TEXT (search the Web for examples and questions).

0 Kudos
875

its work using this FM "CONVERT_STREAM_TO_ITF_TEXT"

but iam confusing how to convert all table ztable-tdline

iam only testing using 1 work area

DATA: lt_stram_lines TYPE STANDARD TABLE OF string,
          ls_string      TYPE string,
          operation_text TYPE tsftext.  
  
LOOP AT lt_remarks INTO DATA(ls_remarks).

      IF ls_remarks-trows = '1'.
        MOVE-CORRESPONDING ls_remarks TO wa_rmark1.

        ls_string = wa_rmark1-tdline.
        APPEND ls_string TO lt_stram_lines.

        CALL FUNCTION 'CONVERT_STREAM_TO_ITF_TEXT'
          EXPORTING
            stream_lines = lt_stram_lines
            lf           = 'X'
          TABLES
            itf_text     = operation_text.
      ENDIF.
    ENDLOOP.

how do i convert ztable-tdline using that FM CONVERT_STREAM_TO_ITF_TEXT?

0 Kudos
875

I don't really understand why you get the text in a TDLINE component which should be reserved to ITF text, but what you did is the right way.