Insert a break line in a content of a variable

Hi all, my problem is:
I want to put a break line at position 40 of a string (where exist a space), for example.
DATA: v_string TYPE string.
v_string = 'testline1_testline1_testline1_testline1 testline2_testline2_testline2_testline2'.
Because i want a result like this
testline1_testline1_testline1_testline1
testline2_testline2_testline2_testline2.
I tried with cl_abap_char_utilities=>cr_lf but are printing  testline1_testline1_testline1_testline1##testline2_testline2_testline2_testline2.
I tried too with cl_abap_char_utilities=>new_line but don´t work.
Tks to all.

Hi sadavisa,
follow my program:
start----
DATA: gv_string TYPE string,
      gv_result TYPE string,
      gv_len TYPE i,
      gv_div TYPE f,
      gv_num_lin TYPE i,
      gv_len_upd type i,
      gv_position type i,
      gv_count type i,
      gv_40(1) type c,
      gv_39(1) type c,
      gv_38(1) type c,
      gv_37(1) type c,
      gv_36(1) type c,
      gv_35(1) type c.
gv_string = 'testline1_testline1_testline1_testline1 testline2_testline2_testline2_testline2'.
gv_len = STRLEN( gv_string ).
IF gv_len <= 40.
  WRITE gv_string.
ELSE.
  gv_div = gv_len / 40.
  gv_num_lin = CEIL( gv_div ).
  gv_count = 1.
  WHILE gv_num_lin => gv_count.
    IF gv_num_lin = sy-index. "this code is executed only in the last time
      CONCATENATE gv_result gv_string INTO gv_result.
      gv_count = gv_count + 1.
      CONTINUE.
    ENDIF.
    gv_40 = gv_string+40(1).
    gv_39 = gv_string+39(1).
    gv_38 = gv_string+38(1).
    gv_37 = gv_string+37(1).
    gv_36 = gv_string+36(1).
    gv_35 = gv_string+35(1).
    IF gv_40 = space.
      gv_position = 40.
      PERFORM update_variables USING gv_position.
      continue.
    ELSEIF gv_39 = space.
      gv_position = 39.
      PERFORM update_variables USING gv_position.
      continue.
    ELSEIF gv_38 = space.
      gv_position = 38.
      PERFORM update_variables USING gv_position.
      continue.
    ELSEIF gv_37 = space.
      gv_position = 37.
      PERFORM update_variables USING gv_position.
      continue.
    ELSEIF gv_36 = space.
      gv_position = 36.
      PERFORM update_variables USING gv_position.
      continue.
    ELSEIF gv_35 = space.
      gv_position = 35.
      PERFORM update_variables USING gv_position.
      continue.
    endif.
    gv_count = gv_count + 1.
  ENDWHILE.
ENDIF.
write gv_result.
*&      Form  UPDATE_VARIABLES
      Update variables
     -->P_POSITION  text
form UPDATE_VARIABLES  using p_position type i.
  CONCATENATE gv_result gv_string(p_position) cl_abap_char_utilities=>cr_lf INTO gv_result.
  gv_len_upd = gv_len - p_position.
  gv_string = gv_string+p_position(gv_len_upd).
  CONDENSE gv_string.
  gv_count = gv_count + 1.
endform.                    " UPDATE_VARIABLES
end----
So my question is why when i write CR_LF on file text go right and when i join into a variable and then write on screen go wrong.
Tks.

Similar Messages

  • How do I set the column content to automatic break lines

    Hello Guys,
    I have a problem with the column width and the column content of a standard report. Within the report are hugh entries which aren't interrupted by an space character. I set my column width to a special value by usingen "css style: display block; width: 300px;". Now the problem is that some of the column entries have a longer width than the column width is setted. So they overlock the entries of the column next to them.
    My question is: How do I set the column content to automatic break lines after a certain count of characters?
    After researching a couple of websites and discussion thread I found maybe a reference to the solution. I hope it help you to give me an answer.
    COLUMN LAST_NAME FORMAT A4
    regards
    wderr

    Wderr,
    PDFs are another animal entirely. Try adjusting the width of the column under the Print Attributes tab of the report.
    If that doesn't work you'll probably need to create custom XSL-FO layouts which, depending on the tools you have at your disposal, could take some time.
    Regards,
    Dan
    Blog: http://DanielMcGhan.us/
    Work: http://SkillBuilders.com/

  • Trouble with format of files exported from pages as .doc - when opened on a pc they have extra spaces and pages breaks inserted after each line?  Can be manually deleted, but defeats sharing purpose. advice?

    Hi all, I have trouble with the format of files exported by email as .doc from pages - when opened in MS word on a PC or other device, they have extra spaces and pages inserted after each line - can be deleted manually, but defeats sharing purpose.  Any advice?  Not the most sophisticated user.

    Got it. I tried booting with MOD_AUTOLOAD set to yes, and it was working fine. Looks like I needed to specify some more modules in my list.

  • Find/Change Inserting paragraph break

    Hello
    I am trying to insert a paragraph mark between two lines of text using find/change
    The first line has a heading style and I want to insert an empty line (Paragraph) after it and before the next line (without changing any formatting)
    I am able to use enter the correct parameters in find but can't figure out what parameter to use in 'Change to"
    Forced line break doesn't produce what I want. Neither does standard carriage return (not sure what that is)
    I have tried both Text and Grep dialogs without success. Yes I read the help files.
    This will be simple for you guys but is stumping me.
    Any ideas oh brilliant ones?
    As usual Thanks much in advance

    Err, a paragraph mark? You mean a paragraph break?
    Anyhow, if you insist on Doing it Wrong, you can use ^p ("End of Paragraph") in the change field. So you might
    change ^p to ^p^p to insert a blank paragraph between each paragraph. For instance. But again, it is the wrong answer.
    Yes-a paragraph break.' Sorry for the imperfect terminology
    The first line is a heading style which I was advised in this forum to make into a 'list style' due to TOC issues
    The 'doing it wrong' paragraph is going to be used to anchor a graphic and then converted to a very small paragraph mark (nearly invisible) as advised in another article
    I did use the
    change ^p to ^p^p
    but it creating another list style as the paragraph break. Its ok. I went ahead and did it anyway and then manually changed all of those entries into a regular paragraph 'break'
    With 300 graphics I would like to automate this but.....
    Thanks for your reply

  • Send e-mail with a file as attachment - Break line problems

    Hi
    I use the function SO_NEW_DOCUMENT_ATT_SEND_API1 to send an e-mail from ABAP program.
    With SAP4.5B, all work good, but since we have 4.6C, the attached file is malformatted.
    An automatic CRLF break line is generated all 1022 char!
    The eattachment is create from content of internal table with a line of 255 char.
    How can I avoid the automatic CRLF char or how can I to send a good file ?
    Thank

    Hi,
    look here:
    Re: How to email an attachment with more than 255 characters?
    Andreas

  • How to add new price break lines to existing PO quotations?

    Hi,
    I am using a custom interface (to insert quotations data into PO headers/lines interface tables) and PO documents open interface to create PO Quotations in Oracle.
    I need to modify this interface to:
    1. Update existing price break lines for a quotation line.
    2. Add new price break lines to existing quotation line(which may/may not have exsiting price break lines).
    Please let me know:
    1. What modifications need to be done to the existing code.
    2. What values needs to be passed to the action columns in PO_HEADERS_INTERFACE and PO_LINES_INTERFACE for above scenarios?
    Any ideas/help will be appreciated.
    Thanks
    Imran

    Hi Imran,
    I have done a similar exercise for BPA price breakup.. Let me know if you need that as reference. I can share that :).. Please provide your personal mail id..
    Regards,
    S.P DASH

  • How to break lines in JLabel?

    I can use html code to break lines for swing compoent, for example:
    JLabel label = new JLabel("<html>ABC<br>DEF</html>");The thing is that I need to read the content of JLabel from a text file. It doesn't work if I defined the text file as "<html>ABC<br>DEF</html>". How can I let the JLabel support html code which is read from text or property files?

    The origin of the string is irrelevant.
    It make no difference if you get the html from a file ot directly in your code as literal. HTML support in JLabel always works

  • Insert a blank line between records

    Hi,
    I am creating a sqlplus report and want to insert a blank line or some seperator to seperate the records between the start and end points of the loop to make it more readable.
    ex : The output currently look like this.
    ColumnA       ColumnB
    1                  2
    2                  3
    3                  1
    4                  5
    5                  6
    6                  4I want the output to look like this
    ColumnA       ColumnB
    1                  2
    2                  3
    3                  1
    4                  5
    5                  6
    6                  4Thanks for the help in advance!

    Hi,
    You probably work with this table every day, and you probably struggled with this particular query for a while before posting a question, so you're very familiar with the table, the data, and the application.
    Perhaps no one else in the world is in that position. Don't assume we know what your data is, or where it came from.
    Are you getting the data from a query like this?
    SELECT     columna
    ,     columnb
    FROM     table_x
    START WITH          columna     IN (1, 4)
    CONNECT BY NOCYCLE     columna     = PRIOR (columnb)
    ;If so, that's the kind of thing you should say clearly in your first message, rather than hint at in your third.
    As Ow said, you should manufacture a column for use in the BREAK command, and use COLUMN ... NOPRINT if you don't want to see it in the results?
    The question here is, what is an appropriate column? CONNECT_BY_ROOT seems to work perfectly for your example
    BREAK     ON my_break_column     SKIP 1
    COLUMN     my_break_column     NOPRINT
    SELECT     columna
    ,     columnb
    ,     CONNECT_BY_ROOT     columna     AS my_break_column
    FROM     table_x
    START WITH          columna     IN (1, 4)
    CONNECT BY NOCYCLE     columna     = PRIOR (columnb)
    ;The rest of this message is an merely a tangent. I find it interesting, but feel free to skip it.
    You might think CONNECT_BY_ISCYCLE was an obvious choice for a BREAK oclumn: you want to skip a line after every output row where CONNECT_BY_ISCYCLE = 1.
    Unfortunately, BREAK always works when a column value changes. That is, you can't tell it "Please skip one line after rows where columnz = 1"; all you can say is "Please skip a row before rows where columnz is different than it was on the previous row". (At least that's what I think: I would love it if someone proved me wrong!)
    So we have to manufacture some column that keeps its value for an entire loop. The SUM of CONNECT_BY_ISCYCLE (in DESCending order, as returned by the CONNECT BY query) would work. Analytic ORDER BY clauses seem to destroy the order imposed by CONNECT BY, so you'd have to do the CONNECT BY in a sub-query, capture the ROWNUM to preserve the order, and use the analytic SUM function in the main query:
    WITH     oq     AS
         SELECT     columna
         ,     columnb
         ,     ROWNUM               AS r_num
         ,     CONNECT_BY_ISCYCLE     AS cycle_val
         FROM     table_x
         START WITH          columna     IN (1, 4)
         CONNECT BY NOCYCLE     columna     = PRIOR (columnb)
    SELECT     columna
    ,     columnb
    ,     root
    ,     SUM (cycle_val) OVER (ORDER BY ROWNUM DESC)
    --               AS my_break_column
    FROM     oq
    ORDER BY     r_num
    ;The only reason for actually doing this is to learn about CONNECT BY queries. CONNECT_BY_ROOT, as shown above, works much better for your requirements.

  • How to insert Page Break in SPOOL file

    How to insert Page Break in SPOOL file.

    How to insert Page Break in SPOOL file.
    SET NEWP[AGE] {1|n|NONE}
    SET NEWPAGE is not supported in iSQL*Plus
    Sets the number of blank lines to be printed from the top of each page to the top
    title. A value of zero places a formfeed at the beginning of each page (including
    the first page) and clears the screen on most terminals. If you set NEWPAGE to
    NONE, SQL*Plus does not print a blank line or formfeed between the report pages.
    http://www.lc.leidenuniv.nl/awcourse/oracle/server.920/a90842/ch13.htm
    SQL> SET PAGESIZE 5
    SQL> SET NEWPAGE 0 --a form feed between your pages
    SQL> SPOOL C:\output.doc
    SQL> SELECT * FROM emp;
         EMPNO ENAME      JOB             MGR HIREDATE         SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-80        800          0         20
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
         EMPNO ENAME      JOB             MGR HIREDATE         SAL       COMM     DEPTNO
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850          0         30
          7782 CLARK      MANAGER         7839 09-JUN-81       2450          0         10
         EMPNO ENAME      JOB             MGR HIREDATE         SAL       COMM     DEPTNO
          7788 SCOTT      ANALYST         7566 09-DEC-82       3000          0         20
          7839 KING       PRESIDENT            17-NOV-81       5000          0         10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
         EMPNO ENAME      JOB             MGR HIREDATE         SAL       COMM     DEPTNO
          7876 ADAMS      CLERK           7788 12-JAN-83       1100          0         20
          7900 JAMES      CLERK           7698 03-DEC-81        950          0         30
          7902 FORD       ANALYST         7566 03-DEC-81       3000          0         20
         EMPNO ENAME      JOB             MGR HIREDATE         SAL       COMM     DEPTNO
          7934 MILLER     CLERK           7782 23-JAN-82       1300          0         10
    13 rows selected.
    SQL> SPOOL OFFKhurram

  • Break line in sending mail program

    Hi All,
    I am creating sending mail program, its working fine but  for that i have problem in break line.
    my code is below:
    doc_chng-obj_descr = 'SAP test mail'.
    Mail Contents
         loop at itab..
        CONCATENATE 'sap test mail UPDATED:' ''
      INTO it_objtxt SEPARATED BY space.
      APPEND it_objtxt.
      CONCATENATE 'test1:' SPACE itab-KOKRS
      INTO it_objtxt SEPARATED BY space.
      APPEND it_objtxt.
      CONCATENATE 'test2:' SPACE itab-KSTAR
      INTO it_objtxt SEPARATED BY space.
      APPEND it_objtxt.
      if int = 16.
        CONCATENATE 'test3:' space  itab-objnr
        INTO it_objtxt SEPARATED BY space.
        APPEND it_objtxt.
      endif.
    endloop.
    output is:
    sap test mail
    test1:5000
    test2:0000600100
    test3:371040
    sap test mail
    test1:5000
    test2:0000600100
    test3:362040
    but i want blank line after 1 entry like below
    sap test mail
    test1:5000
    test2:0000600100
    test3:371040
    sap test mail
    test1:5000
    test2:0000600100
    test3:362040
    so please guide me.... i used skip and new-line statement but its not working...
    Thanks in advance
    zeni

    Add a blank line at the end of the loop.
    loop at itab..
    CONCATENATE 'sap test mail UPDATED:' ''
    INTO it_objtxt SEPARATED BY space.
    APPEND it_objtxt.
    CONCATENATE 'test1:' SPACE itab-KOKRS
    INTO it_objtxt SEPARATED BY space.
    APPEND it_objtxt.
    CONCATENATE 'test2:' SPACE itab-KSTAR
    INTO it_objtxt SEPARATED BY space.
    APPEND it_objtxt.
    if int = 16.
    CONCATENATE 'test3:' space itab-objnr
    INTO it_objtxt SEPARATED BY space.
    APPEND it_objtxt.
    endif.
    * Add a blank line
    clear lt_objtxt.
    append it_objtxt.
    endloop.
    Regards,
    Rich Heilman

  • Setting break lines

    Hi all
    I want to know how to insert a blank line between the first line of column labels and lines of column values in a group-left report . And is it also possible to break line between each result set records ?
    Thank you.

    For the blank lines between each record, you will want to modify the Vertical Spaces between Records property on the repeating frame. This will determine how much space is printed between each record. I think it goes by whatever you have in your measurement settings. I just plug in numbers and see how i like it.
    You may also want to try modifying the Horizontal Space property for the repeating frame with the column headings. This may create the space you are looking for.
    This stuff is hard to picture without seeing it, so I'm taking a stab here! And if all else fails, run the report, and when in the live-previewer, set flex mode on, and start stretching your columns/rows to the way you want it!
    Good luck!

  • How can you insert "Page Break" in a pdf file so you will specify the pages

    How can you insert "Page Break" in a pdf file so you will specify the pages

    How / from what was the PDF originally created?  It would be easiest to insert page breaks into the original document, then recreate the PDF.

  • How to insert a new line item in VA01/VA02 by using ABAP code?

    Hi Gurus
    i have a very tough requirement. the customer wants to insert a free goods after an item has been populated in VA01/VA02 automatically according to some certain rules. the input material may be a main material of a sales BOM.
    for example. let's suppose there is a material A who has two sub-material B and C which is maintained in a sales BOM via CS01/CS02. when the material A has been input in the line item in VA01/VA02, its quantity input and after the ENTER key has been clicked, another material D may be displayed in a new line as a gift if the condition met.  the condition relates to customer/material/quanity and these information are stored in a Z-table.
    on the other hand, if the material A is only a single material(not a BOM), the gift(material D) will also be filled automatically if the condition met.
    i have already enhance the FM cs_bom_explosion to filfill the requirment for BOM materials. whereas it is very hard to find the enhanment point for the single material.
    so my question is where is the correct place for me to insert the ABAP code, which decides whether the gift should be given or not and furthermore inserts the new line item into XVBAP. i tried to use MV45AFZZ, whereas the data is always inconsistant if a new line has been inserted. it is very strange that there is no temperary internal table storing line item data input in the table controal of VA01/VA02. system reads the line item data , line by line, via a system kernal function call.
    any hints are welcome. thanks

    HI Stephen,
    I have the same prolem. I modified the 5 global tables, but I don't see the new line in the screen.
    Can you help me with some details?
    Thx!
    Mihaela

  • Inserting/ deleting a line item in MIGO Transaction ( Goods Issue )?

    Hi,
    Can anyone help me with the logic for Inserting / deleting a line item in MIGO Transaction?
    Thanks,
    cs

    Hi
    The following user exits and badis for migo:
    Check the mb_migo_badi and check the method 'LINE_MODIFY' for u r purpose.
    For undestanding see the documentation of the badi and see the example implementation
    class: CL_EXM_IM_MB_MIGO_BADI
                                                                                    Enhancement/ Business Add-in            Description                                                                               
    Enhancement                                                                               
    MB_CF001                                Customer Function Exit in the Case of Updating a Art. Doc.      
    MBCF0011                                Read from RESB and RKPF for print list in  MB26                 
    MBCF0010                                Customer exit: Create reservation BAPI_RESERVATION_CREATE1      
    MBCF0009                                Filling the storage location field                              
    MBCF0007                                Customer function exit: Updating a reservation                  
    MBCF0006                                Customer function for WBS element                               
    MBCF0005                                Article document item for goods receipt/issue slip              
    MBCF0002                                Customer function exit: Segment text in article doc. item                                                                               
    Business Add-in                                                                               
    MB_RESERVATION_BADI                     MB21/MB22: Check and Complete Dialog Data                       
    MB_QUAN_CHECK_BADI                      BAdI: Item Data at Time of Quantity Check                       
    MB_PHYSINV_INTERNAL                     Connection: Core Inventory and Retail AddOn                     
    MB_MIGO_ITEM_BADI                       BAdI in MIGO for Changing Item Data                             
    MB_MIGO_BADI                            BAdI in MIGO for External Detail Subscreens                     
    MB_DOC_BADI_INTERNAL                    BAdIs when Creating an Article Document (SAP Internal)          
    MB_DOCUMENT_UPDATE                      BADI when updating article document: MSEG and MKPF              
    MB_DOCUMENT_BADI                        BAdIs when Creating an Article Document                         
    MB_CIN_MM07MFB7_QTY                     Proposal of quantity from Excise invoice in GR                  
    MB_CIN_MM07MFB7                         BAdI for India Version exit in include MM07MFB7                 
    MB_CIN_LMBMBU04                         posting of gr                                                   
    MB_CHECK_LINE_BADI                      BAdI: Check Line Before Copying to the Blocking Tables          
    ARC_MM_MATBEL_WRITE                     Check Add-On-Specific Data for MM_MATBEL                        
    ARC_MM_MATBEL_CHECK                     Check Add-On-Specific Criteria for MM_MATBEL    
    If it is helpfu rewards points
    Regards
    Pratap.M

  • How to insert a new line in MC1H(maintaining formula)

    How to insert a new line in MC1H(maintaining formula)
    Can anybody help me with  the steps

    Hi,
    1.run transaction SCC4 -> press Ctrl+F4 or the button for change ->double click one the row for your client -> on the field Cross Client Object Changes select Changes to the Repository and cross-client Customizing allowed -> SAVE
    2. run MC1H and now you will have access to insert new line in the table
    Regards Vassko!
    Edited by: Vasil Pavlov on Sep 16, 2008 9:51 AM

Maybe you are looking for

  • Sheduling Agreement item are not appearing in MIGo

    Hi, Good receipt (MIGO) for Sheduling  Agreement some items are not display(not appear in item detail screen in MIGO) Delivery shedule is maintain and SA is released where to check to slove this problem. shakir

  • How to schedule emails??

    I would like to know how I can set up an email to be automaticly sent on a later date, using my apple mail program.

  • Sent Mail Marked As Unread

    In Lion Mail, sent mail is being marked as unread. Why is that? Can I change that behaviour or is this a bug maybe?

  • Scope of list ALV for MM report

    Hi, somebody knows like creating a scope of list format that is ALV?exists some check to determine that the list format is ALV? I need to visualize report ME2L in ALV format. Thanks, R

  • Can I use Red Cam footage in FCE4

    An actor friend of mine has shot a short film with a Red Cam and wants me to edit it.  I assume I'll have to convert it, but can I bring that footage into FCE4, and if so what codec should I use?  And how do I convert it, what program should be used.