Long text problem in sap script

Hi Experts,
I have craeted sap script for payment print progrem.. in my sap script one window is text window... client want more then 300 char for that window. for that i use read_text function module... its working fine... but problem is it retrive only one line from long text editor. only 70 char i got.
below is my coding......
CALL FUNCTION 'READ_TEXT'
  EXPORTING
    ID                            = '0001'
    LANGUAGE                      = sy-langu
    NAME                          = NAME
    OBJECT                        = 'DOC_ITEM'
  TABLES
    LINES                         = LINES          .
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT LINES.
  n = 0.
  l = 132.
  text+n(l) = lines-tdline.
  n = n + 132.
  l = l + 132.
ENDLOOP.
in sap script i have direct pass lines-tdline
*&lines-tdline&
Please suggest me which point i missing?
Thanks
Jigar

Hi All,
The standard text will be stored in Name = ORDCONF_TEXT_(sales org)_(distributionchannel)_(division)
Text ID = ZSD
Examples: ORDCONF_TEXT_4000_01_01 , ORDCONF_TEXT_4000_01_80 , ORDCONF_TEXT_1000_01_01.
Requirement :
The print program /form will need to pick up the appropriate standard text based on the Sales Area (combination of Sales Org / Distribution Center / Division) of the sales order [VBAK-VKORG / VTWEG / SPART], provided a standard text has been created for that Sales Area. Itu2019s not required that every sales area have a standard text, so if one is not found, this step should be skipped and the rest of the print program executed.
The new text should print after 2 blank lines after the Printable Notes text (which is after the line items and the Total Net Price prints).
The font should be the same size as the Printable Notes, but bolded rather than italicized.
The text should print in the same columns as the Printable Notes currently print in (Material Description / Scheduled Ship Date / Quantity) .
So the logic i have used is this below code:
I used a subroutine in the layout of the main window becoz i need to print it in the main window below after 2 blank lines of line items.
This is logic in the layout:
/:PERFORM GET_OBJECT IN PROGRAM ZSDRP001_ORD_CONF_IRE
/:USING &VBDKA-VBELN&
/:CHANGING &ORDCONF_TEXT&
/:ENDFORM
/:INCLUDE &ORDCONF_TEXT& OBJECT TEXT ID ZSD PARAGRAPH A1
I called this subroutine in the print program:
Logic in the print program:
FORM GET_OBJECT TABLES INPUT_TAB STRUCTURE ITCSY
                                             OUTPUT_TAB STRUCTURE ITCSY.
DATA : TMP_VBELN LIKE vbdka-VBELN,
            TMP_VKORG LIKE VBAK-VKORG,
            TMP_VTWEG LIKE VBAK-VTWEG,
           TMP_SPART LIKE VBAK-SPART,
           TMP_TXNAM1(40) TYPE C VALUE 'ORDCONF_TEXT',
           TMP_TXNAM2(100) TYPE C.
DATA: v_text LIKE tline-tdline.
DATA : P_V_TEXT LIKE tline-tdline.
CLEAR : TMP_TXNAM1, TMP_TXNAM2, TMP_VBELN, TMP_VKORG, TMP_VTWEG, TMP_SPART.
READ TABLE INPUT_TAB WITH KEY NAME = 'vbdka-VBELN'.
IF SY-SUBRC = 0.
tmp_vbeln = input_tab-value.
ENDIF.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING INPUT = TMP_VBELN
I
MPORTING OUTPUT = TMP_VBELN .
CLEAR VBAK.
SELECT SINGLE VKORG VTWEG SPART INTO (TMP_VKORG, TMP_VTWEG, TMP_SPART)
                                        FROM VBAK WHERE VBELN EQ TMP_VBELN.
IF NOT TMP_VKORG IS INITIAL
AND NOT TMP_VTWEG IS INITIAL
AND NOT TMP_SPART IS INITIAL.
CONCATENATE TMP_TXNAM1 TMP_VKORG tmp_vtweg tmp_spart into TMP_TXNAM2 SEPARATED BY '_'.
endif.
CONDENSE TMP_TXNAM2 NO-GAPS.
PERFORM read_order_text USING TMP_TXNAM2 CHANGING v_text.
READ TABLE output_tab WITH KEY NAME = 'ORDCONF_TEXT'.
IF SY-SUBRC = 0.
output_tab-value = P_V_TEXT.
MODIFY output_tab index sy-tabix.
endif.
endform.
FORM READ_ORDER_TEXT USING P_TMP_TXNAM2 CHANGING P_V_TEXT LIKE tline-tdline.
DATA: ztdid LIKE thead-tdid,
          zlang LIKE thead-tdspras,
          zobj LIKE thead-tdobject,
          zname LIKE thead-tdname.
DATA: tlines TYPE STANDARD TABLE OF tline WITH HEADER LINE
          thead LIKE thead.
CLEAR P_V_TEXT.
ztdid = 'ZSD'.
zlang = 'E'.
zobj = 'TEXT'.
zname = P_TMP_TXNAM2.
CLEAR tlines.
REFRESH tlines.
CALL FUNCTION 'READ_TEXT'
EXPORTING
object = zobj
name = zname
id = ztdid
language = zlang
IMPORTING
header = thead
TABLES
lines = tlines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
LOOP AT tlines WHERE NOT tdline IS INITIAL.
MOVE tlines-tdline TO P_V_TEXT.
ENDLOOP.
ENDFORM.
But still its not getting printed .Plz tell me where i am going wrong.
Thanks,
Suman

Similar Messages

  • Long Text printing in SAP SCRIPT

    Hi Experts,
    I have a requirement of printing long text in sapscript.
    There are 15 condition types for each item in sales order and one long text for each condition record.
    Each long text has multiple lines i.e. for one long text it may have 2 lines and other may have 1 or 3 lines or etc.
    My trials :
    I used read_text() function mudule in a routine which is being called from the sap script to get the whole long text which has 5 lines and is stored in an internal table.
    Now is there a way to transfer the whole internal_table data as a whole into the script i.e. is there a way to transfer the table from the routine to the sapscript.
    Thanks in advance.
    kalikonda.

    Hi
    In addition of my include solution.
    you ofcourse can use a perform statement if you havea maximum of lines which is possible.
    like (if you have a maximum of 5 lines
    define &line_1& := ' '
    define &line_2& := ' '
    define &line_3& := ' '
    define &line_4& := ' '
    define &line_5& := ' '
    Perform getsomedate in program abcxyz
    using orderno
    using itemno
    changing &line_1&
    changing &line_2&
    changing &line_3&
    changing &line_4&
    changing &line_5&
    Endperform
    when printing the data
    /: if &line_1& NE ' '
    IL &line_1&
    /: endif
    /: if &line_2& NE ' '
    IL &line_2&
    /: endif
    /: if &line_3& NE ' '
    IL &line_3&
    /: endif
    /: if &line_4& NE ' '
    IL &line_4&
    /: endif
    /: if &line_5& NE ' '
    IL &line_5&
    /: endif
    Gr., Frank

  • How to end text element in sap script

    how to end an text element in sap script
    this is the format.
    /E text element name
    &tablename-fieldname&
    text-text-text-text
    now if i do not end that text element it is not displayiny my below text , so what to do in this case

    Go through the links mentioned below.
    http://www.****************/Tutorials/Smartforms/SFMain.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3c5d9ae3-0501-0010-0090-bdfb2d458985
    http://www.sapmaterial.com/smartform_example.html
    Re: Hands on SAP Smart Forms
    smartforms
    Reward points if useful.

  • Text element in sap script

    Hi All
    Y do we need Text element in SAP SCRIPT ?

    yes you can.
    are you using your own print program or a standard?
    Each window will be called by the code so if you have no elements in there all the data is output in the order they appear in the form.

  • Text length in Sap Script

    Hi all, how can I force auto adjust of Text leght in Sap Script ?
    I have a text to print, and when it is taller than page area it is printed in another page Ok. But I don't want that it is printed in another page, I want that it is adjusted automatically to print in one page only, without I have adjust text font manually.

    Hi!
    Welcome on SDN.
    Here's the official document of SAPScript.
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/d1/803411454211d189710000e8322d00/content.htm
    Regards
    Tamá

  • Quantity field conversion problem in SAP script

    Hi experts,
    I have problem with sap script quantity field conversion.
    In purchase order the actual value of field( MDPM-ERFMG) is 3,500.
    But in Print preview it is showing only 3.5
    Any one Please help me in this problem
    thanks in advance
    murali

    Hello,
    check this:
    Number of Decimal Places
    A program symbol of one of the data types DEC, QUAN, and FLTP can contain decimal place data. Use the option below to override the Dictionary definition for the number of decimal places for the formatting of this symbol value.
    Syntax
    &symbol(.N)&
    The EKPO-MENGE field contains the value 1234.56. The Dictionary definition specifies 3 decimal places and an output length of 17.
    &EKPO-MENGE& -> 1,234.560
    &EKPO-MENGE(.1) -> 1,234.6
    &EKPO-MENGE&(.4) -> 1,234.5600
    &EKPO-MENGE&(.0) -> 1,235
    REgards,
    Vasanth

  • Functionality in long text  -- include -- characters-- SAP Icons

    Can any one please tell me the functionality in long text  -->include >characters>SAP Icons. Is it possible to include any icon in longtext.
    regards
    Ravikumar

    Hi,
    The standard icons should be available. If not, see note [1067936|https://service.sap.com/sap/support/notes/1067936] that explains how they can be made available.
    -Paul

  • Printing problem for SAP Script

    Dear Friends,
    I am facing strange problem for SAP Script. In the billing document output the sold to party and ship to party address are displaying. When user print the billing document on laser printer it print the Country for Sold to and Ship to. But when it print the same billing document on normal printer (other than laser) the Sold to country not printing.
    The print preview of billing document in SAP  correctly display country for Sold-to and Ship-to.
    I have recently make changes in the SAP Script form (Address window) to display country for Ship-to which was never displayed before. I have added FROMCOUNTRY option after COUNTRY in address window. COUNTRY will be Ship-to and FROMCOUNTRY will be VBDKR-SLAND.
    Can any one help me to solve this problem.
    Regards
    Nilesh Shete

    Used custom address print option instead of using ADDRESS

  • Problem with SAP Script FAX output

    Hi Friends,
    I have problem with SAP Script Fax output.
    After I issued output using the messge type, the print preview format shows me correct alignments and the right data. But when I go to List display using the menu bar functions from the print preview screen, the list is showing me the right data, but all the alignments at the main window went wrong.
    How do I rectify this problem? I need correct alignments in both form display and list display.

    Hi Sasidhar,
    Have you tried with different fax machine.
    Regards,
    Atish

  • Dump error when clicked on text elements in SAP Script window

    Hi All,
    There is an inclusion in SAP Script. I have written the code in driver program. I need to pass the value to SAP Script in the requested position. But when I go to SE71 > Form Name > Change or Display > MAIN Window > Text Elements > I get a dump error.
    Category               ABAP Programming Error
    Runtime Errors         DATA_LENGTH_TOO_LARGE
    Except.                CX_SY_RANGE_OUT_OF_BOUNDS
    ABAP Program           SAPLSTXK
    Application Component  BC-SRV-SCR
    Date and Time          30.04.2014 20:00:08
    Short text
         Invalid partial field access: Length is too large
    What happened?
         Error in the ABAP Application Program
         The current ABAP program "SAPLSTXK" had to be terminated because it has
         come across a statement that unfortunately cannot be executed.
    What can you do?
         Note down which actions and inputs caused the error.
         To process the problem further, contact you SAP system
         administrator.
         Using Transaction ST22 for ABAP Dump Analysis, you can look
         at and manage termination messages, and you can also
         keep them for a long time.
    Error analysis
         An exception occurred that is explained in detail below.
         The exception, which is assigned to class 'CX_SY_RANGE_OUT_OF_BOUNDS', was not
          caught in
         procedure "TOKEN_COMMENT" "(FORM)", nor was it propagated by a RAISING clause.
         Since the caller of the procedure could not have anticipated that the
         exception would occur, the current program is terminated.
        The reason for the exception is:
        In the executed program "SAPLSTXK", the system attempted to access the field
        "ITF_TOKEN" of the type "C" and with the length 255 using the length 272.
        However, a partial field access with a length specification that is
        larger than the field length is not allowed.
    How to correct the error
        Reduce the length used to access the field.
        If the error occures in a non-modified SAP program, you may be able to
        find an interim solution in an SAP Note.
        If you have access to SAP Notes, carry out a search with the following
        keywords:
        "DATA_LENGTH_TOO_LARGE" "CX_SY_RANGE_OUT_OF_BOUNDS"
        "SAPLSTXK" or "LSTXKFRN"
        "TOKEN_COMMENT"
        If you cannot solve the problem yourself and want to send an error
        notification to SAP, include the following information:
        1. The description of the current problem (short dump)
           To save the description, choose "System->List->Save->Local File
        (Unconverted)".
        2. Corresponding system log
           Display the system log by calling transaction SM21.
           Restrict the time interval to 10 minutes before and five minutes
        after the short dump. Then choose "System->List->Save->Local File
    2937 * todo empty comment ???
    2938       if g_tm_open    eq true or     " Section
    2939          g_tm_b_close eq true.
    2940         l_token = '\chcbpat0'.
    2941         l_len = strlen( l_token ).
    2942         token_control = true.
    2943         assign l_token to <itf1>.
    2944         perform put_itf1_new using l_len.
    2945         perform token_line_begin changing l_next_token.
    2946       else.                          " without section
    2947         concatenate '\chcbpat0\line' g_cf_string l_cbpat_token into l_token.
    2948         l_len = strlen( l_token ).
    2949         token_control = true.
    2950         assign l_token to <itf1>.
    2951         perform put_itf1_new using l_len.
    2952       endif.
    2953     elseif l_next_token-code eq ')L'.         " \par
    2954       l_token = '\par'.
    2955       l_len = strlen( l_token ).
    2956       token_control = true.
    2957       assign l_token to <itf1>.
    2958       perform put_itf1_new using l_len.
    2959     elseif l_next_token-code eq '(C' or       " \par + format
    2960            l_next_token-code eq ')C' or
    2961            l_next_token-code eq '(&' or
    2962            l_next_token-code eq 'TA' or
    2963            l_next_token-code eq 'SC' or
    2964            l_next_token-code eq 'ST'.
    2965       concatenate '\chcbpat0\par' g_pf_string g_cf_string l_cbpat_token into l_token.
    2966       l_len = strlen( l_token ).
    >>>>>       itf_token(l_len) = l_token.
    2968       token_control = true.
    2969       assign l_token to <itf1>.
    2970       perform put_itf1_new using l_len.
    2971     endif.
    2972
    2973 * Step 7: (L to disarm
    2974   if g_compose eq true and
    2975      l_next_token-code eq '(L'.
    2976     perform read_next_itf_token(rstxscan) using p_token.
    2977   endif.
    2978
    2979 ENDFORM.                    " token_comment
    2980 *&---------------------------------------------------------------------*
    2981 *&      Form  create_lang_info
    2982 *&---------------------------------------------------------------------*
    2983 *       add default language to rtf
    2984 *----------------------------------------------------------------------*
    2985 *      -->P_HEADER  text
    2986 *      <--P_RESULT  text
    How do I open the text elements? I need to pass the variable inside SAP Script.
    Please Help. The requirement is pending from very long. Not able to rectify this issue.
    Regards,
    Rekha

    Hi,
    There is a SAP Note about this problem
    566794 - Runtime error: STRING_OFFSET_TOO_LARGE during conversion
    Correction Instructions
    Correction Instructions
    Software Component
    Valid from
    Valid to
    Number
    SAP_BASIS
    46B
    46D
    473267
    SAP_BASIS
    610
    620
    473185
    Support Packages & Patches
    Support Packages
    Software Component
    Release
    Support Package
    SAP_BASIS
    46B
    SAPKB46B48
    46C
    SAPKB46C39
    46D
    SAPKB46D28
    610
    SAPKB61027
    620
    SAPKB62014
    Regards
    Miguel

  • PROTECT-ENDPROTECT problem in SAP Script

    In SAP Script MAIN Window I have 10 different elements to print differet stuff related with each delivery line item.
    Like Material Number
    Material Description
    Long text [Has formatted text and I am reading that text and printed in some format some lines under material number and some under materail desc.]
    and other information required by client.
    Loop at Delivery item table.
    CALL FUNCTION 'CONTROL_FORM'
           EXPORTING
                command = 'PROTECT'.
    Print differnt elements.
    Loop at lond text internal table.
    print in proper format as I mentioned.
    endloop.
      CALL FUNCTION 'CONTROL_FORM'
           EXPORTING
                command = 'ENDPROTECT'.
    ENDLOOP.
    My problem is PROTECT ENDPROTECT is not working properly.
    It is printing only 1 item with other info on first page as there are enough space left to print minimum three items with details.
    on next page it is priting only 3-4 items as there are enough sapce to ptint at lease 10 items with details.
    The only good thing is it is not spliting the Item details and other text.[Main window on next page has bigger size]
    Any idea why PROTECT - ENDPOTECT not behaving properly.
    Thanks
    Aman
    Message was edited by: Amandeep  Singh

    Hello,
    Try to do like, Put PROTECT and ENDPROTECT in the SAPScript itself.
    Like
    Element 1
    Protect
    ..matnr....
    element 2
    ...desc....
    element 3 (long text)
    ...text
    ....text
    element 4
    endprotect
    call the element 4 in the loop statment, whenever required.
    Hope it will work.
    Regards,
    Naimesh.

  • Alignment problem in SAp Script

    Hi All,
    I am quite new to ABAP. I was working in .net for two years. I am developing an
    SAP script which includes table layout. No my problem is that certain texts in certain columns is so longer that the alignment get distorted. Is there any way in sap script by which we can bring down the text to next line if the text length exceeds certain limit. In web development it is possible to display like that and i hope it is possible in sap script also. Could any one please help me?

    Hi,
    First you need to consider the of the maximum possible length of each program symbol you are giving in the table layout. Depending upon that you need to create Tab spaces in "Paragraph formats" option.
    Each tabspace will allocate certain length of space to each program symbol.
    Plz reward if helpful.
    Thanks,
    Nagendra

  • Long text problem while uploading Inspection plan through BDC.

    Hi,
    I am facing some problem while uploading the inspection plan. There are few MICs for which we are having long text, while uploading the inspection plan through BDC - some other long text is getting copied into the MIC's long text. After checking I came to know that in function module, read_text - some text which is stored in ABAP memory is getting copied into the inspection plan.
    I am working in SAP release 4.7. I have checked with SAP notes: 97419, but it is also not satisfying.
    Waiting for quick solution.
    Thanks in advance.
    Fahié

    Hi a®s,
    Thanks a lot for your kind reply.
    My requirement is I want to maintain long text for few MICs (which are not having long texts at MIC level) in inspection plan (QP01).
    When I am trying to manually assign the MIC's to inspection plan (QP01), long text is copied whereas I am not clicking the long text icon in (QP01). Long text is not maintained in MIC level, still some long text is copied to this MIC. This was also happening while uploading the inspection plan thro' BDC.
    I believe what you have mentioned about function module SAVE_TEXT cannot be used here since long text is already copied before we pass the long text. Also if we pass some long text, still apart from the long text what we have passed there is some other long text copied (extra long text).
    Waiting for quick solution.
    Thanks in advance.
    Fahié

  • Problem with sap script table in main window

    hi all,
    i have created a sap script  for which output is in 7 pages.
    except first page all the remaining pages are giving the correct output.
    the problem with the first page is iam not not getting vertical lines in the table which is in the main window of page 1.
    iam getting the vertical lines correctly in the mainwindow table of all the remaining pages.

    Hi,
    It's simple,
    Pre- U should had declared a second page for the same window with header, main & footer.
    now
    First when u r looping the internal table provide no of rows eg Row 1 TO 10. in the Loop ( Data Tab)
    or
    when defing TEXT Go to PC Editor and mention all the fields Under  PROTECT -  ENDPROTECT.
    This would solve the issue.
    Thanks
    Ravi

  • HI, Alignment Problem in SAP Script

    Hi Friends
    I am working on SAP Script, I have the problem alignment, in the first row I need to show 8 values,
    among them all the times length is not same, so my script is not displaying in proper alignment,
    I have tried with all the ways which I known, specifying the length, and using (*), but still it is not
    coming properly, is there any method to specify the position exactly like as in reposrting.
    Please help me in this, this is very urgent.
    Thanks and Regards
    Praveeb

    Hi Nagesh
    Thanks for your reply,
    I am displaying in the first row,  here I am mentioning the filed and lenght of the field
    1) Date(10)
    2) Reference No(16), .
    3) Fiscal Year(4),
    4) Internal Reference(3),
    5) Item Text (50)
    6) Due Date (10)
    7) Original Currency(3)
    8) Amount (18).
    In the field item text length is vary from each entry, it wont be static all the times, if one customer having having 10 records, all ten line items are not coming in the proper order, after displaying the item text, remaining fields are running out from the alignment. I am using tab space as 2 characters, I kept even so many conditions on the item text lenght, but still there are problems. I tried with specifying the length in
    the script for the symbols also no use and I passed (*), this is also not working properly. Here I am sending the code of my script. Please have a look and give me a suggestion please.
    bold Heading bold
    Date,,,,  ACR Ref No,,,,  UW-  Inst- Cedant,,,,,,,,,,
         ,,,,,,,,,,,,Due Date,,,, Original-,,,,Amount
         &wa_final-date(10)&,,&wa_final-xblnr(16)&,,&w_year(4)&,,
         &wa_final-xref1(3)&,,&wa_final-sgtxt(50)&
         ,,,,,,,,&wa_final-zfbdt(10)&,,,,&wa_final-waers(6)&,,,,&w_amt3(18)&
           &wa_final-date(*)&,,&wa_final-xblnr(*)&,,&w_year(4)&,,
         &wa_final-xref1(3)&,,&wa_final-sgtxt(*)&
         ,,,,,,,,&wa_final-zfbdt(*)&,,,,&wa_final-waers(*)&,,,,&w_amt3(*)&

Maybe you are looking for