Application Development and Automation 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: 
Read only

Read_Text

Former Member
0 Likes
1,820

Hi,

I have sales order num and want to read Header texts. Can someone please give me an example.

Thanks,

Veni.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,630

MOVE wa_vbak-vbeln TO v_vbeln.

you have to pass sales order number ,id,object.

to get those values go to SE75.

select text objects and IDs and display.

search for sales.you will get object for sales and double click on it to get the Text IDs.

CALL FUNCTION 'READ_TEXT'
    EXPORTING
     client                        = sy-mandt
      id                            = 'Z004'
      language                      = sy-langu
      name                          = v_vbeln
      object                        = 'VBBK'
*   ARCHIVE_HANDLE                = 0
*   LOCAL_CAT                     = ' '
* IMPORTING
*   HEADER                        =
    TABLES
      lines                         = t_lines
   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.

15 REPLIES 15
Read only

former_member156446
Active Contributor
0 Likes
1,630

Hope this helps

DATA: LS_XTHEAD LIKE THEADVB.
DATA tlinetab   LIKE tline OCCURS 0 WITH HEADER LINE.
(This structure is only suitable the first time we entry the VA01)
READ TABLE XTHEAD INTO LS_XTHEAD WITH KEY TDOBJECT = XTHEAD-TDOBJECT
                                                TDNAME   = XTHEAD-TDNAME
                                                TDID     = XTHEAD-TDID
                                                TDSPRAS  = XTHEAD-TDSPRAS.

CALL FUNCTION 'READ_TEXT'
    EXPORTING
     CLIENT                        = SY-MANDT
      id                            = LS_XTHEAD-tdid
      language                      = LS_XTHEAD-tdspras
      name                          = LS_XTHEAD-tdname
      object                        = LS_XTHEAD-tdobject
    TABLES
      lines                         = tlinetab
   EXCEPTIONS
     id                            = 1
     language                      = 2
     name                          = 3
     not_found                     = 4
     object                        = 5
     reference_check               = 6
     wrong_access_to_archive       = 7
     OTHERS                        = 8.
  CHECK sy-subrc = 0.

Read only

Former Member
0 Likes
1,631

MOVE wa_vbak-vbeln TO v_vbeln.

you have to pass sales order number ,id,object.

to get those values go to SE75.

select text objects and IDs and display.

search for sales.you will get object for sales and double click on it to get the Text IDs.

CALL FUNCTION 'READ_TEXT'
    EXPORTING
     client                        = sy-mandt
      id                            = 'Z004'
      language                      = sy-langu
      name                          = v_vbeln
      object                        = 'VBBK'
*   ARCHIVE_HANDLE                = 0
*   LOCAL_CAT                     = ' '
* IMPORTING
*   HEADER                        =
    TABLES
      lines                         = t_lines
   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.

Read only

0 Likes
1,630

Hi,

Is the following code correct.

data: itab_read like tline occurs 10 with header line.

V_vgbel has order number.

concatenate v_vgbel '0000' into f_vgbel.

If I give just V_vgbel sales order number it is giving me dump.

If I give f_vgbel then, no dump but nothing is comming in itab_read.

Is there anything wrong in my code.

Please help.

Thanks,

Veni.

call function 'READ_TEXT'

EXPORTING

id = '0021'

language = 'E'

name = f_vgbel

object = 'VBBK'

TABLES

lines = itab_read

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

others = 8.

Read only

0 Likes
1,630

Hi

VGBEL-Document number of the reference document

its different to sales order number .. all though both are vbeln..

Read only

0 Likes
1,630

Hi,

In my program it is declared as sales order number and I debuged it and checked the number is sales oder number only.

v_vgbel like lips-vgbel, " Sales Order Number

select single vgbel matnr from lips

into (v_vgbel,v_matnr)

where vbeln = v_vbeln

and posnr = v_posnr.

Thanks,

Veni.

Read only

0 Likes
1,630

if you can double click in lips-vgbel it will take you to the field.. which says

VGBEL VGBEL CHAR 10 0 Document number of the reference document

if this is the number you want text .. then the object which you are passing into read_text will change.. thats the reason ur table is not getting data.

Read only

0 Likes
1,630

Hi,

I went in to Sales order header texts and double clicked on the text and went to goto -> header. Then I got text name as sales order num, textid 0021, text object VBBK and language EN.

Will the following v_vbeln work for me as text name?

--


Get Sales Order information from sales order number.--

select single vbeln from vbak into (v_vbeln)

where vbeln = v_vgbel.

Thanks,

Veni.

Read only

0 Likes
1,630

hi veni

at times there will be spaces in between vbeln <space> posnr

check in STXH table with the object tdname and tdid and check if you are returning any data..

if you are getting in table and not in read text.. there is some problem in the table deceleration or some code issue...

Read only

0 Likes
1,630

Hi,

Here is exactly how it is in my STXH table. it gave TDTXTLINES as 1.

Text Object VBBK

Text Name 0001994817

Text ID 0021

Language Key E

TDTXTLINES 1

Thanks,

veni.

Read only

0 Likes
1,630

you dont have to concatenate sy-mandt to SO number.

just pass the SO number itself.

concatenate v_vgbel '0000' into f_vgbel.

MOVE v_vgbel TO f_vgbel.

Read only

0 Likes
1,630

Hi,

I have these values.

v_vgbel 0001994817

f_vgbel 00019948170000

v_vgbel is my sales order number

f_vgbel is ordernum + item num (as this is header text I am passing 0000 as item num)

If I just give v_vgbel(Order num) it is giving me the following dump. If I give f_vgbel(order num+0000) it is not giving me any dump, but no values are comming in itab_read.

I will really appriciate your help.

Thanks,

Veni.

Runtime Errors CALL_FUNCTION_CONFLICT_TYPE

Except. CX_SY_DYN_CALL_ILLEGAL_TYPE

Date and Time 11/13/2008 13:29:19

Short text

Type conflict when calling a function module.

What happened?

Error in the ABAP Application Program

The current ABAP program "SAPLXLID" had to be terminated because it has

come across a statement that unfortunately cannot be executed.

A function module was called incorrectly.

Error analysis

An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was

not caught in

procedure "EXIT_SAPLVMDE_002" "(FUNCTION)", 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:

The call to the function module "READ_TEXT" is incorrect:

The function module interface allows you to specify only

fields of a particular type under "NAME".

The field "V_VGBEL" specified here is a different

field type

.

Read only

0 Likes
1,630

the value passed to this FM should be of type THEAD-TDNAME.

you dont have to concatenate the mandt or item for reading header text.

if you see the values in STXH table the text name is 10 characters(just the SO number).

Text Object VBBK
Text Name 0001994817
Text ID 0021
Language Key E

TDTXTLINES 1

Try this code :

*DATA : f_vgbel TYPE THEAD-TDNAME.* 

*MOVE v_vgbel TO f_vgbel.*


call function 'READ_TEXT'
EXPORTING
id = '0021'
language = 'E'
name = f_vgbel
object = 'VBBK'
TABLES
lines = itab_read
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
others = 8.

Read only

Former Member
0 Likes
1,630

Hi,

Try this..

data: v_name TYPE THEAD-TDNAME.

concatenate sy-mandt V_vgbel  into v_name.

call function 'READ_TEXT'
EXPORTING
id = '0021'
language = 'E'
name = v_name          " Changed here.
object = 'VBBK'
TABLES
lines = itab_read
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
others = 8.

Thanks

Naren

Read only

guang_li
Explorer
0 Likes
1,630

hi Veni

try this code:


data: v_vgbel like lips-vgbel.
data: v_name type thead-tdname.
data: itab_read like tline occurs 10 with header line.

select single vgbel matnr from lips
            into (v_vgbel,v_matnr)
        where vbeln = v_vbeln
           and posnr = v_posnr. 

v_name = v_vgbel.

CALL FUNCTION 'READ_TEXT'
    EXPORTING
      id                            = 'Z004'
      language                      = sy-langu
      name                          = v_name
      object                        = 'VBBK'
*   ARCHIVE_HANDLE                = 0
*   LOCAL_CAT                     = ' '
* IMPORTING
*   HEADER                        =
    TABLES
      lines                         = itab_read
   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.

Edited by: hikarulea on Nov 14, 2008 4:06 PM

Read only

Former Member
0 Likes
1,630

Dont you know how to search in SDN.

If you do a search with READ_TEXT you will get tons of threads having code samples.

Read the [Rules of Engagement|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement] before posting more.

And always search before posting a question.

Regards

Karthik D