Application Development 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: 

FM: read_text for multiple text ids...

Former Member
0 Kudos

Dear All ,

I would like to know how the function module read_text can be used for multiple Text ids as: z001 ,z002 ,z003 ,z004,z005 ,z006.............!

One thing i cud dat moving the FM in the loop for the above entries ,but how to pass on those values in the FM .

As:

Text name : 10 digit billing doc no .

Text Object : VBBK .

Text Id : z001 ,

z002 ,

z003 ,

z004,

z005 ,

z006.............!

Regards

Swapnil K

7 REPLIES 7

Former Member
0 Kudos

Hi,

You can move all the values in internal table, then loop on that internal table and call function module inside the loop passing the internal table field. What exactly is the issue here?

Regards

Radhika

0 Kudos

hey radhika

Problem is dat every time a loop move :

i dont have to change my text name not the text object only thing i have to change is the text id .......!

It would be help ful if you could explain with a sample code ..........!

Regards

Swapnil K

0 Kudos

Hi Swapnil,

You can move the values of Text name, text object and text id in internal table as shown below:

txt_name txt_objext txt_id

-


ABC ZZZ Z1

ABC ZZZ Z2

ABC ZZZ Z3

PQR YYY Z1

PQR YYY Z2

and so on

then you can loop on this internal table, say

loop at itab.

CALL FUNCTION 'READ_TEXT'

EXPORTING

ID = itab-txt_id

LANGUAGE = 'EN'

NAME = itab-txt_name

OBJECT = itab-txt_object

TABLES

LINES = I_DATA_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 NE 0.

  • MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

  • WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

move the records from i_data_lines in another internal table.

refersh i_data_lines.

endloop.

Hope this helps.

Regards

Radhika

Former Member
0 Kudos

Hi,

Try using the sample code below:



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. 

Hope it helps

Regards

Mansi

0 Kudos

Hey mansi

I doesn't want th emultiple entries for TEXT NAME but i require it for TEXT ID

what you have shown if for ' name ' .

Regards

Swapnil K

0 Kudos

Hi,

Then create loop for Id alone.

Suppose IT_HEADER is the internal table which contains all your text-IDs ( Z001, to Z00n),


Loop at IT_HEADER into WA_HEADER.

            CALL FUNCTION 'READ_TEXT'
              EXPORTING
                ID       = WA_HEADER-TDID
                LANGUAGE = <language paramater>
                NAME     = <10 digit billing doc no >
                OBJECT   = 'VBBK'
              IMPORTING
                HEADER   = WA_HEADER2
              TABLES
                LINES    = T_LINES.
Endloop.

Regards,

Swarna Munukoti.

Former Member
0 Kudos

thnks all