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: 

Retrieving routing long text in Production planning

Former Member
0 Kudos

Hi Experts,

Please tell me the steps and the function modules used for retrieving the routing long text ( which i had created in CA02 ) TRANSACTION .

Regards,

Siva

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi ,

u can use FM READ_TEXT .

u need to know how/what parameters to pass-->

CA02---->Double click on the texts --->it opens TEXT Editor ->GOTO menu->header , by this data u can get texts from READ_TEXT.

regards

prabhu

9 REPLIES 9

Former Member
0 Kudos

hi ,

u can use FM READ_TEXT .

u need to know how/what parameters to pass-->

CA02---->Double click on the texts --->it opens TEXT Editor ->GOTO menu->header , by this data u can get texts from READ_TEXT.

regards

prabhu

0 Kudos

Hi,

Thanks for the quick response,but can u let me know how do i pass the exporting parameter ' NAME',how can i retrieve this value.

CALL FUNCTION 'READ_TEXT'

EXPORTING

language = sy-langu

id = tco09-idord

name = lv_name

object = tco09-objec

TABLES

lines = g_f_long_text

EXCEPTIONS

id = 01

language = 02

name = 03

not_found = 04

object = 05

reference_check = 06.

0 Kudos

Siva,

Please find the details

TEXTID : PLKO

TEXTOBJECT : ROUTING

TEXTNAME : 800N500014190100000001

Cleint(first3)50001419(Routing number)01(Group Counter)+00000001

For item

TEXTID : PLPO

TEXTOBJECT : ROUTING

TEXTNAME : 800N500014190000000100000001

Cleint(first3)50001419(Routing number)

Regards

Vijay Babu Dudla

0 Kudos

For item

TEXTID : PLPO

TEXTOBJECT : ROUTING

TEXTNAME : 800N500014190000000100000001

Cleint(first3)50001419(Routing number)ITENUMBER+Itemnumber.

In the above case it is first item

then 00000001,00000001

if it is second item

00000002, 00000002

0 Kudos

Hi Folks,

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_text......

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

Do anyone here have an idea?

Thanks,

K.Kiran.

0 Kudos

Siva,

Here is the program.




REPORT  ZROUTINGOPERATIONTXTDWNLD.

*&--------------------------------------------------------------------*
*& Tables                                                             *
*&--------------------------------------------------------------------*
 type-pools:slis.
 tables:plpo,plas.
*&--------------------------------------------------------------------*
*& Data Declaration
*&--------------------------------------------------------------------*
*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,
        plnkn like plpo-plnkn,
        zaehl like plpo-zaehl,
        datuv like plpo-datuv, "Valid from date
        werks like plpo-werks,
        tdline like stxftxt-tdline,
        tempz like stxh-tdname,
        flag1,
        end of it_stxh.

  data: begin of it_plpo occurs 0,
        plnty like plpo-plnty,
        plnnr like plpo-plnnr,
        plnkn like plpo-plnkn,
        zaehl like plpo-zaehl,
        datuv like plpo-datuv, "zak
        vornr like plpo-vornr,
        werks like plpo-werks,
        tdname like stxh-tdname,
        tempz like stxh-tdname, "plnnr+plnkn
        plnal like plas-plnal,
        plnfl like plas-plnfl,
        end of it_plpo.


data:client like sy-mandt,
      vlines like sy-index.

types : begin of x_lines,
        werks type plpo-werks,
        tempz like stxh-tdname,    "plnnr+plnkn
        datuv like plpo-datuv,     "latest date
        tdname type stxh-tdname,   " tdname
        tdline type tline-tdline,  " Header Text Lines
        plnal like plas-plnal,     "Group Counter
        plnfl like plas-plnfl,     "Sequence No.
        plnnr like plpo-plnnr,     "Group No.
        vornr like plpo-vornr,     "Operation No.
        end of x_lines.


data : it_tlines type table of tline with header line,
       it_lines type table of x_lines with header line.

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                                                   *
*&--------------------------------------------------------------------*
 selection-screen begin of block 1 with frame title text-001.
 parameters:p_plnty like plpo-plnty obligatory,
            p_werks like plpo-werks obligatory.
 select-options:s_plnnr for plpo-plnnr,   "Group No
                s_plnal for plas-plnal.   "Group Counter
 selection-screen end of block 1.

 at selection-screen.
 r_werks-sign = 'I'.
 r_werks-option = 'EQ'.
 r_werks-low = 'XXXX'. "give the plant here
 append r_werks.
 r_werks-low = 'YYYY'. "give the plant here
 append r_werks.
 if p_werks not in r_werks.
 message 'Plant should be either XYZ or ABCD' TYPE 'E'.
 endif.
start-of-selection.
perform extraction.
perform display.


*&---------------------------------------------------------------------*
*&      Form  extraction
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
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.
       it_stxh-tdname+12(8) to it_stxh-plnkn,
       it_stxh-tdname+20(8) to it_stxh-zaehl,
       it_stxh-tdname+4(16) to it_stxh-tempz.
modify it_stxh.
endif.
endif.
endloop.

*Deleting the records which are NE N
delete it_stxh where flag1 = ' '.


*Extracting the Plant w.r.t Routing Group No.
select plnty
       plnnr
       plnkn
       zaehl
       datuv
       vornr
       werks
       from plpo
       into table it_plpo
       for all entries in it_stxh
       where plnty = p_plnty
       and plnnr = it_stxh-grpno
       and plnkn = it_stxh-plnkn
       and zaehl = it_stxh-zaehl.
sort it_plpo ascending by plnnr.

*To get the latest tdname by comparing plnnr and plnkn
loop at it_plpo.
concatenate: sy-mandt it_plpo-plnty it_plpo-plnnr it_plpo-plnkn
             it_plpo-zaehl into it_plpo-tdname,
             it_plpo-plnnr it_plpo-plnkn into it_plpo-tempz.
modify it_plpo.
endloop.

*Filtering w.r.t the Plant and Group No. in the Selection screen.
 clear it_plpo.
 delete it_plpo where werks NE p_werks or
                      plnnr not in s_plnnr.


*latest tdname
clear it_plpo.
sort it_plpo descending by tempz datuv.
delete adjacent duplicates from it_plpo comparing tempz.
sort it_plpo ascending by tempz datuv.

*To get the corresponding Group Counter and Sequence
clear it_plpo.
loop at it_plpo.
select plnal
       plnfl
       from plas
       into (it_plpo-plnal , it_plpo-plnfl)
       where plnty = p_plnty and
             plnnr = it_plpo-plnnr and
             plnkn = it_plpo-plnkn.
endselect.
modify it_plpo.
endloop.




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

loop at it_plpo.
CALL FUNCTION 'READ_TEXT'
  EXPORTING
   CLIENT                        = SY-MANDT
   id                            = 'PLPO'
   language                      = SY-LANGU
   name                          = it_plpo-tdname
   object                        = 'ROUTING'
*   ARCHIVE_HANDLE                = 0
*   LOCAL_CAT                     = ' '
* IMPORTING
*   HEADER                        =
  tables
    lines                         = it_tlines
* 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.
ELSE.
loop at it_tlines.
it_lines-tdline = it_tlines-tdline.
it_lines-tdname = it_plpo-tdname.
append it_lines.
endloop.
ENDIF.
endloop.



clear: it_plpo,it_lines.
loop at it_plpo.
   loop at it_lines where tdname = it_plpo-tdname.
*   if it_lines-tdname+4(8) EQ it_plpo-plnnr and
*      it_lines-tdname+12(8) EQ it_plpo-plnkn and
*      it_lines-tdname+20(8) EQ it_plpo-zaehl.
   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.
*   endif.
   endloop.
endloop.

endform.                    " extraction
*&-------------------------------------------------------------------*
*&      Form  display
*&-------------------------------------------------------------------*
*       text
*--------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*--------------------------------------------------------------------*
form display .

concatenate 'Routing Operation Text for' p_werks 'in' 'client' client
into title separated by space.
assign title to <fs>.

if it_lines[] is initial.
message 'No Values exist for the Selection.' TYPE 'S'.
stop.
endif.

*Filtering the final internal table w.r.t Group Counter
if s_plnal[] is not initial.
delete it_lines where plnal NOT IN s_plnal.
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 'WERKS'  '' 'Plant'       '' 04.
  m_fieldcat 'PLNNR' ''  'Group No' '' 08.
  m_fieldcat 'PLNAL' '' 'Group Counter' '' 02.
  m_fieldcat 'PLNFL' ''  'Sequence' '' 06.
  m_fieldcat 'VORNR' ''  'Operation No.' '' 04.
  m_fieldcat 'DATUV' ''  'Valid from' '' 08.
  m_fieldcat 'TDNAME' '' 'Object Name' '' 25.
  m_fieldcat 'TDLINE' '' 'Long text'   '' 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_lines
        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.

clear:itfieldcat,it_lines.
endform.                    " display
*&--------------------------------------------------------------------*
*&      Form  list1
*&--------------------------------------------------------------------*
*       ALV Interactive-
*On double clicking TDNAME,it will take us to CA03-Operation View
*---------------------------------------------------------------------*
*      -->R_UCOMM    text
*      -->RS_SELFIELDtext
*---------------------------------------------------------------------*
FORM list1 USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
  CASE r_ucomm.
    WHEN '&IC1'.

      IF rs_selfield-fieldname = 'TDNAME'.
        READ TABLE it_lines INDEX rs_selfield-tabindex.
        SET PARAMETER ID 'PLN' FIELD it_lines-tdname+4(8).
        CALL TRANSACTION 'CA03' AND SKIP FIRST SCREEN.
      ENDIF.
  ENDCASE.
ENDFORM.                                                    "list1

K.Kiran.

rajesh_akarte2
Active Participant
0 Kudos

Hi,

To get the required information u want to transfer in READ_TEXT or Create_Text u can go through the following steps depicted in the given link.

http://abaplovers.blogspot.com/2008/02/function-modules-create-text-and-read.html

Regards,

Rajesh Akarte

tejaswir_7
Explorer
0 Kudos

Hi Kiran thanks for the code it is working to fetch the data for operation long text ,but my scenario is for getting data for header.

i need header long text to be displayed in ALV.

moshenaveh
Community Manager
Community Manager
0 Kudos

tejaswir_7

Hello, While we're happy that you've come to SAP Community to get an answer to your question, you posted your question as an answer in an old thread.
I've converted your answer to a comment, but even so -- posting in older threads is not the best way to get guidance.
If you're looking for help, you should ask a new question: https://answers.sap.com/questions/ask.html.
Here are some tips to help you craft an effective question for our community: https://community.sap.com/resources/questions-and-answers, https://developers.sap.com/tutorials/community-qa.html, https://groups.community.sap.com/t5/welcome-corner-discussions/advice-from-sap-champions-questions-a....
I encourage you to follow this guidance, as I'd really like to see you get a solution to your problem.
I hope you find this advice useful!