Loop at FM  Read_text

Hi All,
If I hardcode material number, without loop statement call function READ_TEXT gives subrc 0. If I pass it through internal table in a loop, it ends up with SUBRC 4.
Moreover, this does not even enter into FM Read_text.
can somebody help me with this.
lOOP AT ITAB.
ALL FUNCTION 'READ_TEXT'
  EXPORTING
    CLIENT                        =   SY-MANDT
    ID                                  =  'GRUN'
    LANGUAGE                =  'EN'
    NAME                          =  ITAB-MATNR
    NAME                          =  '000000000123456789'
    OBJECT                       =  'MATERIAL'
  ARCHIVE_HANDLE                = 0
  LOCAL_CAT                     = ' '
IMPORTING
  HEADER                        =
  TABLES
    LINES                         =   IT_LINES
EXCEPTIONS
     ID                            = 1
    LANGUAGE                      = 2
    NAME                          = 3
    NOT_FOUND                     = 4
    OBJECT                        = 5
    REFERENCE_CHECK               = 6
   WRONG_ACCESS_TO_ARCHIVE       = 7
    OTHERS                        = 8
ENDLOOP.
Thanks
Sharat

Try if this works.
parameters p_matnr type matnr.
data: temp_text type table of tline with header line,
      where_cond(20) type c.
data : begin of text_id ,
         tdobject(10) value 'MVKE',
         tdname(70),
         tdid(4)      value '0001',
         tdspras   value 'D',
       end of text_id.
start-of-selection.
concatenate '%'
            p_matnr
       into where_cond.
select single tdname
  from stxl
  into text_id-tdname
where relid   = 'TX' and
       tdspras = 'E'  and
       tdname like where_cond.
import tline = temp_text[]
  from database stxl(TX) id text_id.
write: / sy-subrc.
loop at temp_text.
  write : / temp_text-tdline.
endloop.
Thanks
Mahesh

Similar Messages

  • Internal Oracle Error in SYS.UTL_HTTP.READ_TEXT - ORA-6512 @ line 1336

    I have a PLSQL program that performs an HTTP POST to fetch data from an external website. The website is returning the contents of a file in the HTTP response. This program has been working for years and just started giving us trouble recently at a particular client. The issue cannot be reproduced locally, only on a specific client machine when trying to download a particular set of XML files through this HTTP interface.
    The stack trace is:
    ORA-29273: HTTP request failed
    ORA-06512: at "SYS.UTL_HTTP", line 1336
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at "SYS.UTL_HTTP", line 1336The code in question is:
    PROCEDURE SEND_REQUEST
        p_REQUEST      IN CLOB,
        p_RESPONSE     OUT CLOB,
        p_HEADERNAMES  OUT STRING_COLLECTION,
        p_HEADERVALUES OUT STRING_COLLECTION,
        p_ERRORMESSAGE OUT VARCHAR2
    ) IS
        v_HTTP_REQ    UTL_HTTP.REQ;
        v_HTTP_RESP   UTL_HTTP.RESP;
        v_REQUEST_LEN NUMBER;
        v_POS         NUMBER;
        v_COUNT       NUMBER;
        v_TEXT        VARCHAR2(8192);
        v_LEN         NUMBER;
    BEGIN
        -- raise Request_Failed error if an HTTP error occurs
        UTL_HTTP.SET_RESPONSE_ERROR_CHECK(TRUE);
        UTL_HTTP.SET_DETAILED_EXCP_SUPPORT(FALSE);
        -- extend timeout to 10 minutes
        UTL_HTTP.SET_TRANSFER_TIMEOUT(60 * 10);
        v_HTTP_REQ := UTL_HTTP.BEGIN_REQUEST(G_URL, 'POST');
        -- disable cookies for this request
        UTL_HTTP.SET_COOKIE_SUPPORT(v_HTTP_REQ, FALSE);
        -- authentication
        IF g_USERNAME IS NOT NULL THEN
            UTL_HTTP.SET_AUTHENTICATION(v_HTTP_REQ, g_USERNAME, g_PASSWORD);
        END IF;
        -- upload request body
        v_REQUEST_LEN := DBMS_LOB.GETLENGTH(p_REQUEST);
        UTL_HTTP.SET_HEADER(v_HTTP_REQ, 'Content-Type', 'application/x-www-form-urlencoded');
        UTL_HTTP.SET_HEADER(v_HTTP_REQ, 'Content-Length', v_REQUEST_LEN);
        -- write the CLOB request data
        v_POS := 1;
        WHILE v_POS <= v_REQUEST_LEN LOOP
            v_LEN := 8192;
            DBMS_LOB.READ(p_REQUEST, v_LEN, v_POS, v_TEXT);
            UTL_HTTP.WRITE_TEXT(v_HTTP_REQ, v_TEXT);
            v_POS := v_POS + v_LEN;
        END LOOP;
        -- get the response
        v_HTTP_RESP := UTL_HTTP.GET_RESPONSE(v_HTTP_REQ);
        -- read it into CLOB
        DBMS_LOB.CREATETEMPORARY(p_RESPONSE, TRUE);
        DBMS_LOB.OPEN(p_RESPONSE, DBMS_LOB.LOB_READWRITE);
        LOOP
            BEGIN           
                UTL_HTTP.READ_TEXT(v_HTTP_RESP, v_TEXT, 8192);       
            EXCEPTION
                WHEN UTL_HTTP.END_OF_BODY THEN
                    ERRS.LOG_AND_CONTINUE('Send_Request: Exeception occurred reading text from the http response.',
                                          p_LOG_LEVEL => LOGS.C_LEVEL_INFO_MORE_DETAIL);
                    v_TEXT := '';
            END;
            EXIT WHEN NVL(LENGTH(v_TEXT), 0) = 0;   
            DBMS_LOB.WRITEAPPEND(p_RESPONSE, LENGTH(v_TEXT), v_TEXT);
        END LOOP;
        DBMS_LOB.CLOSE(p_RESPONSE);
        -- gather response headers
        p_HEADERNAMES := STRING_COLLECTION();
        p_HEADERVALUES := STRING_COLLECTION();
        v_COUNT := UTL_HTTP.GET_HEADER_COUNT(v_HTTP_RESP);
        v_POS := 1;
        WHILE v_POS <= v_COUNT LOOP
            p_HEADERNAMES.EXTEND();
            p_HEADERVALUES.EXTEND();   
            UTL_HTTP.GET_HEADER(v_HTTP_RESP, v_POS, p_HEADERNAMES(p_HEADERNAMES.LAST), p_HEADERVALUES(p_HEADERVALUES.LAST));
            v_POS := v_POS + 1;   
        END LOOP;
        UTL_HTTP.END_RESPONSE(v_HTTP_RESP);
        -- success!
        p_ERRORMESSAGE := NULL;
    EXCEPTION
        WHEN UTL_HTTP.REQUEST_FAILED THEN
            ERRS.LOG_AND_CONTINUE('Send_Request: Exeception Request Failed caught.', p_LOG_LEVEL => LOGS.C_LEVEL_INFO_MORE_DETAIL);   
        WHEN OTHERS THEN
            ERRS.LOG_AND_CONTINUE('Send_Request: Exeception Others caught.', p_LOG_LEVEL => LOGS.C_LEVEL_INFO_MORE_DETAIL);   
    END SEND_REQUEST;It fails specifically at the section that is reading text from the response:
    UTL_HTTP.READ_TEXT(v_HTTP_RESP, v_TEXT, 8192);
    ...Any thoughts?
    I have used a packet sniffer, Wireshark, to monitor the HTTP traffic between the website and database during the issue. There is nothing malformed with the Response content. No special chars that I can find. Etc.
    The machine in question that is failing is running 10gR2.
    I have done some searching and I found this forum post:
    utl_http.read_text and multi-byte support
    and this Oracle bug:
    https://support.oracle.com/CSP/main/article?cmd=show&type=BUG&id=4015165&productFamily=Oracle
    Not really much help.
    Any help would be appreciated.
    Thanks,
    GatorPaul
    Edited by: 939368 on Jun 7, 2012 2:27 PM

    In this case, and most cases, the NLS_LENGTH_SEMANTICS is set to 'BYTE'. Realize that this is an Oracle application that we deploy into an external customer environment and we do not always have the ability to control NLS Settings.
    So, based on your explanation, I would expect that an approach like this would fix it:
    v_TEXT VARCHAR2(32766);
    UTL_HTTP.READ_TEXT(v_HTTP_RESP, v_TEXT, 8192);
    Here we are saying, get the next 8192 characters, but put that into a buffer that allows up to 32K bytes. This should allow for the enough room for up to 4 bytes per character. Am I understanding you correctly?
    But here is my question:
    I put a fix in place today, where I increased both the v_TEXT byte size and the GET_TEXT 'len' parameter to 32766 and it fixed the issue. By doing that, I am telling it: Give me the next 32766 characters and put it into a VARCHAR2(32766). Given your explanation, I would expect this to overflow the v_TEXT variable as well, or at least have the potential to do so.
    We were processing 5 different XML responses. They were all failing originally. After the change, they all passed. Their sizes were 47K, 21K, 14K, 48K, and 21K. If the XML file was small, < 32K then maybe is slipped under the radar given the new buffer size of 32766. But what about the 2 files that were over 32K. Very curious on your thoughts. I did not have a loop counter in there to see how many times it was looping to parse the 48K file. With a new buffer size of 32K I would expect it to loop 2x. But, I know in this case, the file was streamed over the network using 14 smaller TCP packets, none of which were more than 9000 bytes. Maybe the PLSQL looped 14 times as well.
    When the process was failing for all 5 files, I do know at that time it was always failing on the first loop (first 8192 characters).
    Anyway, Thanks for the advice. I will let you guys know if I uncover anymore info.
    G8torPaul
    Edited by: G8torPaul on Jun 12, 2012 2:04 PM
    Edited by: G8torPaul on Jun 12, 2012 2:04 PM
    Edited by: G8torPaul on Jun 12, 2012 2:05 PM

  • Problem in using FM READ_TEXT to read Material Sales Text.

    Hi Guys,
    I am developing a Customer Outstanding report in which I display all the invoices of a particular customer.
    I need  to read "Material Sales Text" which comes under "Item Text" tab in transaction FBL5N.
    I have used READ_TEXT in my program. I have identified the Object, and ID but I am stuck up with the Name. I dont know what Name to pass. I have tried passing the Invoice Number in "Name" but couldnt get the text.
    Request you to please help me out. Please check the below code.
    CALL FUNCTION 'READ_TEXT'
      EXPORTING
      CLIENT                        = SY-MANDT
        id                            =    '0001'
        language                      =  SY-LANGU
        name                          =  -
        object                        =  'VBBP'
      ARCHIVE_HANDLE                = 0
      LOCAL_CAT                     = ' '
    IMPORTING
      HEADER                        =
      tables
        lines                         =  tl001
    EXCEPTIONS
       ID                            = 1
       LANGUAGE                      = 2
       NAME                          = 3
       OTHERS                        = 8
    Thanks.

    *&      Form  READ_TEXT
    FORM read_text  USING    p_tdid  p_tdname
                    CHANGING p_tdline.
      DATA: it_line  TYPE STANDARD TABLE OF tline,
            wa_line  TYPE tline                  ,
            l_tdid   TYPE thead-tdid,
            l_tdname TYPE thead-tdname.
      l_tdid   = p_tdid.
      l_tdname = p_tdname.
      CALL FUNCTION 'READ_TEXT'
        EXPORTING
          id       = l_tdid
          language = 'E'
          name     = l_tdname
          object   = 'VBBP'
        TABLES
          lines    = it_line
        EXCEPTIONS
          OTHERS   = 8.
      LOOP AT it_line INTO wa_line.
        IF NOT wa_line-tdline IS INITIAL.
          p_tdline = wa_line-tdline.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " READ_TEXT

  • How to use Read_Text  in Smartforms

    Hi Experts,
    I am developed smartforms .My probelm is i need to use the read_text in smartforms . i am fetch the text in print program how to use this text in smartform.
    Pls suggest me.
    This is my print program .
    REPORT  zsd_invoice_text.
    PARAMETERS : p_vbeln TYPE vbrk-vbeln.
    DATA : fname TYPE rs38l_fnam.
    DATA:BEGIN OF i_vbrk OCCURS 0,
         vbeln type VBELN_VF,
         END OF i_vbrk.
    DATA: lt_lines  TYPE STANDARD TABLE OF tline,
          wa_lines  TYPE tline.
    DATA: ld_text(18) TYPE c.
    *DATA: tdobname TYPE tdobname.
    CONSTANTS: c_id TYPE thead-tdid VALUE  '0002',
                          c_object TYPE thead-tdobject VALUE 'VBBK'.
    DATA: lv_name TYPE tdobname.
    select vbeln from vbrk into table i_vbrk where vbeln eq p_vbeln.
    loop at i_vbrk.
    read table i_vbrk with key vbeln = i_vbrk-vbeln.
    endloop.
    lv_name = i_vbrk-vbeln.
    CALL FUNCTION 'READ_TEXT'
        EXPORTING
          id        = c_id
          language  = sy-langu
          name      = lv_name
          object    = c_object
    *  IMPORTING
    *    header    = ld_header
        TABLES
          lines     = lt_lines
        EXCEPTIONS
          id        = 1
          language  = 2
          name      = 3
          not_found = 4
          object    = 5.
        IF sy-subrc <> 0.
        ELSE.
          LOOP AT lt_lines INTO wa_lines.
            CONCATENATE ld_text wa_lines-tdline INTO ld_text.
          ENDLOOP.
        ENDIF.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        formname                 = 'ZSD_INVOICE_TEXT'
    *   VARIANT                  = ' '
    *   DIRECT_CALL              = ' '
    IMPORTING
       fm_name                  = fname
    EXCEPTIONS
       no_form                  = 1
       no_function_module       = 2
       OTHERS                   = 3
    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 fname
      EXPORTING
    *   ARCHIVE_INDEX              =
    *   ARCHIVE_INDEX_TAB          =
    *   ARCHIVE_PARAMETERS         =
    *   CONTROL_PARAMETERS         =
    *   MAIL_APPL_OBJ              =
    *   MAIL_RECIPIENT             =
    *   MAIL_SENDER                =
    *   OUTPUT_OPTIONS             =
    *   USER_SETTINGS              = 'X'
        p_vbeln                    = p_vbeln
    * IMPORTING
    *   DOCUMENT_OUTPUT_INFO       =
    *   JOB_OUTPUT_INFO            =
    *   JOB_OUTPUT_OPTIONS         =
    EXCEPTIONS
       formatting_error           = 1
       internal_error             = 2
       send_error                 = 3
       user_canceled              = 4
       OTHERS                     = 5
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    Thanks in Advance
    purnaneelu
    Edited by: Purnaneelu on Jun 9, 2009 7:11 AM

    Hi,
    Used below code:
    1) Call FM READ_TEXT and pass
    DATA :
    T_LINES
    TYPE TABLE OF
    TLINE
    W_TDLINES
    TYPE
    TLINE
    V_WORK
    TYPE
    CHAR255
    CALL FUNCTION 'READ_TEXT'
       EXPORTING
        CLIENT                         = SY-MANDT
         ID                                = 'Z038'
         LANGUAGE                 = sy-langu
         NAME                         =  BIL_NUMBER
         OBJECT                      = 'VBBK'
       TABLES
         lines                            = T_LINES
    IF sy-subrc = 0.
    loop at t_lines INTO W_TDLINES.
       CONCATENATE V_WORK W_TDLINES-TDLINE INTO V_WORK SEPARATED BY SPACE.
       CONDENSE V_WORK.
       CLEAR W_TDLINES.
    ENDLOOP.
    REFRESH T_LINES.
    ENDIF.
                                                                          OR
    2 ) See below attached screen shot

  • How to print the texts retrived by using READ_TEXT fun module in Smartform

    Please tell me how to print the text which is rertrived by using the READ_TEXT function module in smartform.
    I have coded all things in the program lines and in that i am retriveing the long texts.
    I am getting the text lines in my internal table clearly, the thing is that I am not able to pass these lines to the text.
    I have to print the trouble ticket. in that the notes log I have to pass.
    its urgent. Points will be rewarded for any type of clue. whether it will work or not.

    There are a few ways to do it. If you need to take all of the text in the text type, in your SF text element choose "Include Text".
    Populate the fields with the data that corresponds to the text type. It is similar to the interface to the FM "Read_Text.
    Text Name
    Text Obje
    Text ID 
    Language
    Encase any variables with the "&" symbol.
    If you have already coded the call to the FM "READ_TEXT" and loaded the text into an internal table, create a loop and loop through the itab. Inside of the loop create a text element and add a variable in the text element for the field you are looking to output.

  • How to print text rertrived by using the READ_TEXT fun module in smartform

    Please tell me how to print the text which is rertrived by using the READ_TEXT function module in smartform.
    I have coded all things in the program lines and in that i am retriveing the long texts.
    I am getting the text lines in my internal table clearly, the thing is that I am not able to pass these lines to the text module.
    its urgent. Points will be rewarded for any type of clue. whether it will work or not.

    loop the table into which u have retrieved the text .
    in the form interface of the smartform ... in importing parameter give the that table name .
    and in smartform whereever u want to print there insert the data into work area and pass to fields for dispaly .
    decalre ur work area in global defintions
    thnaks .

  • Issue with length of text field - READ_TEXT & SAVE_TEXT

    Hi,
        I need to allow user to enter max 400 char in one field and that needs to be updated in the VA02 for the corresponding sales order.
        I can able to save the text max 132 chars since TLINE-TDLINE will allow max 132 chars in both READ_TEXT & SAVE_TEXT.
        So here i am looking for the solutions for the below...
    1) How to design one input field to take 400 chars at one shot .... do i need to use table control ?
    2) Once i get the 400 char may be i will split in to 3-4 lines and i can append 130130130... like that through those FM... if not possible can you tell me the alternative.
    regards
    jaya

    You need to use class CL_TEXT_EDIT....
    Kindly stolen from Rich Heilman -:)
    report zrich_0001 .
    data:
          dockingleft  type ref to cl_gui_docking_container,
          text_editor    type ref to cl_gui_textedit,
          repid type syrepid.
    data: itext type table of tline-tdline,
          xtext type tline-tdline.
    parameters: p_check.
    at selection-screen output.
      repid = sy-repid.
      create object dockingleft
                  exporting repid     = repid
                            dynnr     = sy-dynnr
                            side      = dockingleft->dock_at_left
                            extension = 1070.
      create object text_editor
                  exporting
                       parent     = dockingleft.
      xtext = 'http:\www.sap.com'.
      append xtext to itext.
      call method text_editor->set_text_as_r3table
         exporting
               table              = itext
         exceptions
               others             = 1.
    start-of-selection.
      call method text_editor->get_text_as_r3table
         importing
               table              = itext
         exceptions
               others             = 1.
      loop at itext into xtext.
        write:/ xtext.
      endloop.
    You can use <b>RKD_WORD_WRAP</b> to wrap the text into an internal table -;)
    Greetings,
    Blag.

  • In the read_text function module,  how to find the  lines

    The coding follows like this,
    call function 'READ_TEXT'
           exporting
                client                  = sy-mandt
                id                      = id
                language                = sy-langu
                name                    = name
                object                  = object
           importing
                header                  = header
           tables
                lines                   = tab
           exceptions
                id                      = 1
                language                = 2
                name                    = 3
                not_found               = 4
                object                  = 5
                reference_check         = 6
                wrong_access_to_archive = 7
                others                  = 8.
    can u provide me with the correct data form which i can read the lines.

    I think this code will help you to read the lines
    *--LOCAL VARIABLES
      DATA : LV_NAME TYPE THEAD-TDNAME,
             LV_TEMP(128) TYPE C      ,
    *--Structure to Hold the Header Data for Func Modules
    *--Read_text
             X_HEADER TYPE THEAD      .
      CLEAR  : LV_NAME     ,
               LV_TEMP     ,
               V_IND_FG    ,
               X_HEADER    ,
               IT_TLINES   ,
               IT_TLINES[] .
      LV_NAME  = P_DELV_NO .
      X_HEADER-TDOBJECT = 'VBBK'.
      X_HEADER-TDNAME   = LV_NAME .
      X_HEADER-TDID     = 'ZMAN'.
      X_HEADER-TDSPRAS  = 'E'.
      CALL FUNCTION 'READ_TEXT'
           EXPORTING
                CLIENT                  = SY-MANDT
                ID                      = X_HEADER-TDID
                LANGUAGE                = X_HEADER-TDSPRAS
                NAME                    = X_HEADER-TDNAME
                OBJECT                  = X_HEADER-TDOBJECT
           TABLES
                LINES                   = IT_TLINES
           EXCEPTIONS
                ID                      = 1
                LANGUAGE                = 2
                NAME                    = 3
                NOT_FOUND               = 4
                OBJECT                  = 5
                REFERENCE_CHECK         = 6
                WRONG_ACCESS_TO_ARCHIVE = 7
                OTHERS                  = 8.
      IF SY-SUBRC <> 0.
         ERROR.
        CLEAR :IT_TEXT,
               IT_TEXT[] .
        V_IND_FG = 'X' .
        EXIT .
      ENDIF.
      LOOP AT IT_TEXT .
        IT_TLINES-TDFORMAT = '*'.
        IT_TLINES-TDLINE = IT_TEXT-LINE.
        APPEND IT_TLINES.
        CLEAR  IT_TLINES.
      ENDLOOP.
    Thanks,
    Koshal

  • Problem in read_text   function

    Hi all,
    I want to read multiple rows by read_text functions but it shows me single row only.
    Plz help me how to read multiple rows ..

    >
    ankita patel wrote:
    > Hi kartik...
    > I am using this code because I want to modify my internal table field..
    >
    > If i am not using it , only blank value store in internal table.
    >
    >
    > IF NOT I_TAB-NO_OF_BOX IS  INITIAL.
    >
    >        exit.
    >     ENDIF.
    Hi ankita,
    See.
    What ur code is currently doing is reading one line then
    checking this condition
    IF NOT I_TAB-NO_OF_BOX IS  INITIAL.
           exit.
         ENDIF.
    Condition is true so it exits.
    So its not reading other lines.
    do like this
    CALL FUNCTION 'READ_TEXT'
    EXPORTING
    id = 'B01'
    language = sy-langu
    name = name
    object = 'EBAN'
    TABLES
    lines = lt_text.
    if sy-subrc = 0. "  This is important
    loop at lt_text.
    concatenate  i_TAB-NO_OF_BOX  lt_text-TDLINE to  i_TAB-NO_OF_BOX.
    endloop.
    endif.
    MODIFY I_TAB. "here if u want u can put this check IF NOT I_TAB-NO_OF_BOX IS INITIAL. but i think its not required as now we are looping at lt_text only if sy-subrc is 0
    кu03B1ятu03B9к

  • How to remove representation of grammar correction of text (FM read_text)?

    Hi ABAP Gurus,
    I am working on a program that downloads data to Excel.
    The data comes from the text using the FM read_text.
    I tried to look at the data and it contains grammatical error like no spaces are provided after end of each sentence.
    When I tried to view it, an ampersand sign (#) appeared in between of those words. See sample below:
    This account should be used to hold the Raw Material related variances within Finished Product Variances.#This Account is being set-up as open item managed account to support the global requirement.
    If you notice, the correct grammar entails us that there should be spaces after period (.) of the 'Variances' before the 'This' word. As a result when viewing such text, an ampersand appeared  using the old editor though the ampersand sign did not appear using the new text editor.
    My case then is to remove the such appearance of ampersand but I cannot remove it since the abap code cannot determine it  as a character.
    It helps me conclude then  that the ampersand sign that appeared in representation of grammar check (usually words are highlighted in red)  is not really a character. It is the representation of that crooked red line during grammar chek of the text.
    I have to get rid of that ampersand since I am downloading the data to excel, otherwise it causes the data to move to another row in excel file.
    Please help me.
    Thank you.
    Regards,
    Onyx

    What I have had to do, in one similar instance, is find the special characters that were being 'pasted in' by someone who was copying and pasting from a desktop file that had oddball hex characters in it...Here's the approach I took (to the best of my memory).
    Look in debug and identify the hex value of the characters...
    Turn off the unicode switch in porgram attributes, so you can declare type x.
    Set fields like this: 
    lc_hex1 type x value '09'.  "1 character hex field...put in the bad hex value you saw in debug...
    declare as many of these constants as you need....
    then ....
    field-symbols <fs> type tline.
    loop at itxt assigning <fs>.
    if <fs> is assigned.
    replace all occurrences of lc_hex1 with space into <fs>-tdline.
    replace all occurrences of ... with space into <fs>-tdline.  "as many times as needed for each "bad" character.
    condense <fs>-tdline.  "squeeze all the extra spaces out
    endif.
    endloop.
    Then you might want to call something like RKD_WORD_WRAP to reformat to the length you'd like, breaking on word (space) boundardies.
    Edited by: BreakPoint on Jun 25, 2010 8:15 PM  ... use replace all occurrences instead of do...enddo.

  • Problem using Read_text

    Hi,
    I am using the Read_text in the following manner:
    TYPES : BEGIN OF STR_VBRP,
              VGBEL TYPE VBRP-VGBEL,
              VGPOS TYPE VBRP-VGPOS,
              END OF STR_VBRP.
      DATA : IT_VBRP TYPE STANDARD TABLE OF STR_VBRP INITIAL SIZE 0,
             WA_VBRP TYPE STR_VBRP.
    DATA: ITAB_LINES LIKE TLINE OCCURS 0 WITH HEADER LINE.
    CALL FUNCTION 'READ_TEXT'
                      EXPORTING
                       CLIENT                        = SY-MANDT
                        ID                            = 'Z002'
                        LANGUAGE                      = SY-LANGU
                        NAME                          = WA_VBRP-VGBEL
                        OBJECT                        = 'VBBK'
                      ARCHIVE_HANDLE                = 0
                      LOCAL_CAT                     = ' '
                      IMPORTING
                      HEADER                        =
                        TABLES
                        LINES                         = ITAB_LINES
                      EXCEPTIONS
                       ID                            = 1
                       LANGUAGE                      = 2
                       NAME                          = 3
                       NOT_FOUND                     = 4
                       OBJECT                        = 5
                       REFERENCE_CHECK               = 6
                       WRONG_ACCESS_TO_ARCHIVE       = 7
                        OTHERS                        = 8
    And when I am running it I am getting the following dump:
    The function module interface allows you to specify only
    fields of a particular type under "NAME".
    The field "WA_VBRP-VGBEL" specified here is a different
    field type.
    Please let me know how should I pass the data.
    Regards,
    Ashutosh

    Hi,
    Try using sample code below:
    TABLES: PBIM.
    * stxh, stxl, stxb - trans tables for text
    * ttxit - text on text-ids
    * ttxot - Short texts on text objects
    * Transaction MD63
    SELECT-OPTIONS: S_MATNR FOR PBIM-MATNR,
                    S_WERKS FOR PBIM-WERKS.
    DATA: BEGIN OF HTEXT.
            INCLUDE STRUCTURE THEAD.
    DATA: END OF HTEXT.
    DATA: BEGIN OF LTEXT OCCURS 50.
            INCLUDE STRUCTURE TLINE.
    DATA: END OF LTEXT.
    DATA: BEGIN OF DTEXT OCCURS 50.
    DATA:   MATNR LIKE PBIM-MATNR.
            INCLUDE STRUCTURE TLINE.
    DATA: END OF DTEXT.
    DATA: TNAME LIKE THEAD-TDNAME.
    SELECT * FROM PBIM WHERE WERKS IN S_WERKS.
      MOVE PBIM-BDZEI TO TNAME.
      CALL FUNCTION 'READ_TEXT'
           EXPORTING
    *           CLIENT                  = SY-MANDT
              ID                      = 'PB'
              LANGUAGE                = 'E'
              NAME                    = TNAME
              OBJECT                  = 'PBPT'
    *         ARCHIVE_HANDLE          = 0
         IMPORTING
              HEADER                  = HTEXT
         TABLES
              LINES                   = LTEXT
         EXCEPTIONS
              ID                      = 1
              LANGUAGE                = 2
              NAME                    = 3
              NOT_FOUND               = 4
              OBJECT                  = 5
              REFERENCE_CHECK         = 6
              WRONG_ACCESS_TO_ARCHIVE = 7
              OTHERS                  = 8.
      LOOP AT LTEXT.
        IF LTEXT-TDLINE NE ''.
          MOVE LTEXT-TDLINE TO DTEXT-TDLINE.
          MOVE PBIM-MATNR TO DTEXT-MATNR.
          APPEND DTEXT.
        ENDIF.
      ENDLOOP.
    ENDSELECT.
    LOOP AT DTEXT.
      WRITE:/ DTEXT-MATNR, DTEXT-TDLINE.
    ENDLOOP.
    Hope it helps
    Regards
    Mansi

  • How to use Read_text in Smart Forms for printing Header Texts

    Dear ALL,
    I want to print Header Texts in SmartForms, For that
    I am using T/Code VL02N .. and choosed  Header ..
    got this details...  from Text Header.
    Text Name       :0080000441
    Language         :EN
    Text ID             :Z002
    Text Object       :VBBK.
    So in Smart forms Under Template i have created a text and Program Code .
    Inside that I have used this below code .
    CALL FUNCTION 'READ_TEXT'
    EXPORTING
    *CLIENT= SY-MANDT
    ID = 'Z002'
    LANGUAGE =  SY-LANGU
    NAME = NAME
    OBJECT = 'VBBK'
    TABLES
    LINES = IT_TLINE
    EXCEPTIONS
    ID = 1
    LANGUAGE = 2
    NAME = 3
    NOT_FOUND = 4
    OBJECT = 5
    REFERENCE_CHECK = 6
    WRONG_ACCESS_TO_ARCHIVE = 7
    OTHERS = 8.
    IF SY-SUBRC 0.
    CLEAR IT_TLINE.
    ENDIF.
    Kindly suggest me, Where  to declare the variables and loops for using this Read_Text Syntax in Smartforms .
    Response to this will be highly appreciated........  
    Regards ,
    Vinoth.

    hi
    good
    please check this code
    CONSTANTS:
    *For text reading like in LCNMMFTX / FORM SET_CONTROL_TEXT
               text_id  like thead-tdid     value 'MATK',
               text_obj like thead-tdobject value 'AUFK  '.
    data tlines like tline occurs 0 with header line.
    data tdname like thead-tdname.
    data tdheader like thead.
    if not it_proj-ltxsp is initial.
    refresh tlines.
            tdname = sy-mandt.
            tdname+3 = it_proj-rsnum.
            tdname+13 = it_proj-rspos.
            tdname+17 = it_proj-rsart.
            call function 'READ_TEXT'
                 exporting
                    id        = text_id
                    language  = it_proj-ltxsp
                    name      = tdname
                    object    = text_obj
                 importing
                    header    = tdheader
                 tables
                    lines     = tlines.
                exceptions
                   not_found = 01.
    thanks
    mrutyun^

  • Read_text in smart forms

    I use read_text in smart form...how to pass object in this fm....actually there is standard table which maintains data according username......from which we can fetch data required for this fm..i am not getting tasble name..plz can u suggest

    t_code s010
    ABAP READ_TEXT functions to read the SAP Long Text
    You have to used the READ_TEXT functions to read the SAP long text. e.g. Sales Order, Purchase Order Item text etc.
    To check your long text header, go into the long text. Click Goto -> Header
    Example of READ_TEXT functions reading tables PBIM - Independent requirements for material.
    Example of READ_TEXT functions reading tables PBIM - Independent requirements for material.
    REPORT ZTEXT .
    TABLES: PBIM.
    stxh, stxl, stxb - trans tables for text
    ttxit - text on text-ids
    ttxot - Short texts on text objects
    Transaction MD63
    SELECT-OPTIONS: S_MATNR FOR PBIM-MATNR,
    S_WERKS FOR PBIM-WERKS.
    DATA: BEGIN OF HTEXT.
    INCLUDE STRUCTURE THEAD.
    DATA: END OF HTEXT.
    DATA: BEGIN OF LTEXT OCCURS 50.
    INCLUDE STRUCTURE TLINE.
    DATA: END OF LTEXT.
    DATA: BEGIN OF DTEXT OCCURS 50.
    DATA: MATNR LIKE PBIM-MATNR.
    INCLUDE STRUCTURE TLINE.
    DATA: END OF DTEXT.
    DATA: TNAME LIKE THEAD-TDNAME.
    SELECT * FROM PBIM WHERE WERKS IN S_WERKS.
    MOVE PBIM-BDZEI TO TNAME.
    CALL FUNCTION 'READ_TEXT'
    EXPORTING
    CLIENT = SY-MANDT
    ID = 'PB'
    LANGUAGE = 'E'
    NAME = TNAME
    OBJECT = 'PBPT'
    ARCHIVE_HANDLE = 0
    IMPORTING
    HEADER = HTEXT
    TABLES
    LINES = LTEXT
    EXCEPTIONS
    ID = 1
    LANGUAGE = 2
    NAME = 3
    NOT_FOUND = 4
    OBJECT = 5
    REFERENCE_CHECK = 6
    WRONG_ACCESS_TO_ARCHIVE = 7
    OTHERS = 8.
    LOOP AT LTEXT.
    IF LTEXT-TDLINE NE ''.
    MOVE LTEXT-TDLINE TO DTEXT-TDLINE.
    MOVE PBIM-MATNR TO DTEXT-MATNR.
    APPEND DTEXT.
    ENDIF.
    ENDLOOP.
    ENDSELECT.
    LOOP AT DTEXT.
    WRITE:/ DTEXT-MATNR, DTEXT-TDLINE.
    ENDLOOP.
    http://www.sapdevelopment.co.uk/sapscript/sapscript_texts.htm
    Also
    *Internal table to store standard texts
    DATA: IT_TEXTS like T_LINE occurs o with header line.
    CALL FUNCTION 'READ_TEXT'
    EXPORTING
    CLIENT = SY-MANDT
    id = "Text ID
    language = "Laguage
    name = "Text name
    object = "text object
    ARCHIVE_HANDLE = 0
    IMPORTING
    HEADER =
    tables
    lines = IT_TEXTS "Internal table
    EXCEPTIONS
    ID = 1
    LANGUAGE = 2
    NAME = 3
    NOT_FOUND = 4
    OBJECT = 5
    REFERENCE_CHECK = 6
    WRONG_ACCESS_TO_ARCHIVE = 7
    OTHERS = 8
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    <b>save text</b>
    Fill out following parameters of SAVE_TEXT function module:
    HEADER
    TDOBJECT C 10 BUT000
    TDNAME C 70 10 digit BP number
    TDID C 4 Z001
    TDSPRAS C 1 Language
    INSERT = ’X’
    LINES
    TDFORMAT TDLINE
    |
    |testtttttttttttttttttttttttt( Your text)
    I would suggest you to use some other BAPI that would attach your text to BP than SAVE_TEXT.
    If you still wanted to use SAVE_TEXT then first make sure how the TDNAME is generated. It depends on the text determination procedure. For examples, it can be guid of BP, GUID followed by date or time or else the BP number itself.
    Just go to BP transaction, double click on the text pad, it will open you the SAP Script editor. Click on menu GOTO and select Header which will give you info about your TDID, TDOBJECT, TDNAME....
    Hope this helps.

  • Print the head text in a Smartforms - READ_TEXT Function

    Hello,
    I have a huge problem to print a MM document's. I need show the text head in the footer of the document. For this i use the READ_TEXT function. To use this function i enter to vl03n transaction, enter the document number, go to the text head, double click, and i see the parameters = Name (document number), language (ES), id (0001), object (VBBK)...
    In the smartform code I write this:
    <b>DATA: leng TYPE thead-tdspras,
          l_fname TYPE thead-tdname.
    DATA: il_tline LIKE tline OCCURS 0 WITH HEADER LINE.
    leng = 'ES'.
    l_fname = is_dlv_delnote-hd_gen-deliv_numb.
    CALL FUNCTION 'READ_TEXT'
      EXPORTING
        client   = sy-mandt
        id       = '0001'
        language = leng
        name     = l_fname
        object   = 'VBBK'
      TABLES
        lines    = il_tline.
    comentario = ''.
    LOOP AT il_tline.
      CONCATENATE comentario il_tline-tdline INTO comentario SEPARATED BY space.
    ENDLOOP.</b>
    But to try print a document with number 0012345678 through to the IDCP transaction return me the follow error:
    Text 0012345678 ID 0001 language <b>EN</b> no exist
    why change the language?
    i see the STXH table, and i found this register:
    MANDT   TDOBJECT      TDNAME         TDID      TDSPRAS
    200             VBBK       0012345678           0001        S
    Where is my problem?
    Please, help me!!!
    Regards.

    Hi rudiRocket,
    Welcome to Numbers discussions.
    Yes I see what you're talking about, never noticed it. To remove the shadow I tried numerous fonts but, still the shadow. Let's hope someone else has a better answer. Be aware folks on these Discussion boards are, as yourself end users not Apple employees.
    In the mean time please read the below instructions:
    Send feedback directly to the Numbers team for enhancement requests: at the top of your screen to the right of the blue Apple please click "Numbers" > "Provide Numbers Feedback". Explain in detailed what you've found. This makes your request known to the Numbers team directly; don't expect to hear back from them. I've sent many as well.
    Let's hope the next version of iWork incorporates many of the requested enhancements.
    Thank you in advance for doing that.
    Again, welcome to Numbers Discussions, have fun here.
    Sincerely,
    RicD

  • How to use read_text...

    Hello experts,
    I have been tasked to get the start and end date from t-code FB03. Now my question is, what will I put in it? Here is my code where I plan to put the read text:
    LOOP AT it_bsis ASSIGNING <fs_bsis>.
        SELECT SINGLE bukrs belnr gjahr budat bldat xblnr bktxt FROM bkpf
        INTO (bkpf-bukrs, bkpf-belnr, bkpf-gjahr, it_bseg-budat,
              it_bseg-bldat, it_bseg-xblnr, it_bseg-bktxt)
        WHERE bukrs = <fs_bsis>-bukrs
          AND belnr = <fs_bsis>-belnr
          AND gjahr = <fs_bsis>-gjahr.
        SELECT SINGLE bukrs belnr buzei gjahr shkzg dmbtr lifnr sgtxt
        FROM bseg INTO (it_bseg-bukrs, it_bseg-belnr, it_bseg-buzei,
                        it_bseg-gjahr, it_bseg-shkzg, it_bseg-dmbtr,
                        it_bseg-lifnr, it_bseg-sgtxt)
        WHERE bukrs = <fs_bsis>-bukrs
          AND belnr = <fs_bsis>-belnr
          AND gjahr = <fs_bsis>-gjahr
          AND koart = 'K'
          AND hkont = <fs_bsis>-hkont
          AND umskz = 'K'
          AND fdlev = 'DP'.
      ENDLOOP.
    Again, thank you guys and have a great day!

    First you need to find out exactly what text that you need to get.  The text headers are stored in STXH,  here you can see the object, id, and name of the text.  You can get the object and id by using transaction code SE75.  This will list all of the text objects and the ids underneath them.  The NAME is usually the key of the object.  For example, for Sales Document Header Text, the name is the sales document number.  Other NAMEs are a combination. For example, material memo text, It is a combination of material number and plant.  To find exactly what object, id, and how the NAME is built, I usually create a text using the standard transaction.  Then go to SE16, on table STXH, and do a query for "Created By" = me, and "Created Date" = today.  This will give me the header record of the text that I just created.  Now I can see what the Object, ID, and NAME is.  With this information, you can pass to the READ_TEXT function module and get your text.
    Make sense?
    Regards,
    Rich Heilman

Maybe you are looking for