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

fetch data using structure with full working example

Former Member
0 Likes
829

does any body tell me how to fetch data using structure with full working example

the structure name is RSTXT and the field is TXLINE

the data in the form of text is entered from the functional side using t-code ME52N

from there i have to fetch the data

in smartform or in report

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
736

In a report, typically the text is retrieved using the READ_TEXT function module. You will have to do the READ_TEXT for each Purchase Requisition Document. You will also need to determine the TEXT_NAME, TEXT_OBJECT and TEXT_ID in order to call this function module. This can often be found within the transaction by getting the technical details of the text.

In smarforms, you can a Text element in your form. On the General Attributes tab, change the Type of the text to I - Include Text. You will see some fields to enter for the Text name, text object and text ID. These are the same values you would use to call the READ_TEXT function.

Regards,

Chris H.

5 REPLIES 5
Read only

Former Member
0 Likes
737

In a report, typically the text is retrieved using the READ_TEXT function module. You will have to do the READ_TEXT for each Purchase Requisition Document. You will also need to determine the TEXT_NAME, TEXT_OBJECT and TEXT_ID in order to call this function module. This can often be found within the transaction by getting the technical details of the text.

In smarforms, you can a Text element in your form. On the General Attributes tab, change the Type of the text to I - Include Text. You will see some fields to enter for the Text name, text object and text ID. These are the same values you would use to call the READ_TEXT function.

Regards,

Chris H.

Read only

Former Member
0 Likes
736

DATA: L_BANFN TYPE BANFN,
      name LIKE thead-tdname,
      tline1 LIKE tline OCCURS 0 WITH HEADER LINE.

CONCATENATE L_BANFN L_ITEM INTO NAME.

  CALL FUNCTION 'READ_TEXT'
    EXPORTING
      client                  = sy-mandt
      id                      = 'B01'
      language                = sy-langu
      name                    = name
      object                  = 'EBAN'
    TABLES
      lines                   = tline1
    EXCEPTIONS
      id                      = 1
      language                = 2
      name                    = 3
      not_found               = 4
      object                  = 5
      reference_check         = 6
      wrong_access_to_archive = 7
      OTHERS                  = 8.

HOPE THIS CODE HELPS

thx

pavan

Read only

Former Member
0 Likes
736

I AM WRITING THIS CODE BUT STILL NOT GETTING THE DESIRED OUTPUT I.E TEXT FROM ME52N

DATA:BEGIN OF TA_ROW,

TXZ01(1000) TYPE C,

END OF TA_ROW.

DATA:BEGIN OF IT_ROW OCCURS 0,

TXZ01(1000) TYPE C,

END OF IT_ROW.

DATA: headerid TYPE TXLINE.

DATA: headerid1 TYPE char24.

DATA: headerid2 TYPE char24.

DATA: thread LIKE thead.

DATA: it_text LIKE RSTXT OCCURS 0 WITH HEADER LINE.

  • DATA: wa_row LIKE ta_row.

  • DATA: temp LIKE eban-banfn.

thread-tdid = 'B01'.

thread-tdname = headerid.

thread-tdobject = 'RSTXT'.

CALL FUNCTION 'READ_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

id = thread-tdid

language = sy-langu

name = thread-tdname

object = thread-tdobject

  • ARCHIVE_HANDLE

  • = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

lines = it_text

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

LOOP AT it_text.

  • CLEAR ta_row.

BREAK-POINT.

ta_row-txz01 = it_text-TXLINE.

APPEND ta_row TO it_row.

ENDLOOP.

WRITE: / IT_ROW.

REFRESH it_text.

clear it_text.

Read only

0 Likes
736

Hi,

change the line

DATA: it_text LIKE RSTXT OCCURS 0 WITH HEADER LINE.

into

DATA: IT_TEXTS like T_LINE occurs 0 with header line.

Check the function module parameters type in SE37 using fm source code and compare with the type you have declared.

Read only

Former Member
0 Likes
736

using this code to get text from ME52N this is a structure still not getting output

DATA:BEGIN OF TA_ROW occurs 0,

TXZ01(1000) TYPE C,

END OF TA_ROW.

DATA:BEGIN OF IT_ROW OCCURS 0,

TXZ01(1000) TYPE C,

END OF IT_ROW.

DATA: thread LIKE thead.

DATA: headerid TYPE char24.

DATA: it_text LIKE tline OCCURS 0 WITH HEADER LINE.

data:wa_banfn like eban-banfn.

thread-tdid = 'B01'.

thread-tdname = headerid.

thread-tdobject = 'EBAN'.

select txz01 from eban into corresponding fields of table ta_row

where banfn = wa_banfn.

headerid = ' '.

CALL FUNCTION 'READ_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

id = thread-tdid

language = sy-langu

name = thread-tdname

object = thread-tdobject

  • ARCHIVE_HANDLE

  • = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

lines = it_text

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

LOOP AT it_text.

CLEAR ta_row.

  • BREAK-POINT.

    • FROM THIS POINT TEXT IS COMING

ta_row-txz01 = it_text-tdline.

APPEND ta_row TO it_row.

ENDLOOP.