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

Problem using Read_text

Former Member
0 Likes
1,450

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

5 REPLIES 5
Read only

Former Member
0 Likes
904

Hi, You shoud change it by this way.

DATA: l_NAME TYPE THEAD-TDNAME.

L_NAME = WA_VBRP-VGBEL.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = 'Z002'

LANGUAGE = SY-LANGU

NAME = L_NAME

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

Read only

Former Member
0 Likes
904

Hi Ashutosh,

The name should be something like '0000000001'. Here you NAME should be the VGBEL number & if it is for item you have to concatenate HEADER & item both into NAME & pass the same to NAME.

A sample code snipppet on which I worked for your reference:-

HEADER

l_name = ekko-ebeln.

    CALL FUNCTION 'READ_TEXT'
      EXPORTING
        client   = sy-mandt
        id       = 'F02'
        language = sy-langu
        name     = l_name
        object   = 'EKKO'
      TABLES
        lines    = l_line
      EXCEPTIONS
        OTHERS   = 0.

ITEM

CONCATENATE ekpo-ebeln ekpo-ebelp INTO l_name.
  CONDENSE l_name.

  SELECT SINGLE * FROM stxh WHERE tdobject = 'EKPO'
                                 AND  tdname = l_name
                                 AND  tdid = 'F03' .        "#EC *

  IF sy-subrc = 0.

    CLEAR: l_line.
    REFRESH l_line.

    CALL FUNCTION 'READ_TEXT'
      EXPORTING
        client   = sy-mandt
        id       = 'F03'
        language = sy-langu
        name     = l_name
        object   = 'EKPO'
      TABLES
        lines    = l_line.

Kindly set to resolved if it helps you.

Regads

Abhii

Read only

Former Member
0 Likes
904

Hi Ashutosh,

in that function module interface (NAME), you need to pass the value type THEAD-TDNAME only.

Then that function module will work.

Regards,

Tutun

Read only

0 Likes
904

Hi Tutun,

I know that the parameter NAME is of type THEAD-NAME but it should hold some value, I mean in ASHUTOSH's case it should have the value of VGBEL (Document number of the reference document), then only it will read its corresponding text.

Ashu, Just refer the above code & do as I suggested. You will get the text.

Kindly set to resolved if it helps you.

Regards

Abhii

Edited by: Abhii on Nov 20, 2009 9:20 AM

Read only

Former Member
0 Likes
904

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