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

call function -tables

Former Member
0 Likes
6,609

hello,

in call function 'read_text' , what tables to use .

how do i find out what sud be the name of the table .

joseph

29 REPLIES 29
Read only

Former Member
0 Likes
4,552

Hi Joesph,

You have to pass the TEXT ID, LANGUAGE, NAME OF THE TEXT TO BE READ, OBJECT OF THE TEXT TO BE READ.

So you will get the lines of the text read in the TABLES parameter LINES.

A sample code for your kind perusal:-

data: begin of lt_tline occurs 0.
          include structure tline.
  data: end of lt_tline.
  data: l_tabix like sy-tabix.
  data: l_name like thead-tdname.

  sort it_kdgrp by spras kdgrp.

  loop at it_billing_docs into w_billing_docs.
    clear l_name.
    l_tabix = sy-tabix.
*-----Convert billing doc number to appropriate format
*    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
*      EXPORTING
*        INPUT         = w_billing_docs-vbeln
*      IMPORTING
*        OUTPUT        = l_name.
*-----Move to correct format for read_text
    move w_billing_docs-vbeln to l_name.
    call function 'READ_TEXT'
         exporting
              client                  = sy-mandt
              id                      = 'Z012'
              language                = sy-langu
              name                    = l_name
              object                  = 'VBBK'
         tables
              lines                   = lt_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 eq 0.
*----Only the first line will be read
      read table lt_tline index 1.
      if sy-subrc eq 0.
        w_billing_docs-bill_name = lt_tline-tdline.
      endif.
    endif.

Kindly set to resolved if it helps you.

Regards

Abhii

Moderator message - Please use code tags to help readability

Edited by: Rob Burbank on Nov 17, 2009 10:41 AM

Read only

0 Likes
4,552

thanks abhi,

that is my questions . i have to get the item text on GR-slip

i have written the code but i get stuck at

tables

lines =

what do i write after equal to sign and then what i declare in the data stmnt.

i have passed all the rest parametrs of item text like text id , name object etc.

it is just this one .

joseph

Read only

0 Likes
4,552

Just pass the parameter in the tables as I defined above. READ_TEXT will fill up this tables.

You might get a doubt from where to find out the values of TEXT ID, LANGUAGE, NAME OF THE TEXT TO BE READ, OBJECT OF THE TEXT TO BE READ.

Example : Say you have to read the Long text in the Sales Header. To find out above values do as below :-

1) Go to VA03 ,enter billing number & hit enter.

2) Click on Go to Menu.

3) Then Select HEADER.

4) Then Select TEXTS.

5) Double click on the long text ,you see there.

6) It will open SAP script text editor.

7) Then click on GO TO & select HEADER

😎 You will find TEXT NAME, LANGUAGE, TEXT ID, & TEXT OBJECT.

Kindly set to resolved if it helps you.

Regards

Abhii

Edited by: Abhii on Nov 17, 2009 4:54 PM

Read only

0 Likes
4,552

thanks abhi,

i already told you i know where to get the rest of the parameters , i wanted to know how to get the table

you gave the entire program code , but my question i still not answered .

i want to know what table name to write .

joseph

Read only

0 Likes
4,552

Dear Abhii,

You deserve full credit for your replies, however, I should point out that you should no longer use the 'OCCURS x' language statement. Beside the fact that it is obsolete, you simply cannot use it in classes.

Read only

0 Likes
4,552

Joseph,

it is all there in Abhii's code:

Name of the table 'LT_LINES' (which is arbitrary).

Data declaration:


data: begin of lt_tline occurs 0.
          include structure tline.
  data: end of lt_tline.

What else do you need.

Read only

0 Likes
4,552

Hi Mickey,

my code is

DATA : EBELP TYPE EBELP .
DATA : EBELN TYPE EBELN .
DATA : begin of lt_tline occurs 0.
          include structure tline.
DATA : end of lt_tline.

CLEAR lv_name.
CONCATENATE ebeln ebelp INTO lv_name.

CALL FUNCTION 'READ_TEXT'

EXPORTING
           ID = 'F01'
           LANGUAGE = 'E'
           NAME = 'lv_name'
           OBJECT = 'EKPO'

 TABLES
          LINES = lt_tline
          
EXCEPTIONS
          NOT_FOUND = 04.

when i check the print preview i get 00000 .

where am i wrong .

also if there are 5 line items , what sud be the loop.

Joseph

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
4,552
CALL FUNCTION 'READ_TEXT'
 
EXPORTING
           ID = 'F01'
           LANGUAGE = 'E'
           " NAME = 'lv_name'
           NAME = lv_name
           OBJECT = 'EKPO'

This should be it ...

BR,

Suhas

Read only

0 Likes
4,552

now i get a runtime error saying the field lv_name specifed is a different field type.

what sud be the data type for lv_name

joseph

Edited by: joseph_sweden on Nov 18, 2009 9:59 AM

Read only

0 Likes
4,552

data: lv_name like thead-tdname.

Read only

0 Likes
4,552

thanks ,

i have declared it same way but it is giving 00000 in the print out

joseph

Edited by: joseph_sweden on Nov 18, 2009 10:25 AM

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
4,552

Hello,

Forget about the print out for the time being, debug the code & check if the table LT_TLINE is populated after READ_TEXT.

If values are populated, then we proceed.

BR,

Suhas

Read only

0 Likes
4,552

print program is a standard program for m any smartforms , do i need to debugg the smartform , how do i do that

joseph

Read only

0 Likes
4,552

Hi,

write the statement BREAK-POINT before calling your function module READ_TEXT.

Now check whether the input parameters are passed correctly or not.

Now execute the function module and then check the tables parameter whether any records are coming into this table.

Regards,

Swarna Munukoti.

Read only

0 Likes
4,552

hello Suhas,

i debugged and no values are populated in the table.

joseph

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
4,552

Hello,

This means that the call of your READ_TEXT is incorrect.

You are trying to read the long text for which object?

BR,

Suhas

Read only

0 Likes
4,552

i am trying to print item text on gr-slip

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
4,552

Check in debug mode what are the parameters you are passing to the FM. Is the variable LV_NAME populated correctly?

Is the language always 'E' ?

BR,

Suhas

Read only

0 Likes
4,552

thanks ,

but i really dont know what to do . the parameters are id, object , language and name and wheni click on lv_name it is 00000.

it is taking the value of ebeln

is there any thing wrong with the data declaration of ebeln and ebelp .

see my code in the previous comments

joseph

Read only

0 Likes
4,552

Hi,

In your code:


DATA : EBELP TYPE EBELP .
DATA : EBELN TYPE EBELN .
DATA : begin of lt_tline occurs 0.
          include structure tline.
DATA : end of lt_tline.
 
CLEAR lv_name.
CONCATENATE ebeln ebelp INTO lv_name.

What are the values that you are passing in ebeln and ebelp ?

Are there any values passed to these two variables?

Regards,

Swarna Munukoti

Read only

0 Likes
4,552

no , i m not passing any values .

Read only

0 Likes
4,552

Hi,

In your code lv_name is the combination of ebelp and ebeln.

When you are not passing any values to these variables, obviously lv_name contains 00000.

First of all, get the values for which you want to read the long text values. Pass that value to lv_name. And check.

What is the transaction you are using?

Regards,

Swarna Munukoti.

Edited by: Swarna Munukoti on Nov 18, 2009 11:56 AM

Read only

0 Likes
4,552

HELLO Swarna,

thanks fór the reply,

i was told to use call function read text and with tthat the value will be printed .

i am not an abaper so getting difficulty,

i have to print the item text on gr slip ,

how do i pass values to the ebelp and ebeln.

joseph

Read only

0 Likes
4,552

Hello Joseph,

You mentioned - "i have to print the item text on gr slip ,"

You are trying to print the item text of what ?

Regards,

Swarna Munukoti

Read only

0 Likes
4,552

hello,

the concated numbers(ebelp+ebeln) are printed but not the text . i have to print the item text on gr -slip . i am doing it using read_text call function.

My text is stored in the internal table defined in the call function . how do i make data from internal table print on smartform .

any solutions gurus.

joseph

Edited by: joseph_sweden on Nov 19, 2009 12:00 PM

Read only

matt
Active Contributor
0 Likes
4,552

These are not training forums. Thread locked. Please post specific questions. And also note that Smartform/SAPScript questions go in the Form Printing forum.

matt

Read only

Former Member
0 Likes
4,552

Hi Joseph,

The TABLES parameter passed while calling a Function module , combines the features of EXPORTING and IMPORTING parameters.

READ_TEXT will read the text maintained , and fill the itab passed in TABLES parameter. (Before calling FM, itab would be empty)

Let us know if you still face any issues.

Regards,

Nisha Vengal.

Read only

Former Member
0 Likes
4,552

Function module will return texts in LINES table. you need to pass your internal table here.

P.S. - Please see Function Module Documentation of READ_TEXT in SE37.

Rgds,

PB

Read only

0 Likes
4,552

Table LINES should be of type TLINE.

DATA: t_lines TYPE STANDARD TABLE OF tline,

wa_lines TYPE tline. "work area

Use this table in your function call.

,

,

,

tables

lines = t_lines

,

,

,

Regards,

Aparna Gaikwad