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: 

extracting tdname and its routing longtext into a report

kiran_k8
Active Contributor
0 Kudos

Currently I am working on a program which needs to show a report with tdname and its corresponding long text.For that

1.fetched the data w.r.t the client using function module

clientcopy_select_textid_plan

2.then extracting the PLNNR from tdname using offset concept

3.feeding this PLNNR to PLPO table to get the plant details.

4.Now feeding the textid,spras,and tdname and ROUTING to the function module READ_TEXT function module to get the long text.

Upto here I am successfull but I didn't get how to display the long text along with the tdname in the report.

say tdname is 800N500014190000000100000001

when fed to read_text function module it is getting me

some text in 2 or 3 lines.I have to display these 2 or 3 lines against the above given tdname.In the same way for all the tdnames

REPORT ZP.

type-pools:slis.

tables:plpo.

*Internal tables

data: begin of it_stxh occurs 0,

tdobject like stxh-tdobject,

tdname like stxh-tdname,

tdid like stxh-tdid,

tdspras like stxh-tdspras,

plnty like plpo-plnty,

grpno like plpo-plnnr,

werks like plpo-werks,

flag1,

end of it_stxh.

data: begin of it_plpo occurs 0,

plnty like plpo-plnty,

plnnr like plpo-plnnr,

werks like plpo-werks,

end of it_plpo.

data: begin of it_stxftxt occurs 0,

tdformat like stxftxt-tdformat,

tdline like stxftxt-tdline,

end of it_stxftxt.

data:client like sy-mandt,

vlines like sy-index.

ranges : r_werks for plpo-werks.

*Declarations for ALV

DATA:itfieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.

DATA:itrepid TYPE sy-repid.

itrepid = sy-repid.

DATA:itevent TYPE slis_t_event.

DATA:itlistheader TYPE slis_t_listheader.

DATA:walistheader LIKE LINE OF itlistheader.

DATA:itlayout TYPE slis_layout_alv.

DATA:top TYPE slis_formname.

DATA:itsort TYPE slis_t_sortinfo_alv WITH HEADER LINE.

DATA :itsort1 TYPE slis_sortinfo_alv.

DATA:itprintparams TYPE slis_print_alv.

DATA:itvariant TYPE disvariant.

data : title type lvc_title.

field-symbols <fs> type LVC_TITLE.

selection-screen begin of block 1 with frame title text-001.

parameters:p_plnty like plpo-plnty obligatory,

p_werks like plpo-werks obligatory.

selection-screen end of block 1.

at selection-screen.

r_werks-sign = 'I'.

r_werks-option = 'EQ'.

r_werks-low = 'XXXX'.

append r_werks.

r_werks-low = 'YYYY'.

append r_werks.

if p_werks not in r_werks.

message 'Plant should be either XXXX or YYYY' TYPE 'E'.

endif.

perform extraction.

perform display.

form extraction .

*Extracting the TDNAME w.r.t to MANDT

move sy-mandt to client.

CALL FUNCTION 'CLIENTCOPY_SELECT_TEXTID_PLAN'

EXPORTING

cc_sourceclient = client

  • IMPORTING

  • CC_ENTRIES =

tables

textid_tab = it_stxh.

  • EXCEPTIONS

  • SYS_ERROR = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

*Filtering the internal table w.r.t to Task list type 'N'.

loop at it_stxh.

if it_stxh-tdname+3(1) = 'N'.

it_stxh-flag1 = 'X'.

if it_stxh-tdname+4(8) NE SPACE.

move it_stxh-tdname+4(8) to it_stxh-grpno. "PLPNR for comparision.

modify it_stxh.

endif.

endif.

endloop.

delete it_stxh where flag1 = ' '.

*Extracting the Plant w.r.t Routing Group No.

select plnty

plnnr

werks

from plpo

into table it_plpo

for all entries in it_stxh

where plnty = p_plnty

and plnnr = it_stxh-grpno

and werks = p_werks.

sort it_plpo ascending by plnnr.

*Extracting the text w.r.t to the TDNAME extracted using FM

*Clientcopy_select_textid_plan

loop at it_stxh.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

id = 'PLPO'

language = SY-LANGU

name = it_stxh-tdname

object = 'ROUTING'

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

tables

lines = it_stxftxt

  • 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 table it_plpo with key plnnr = it_stxh-grpno

werks = p_werks binary search.

if sy-subrc = 0.

move it_plpo-werks to it_stxh-werks.

endif.

modify it_stxh.

endloop.

delete it_stxh where werks = SPACE.

endform. " extraction

form display .

concatenate 'Routing Operation Text for' p_werks 'in' 'client' client

into title separated by space.

assign title to <fs>.

if it_stxh[] is initial.

message 'No Values exist for the Selection.' TYPE 'S'.

stop.

endif.

DEFINE m_fieldcat.

itfieldcat-fieldname = &1.

itfieldcat-col_pos = &2.

itfieldcat-seltext_l = &3.

itfieldcat-do_sum = &4.

itfieldcat-outputlen = &5.

append itfieldcat to itfieldcat.

clear itfieldcat.

END-OF-DEFINITION.

m_fieldcat 'FLAG1' '' 'Indicator' '' 01.

m_fieldcat 'TDOBJECT' '' 'Application Object-Texts' '' 10.

m_fieldcat 'TDNAME' '' 'Object Name' '' 70.

m_fieldcat 'TDID' '' 'Text ID' '' 04.

m_fieldcat 'TDSPRAS' '' 'Language' '' 02.

m_fieldcat 'WERKS' '' 'Plant' '' 04.

m_fieldcat 'GRPNO' '' 'Group No.' '' 08.

m_fieldcat 'TDLINE' '' 'Application Object-Texts' '' 132.

itlayout-zebra = 'X'.

itlayout-colwidth_optimize = 'X'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

is_layout = itlayout

i_callback_user_command = 'LIST1'

I_GRID_TITLE = <fs>

  • i_callback_top_of_page = ' '

it_fieldcat = itfieldcat[]

i_save = 'A'

  • is_variant = ITVARIANT

it_events = itevent[]

  • is_print = ITPRINTPARAMS

  • it_sort = itsort[]

TABLES

t_outtab = it_stxh

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

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

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

ENDIF.

endform. " display

it_stxh internal table is having all the details of tdname,plnnr,etc and it_stxftxt internal table is having the long text.how to link these two to show in a report?

Do anyone here have an idea?

Thanks,

K.Kiran.

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

Kiran Long Text may be one line ,may be more line.

define another internal table TDNAME, LONGTEXT etc what ever you want.

After getting the long text for a particular TDNAME, you move to the internal table above.

call read_text.
 tdname = tdname
....
...
if sy-subrc eq 0.
LOOP at it_text.
move tdname, longtext to Above declared table. 
and display it for your purpose.


endloop.

2 REPLIES 2

former_member188685
Active Contributor
0 Kudos

Kiran Long Text may be one line ,may be more line.

define another internal table TDNAME, LONGTEXT etc what ever you want.

After getting the long text for a particular TDNAME, you move to the internal table above.

call read_text.
 tdname = tdname
....
...
if sy-subrc eq 0.
LOOP at it_text.
move tdname, longtext to Above declared table. 
and display it for your purpose.


endloop.

0 Kudos

loop at it_plpo.

loop at it_lines where tdname = it_plpo-tdname.

move: it_plpo-werks to it_lines-werks,

  • it_plpo-tempz to it_lines-tempz,

it_plpo-datuv to it_lines-datuv,

it_plpo-plnal to it_lines-plnal,

it_plpo-plnfl to it_lines-plnfl,

it_plpo-vornr to it_lines-vornr,

it_plpo-plnnr to it_lines-plnnr.

modify it_lines.

endloop.

endloop.

I am extracting the routing long text w.r.t task list type and plant.Everything is fine except when moving the some data into the final table it is taking a lot of time.

suppose if it_plpo is having 10 tdnames and each corresponding tdname is having 5 lines of long text(it_lines) then this above piece of code moves the data like plant,date,sequence etc to each and every line havinig that tdname from it_plpo to it_lines internal table.

It is where it is taking time.Even using READ will also take time I guess.Kindly opine.

Thanks,

K.Kiran.