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: 

Can i move a function source to a internal table?

Former Member
0 Kudos

Hi, Experts..

I want to get a internal table that has a function source.

In case of report program, generelly we can get a internal table about report source as follows.

READ REPORT xxxxx  INTO itab.

But i don't know how to get a internal table about function source.

Can i get it?

Help me please. Thanks.

Regards.

ytkim.

1 ACCEPTED SOLUTION

GauthamV
Active Contributor
0 Kudos

Use this logic.


*& Program To Download All The Programs Present In A Package (Dev. Class)
REPORT  z_download_to_desktop.
TABLES: tadir.
TYPES: abapline(255) TYPE c.TYPES: BEGIN OF ty_reposit,
         pgmid    TYPE tadir-pgmid,
         object   TYPE tadir-object,
         obj_name TYPE tadir-obj_name,
         devclass TYPE tadir-devclass,
      END OF ty_reposit.DATA: it_reposit TYPE STANDARD TABLE OF ty_reposit,
      wa_reposit TYPE ty_reposit.DATA: it_repsrc TYPE STANDARD TABLE OF abapline,
      wa_repsrc TYPE abapline.DATA: prog(60)    TYPE c,
      mc_filename TYPE rlgrap-filename,
      filename    TYPE string.
PARAMETERS: p_dev TYPE tadir-devclass.
SELECT pgmid
       object
       obj_name
       devclass
  FROM tadir
  INTO TABLE it_reposit
  WHERE pgmid    = 'R3TR' AND
        object   = 'PROG' AND
        devclass = p_dev.
IF sy-subrc NE 0.
  MESSAGE s001(00) WITH 'No programs available in the given package'.
  EXIT.
ENDIF.
LOOP AT it_reposit INTO wa_reposit.
  prog = wa_reposit-obj_name.
  READ REPORT prog INTO it_repsrc.
  CONCATENATE 'C:\Documents and Settings\Desktop\desktop files'
              prog
              '.txt'
         INTO mc_filename.  filename = mc_filename.
 CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename                = filename
    TABLES
      data_tab                = it_repsrc
      CLEAR prog.
  CLEAR wa_repsrc.ENDLOOP.

  MESSAGE s001(00) WITH 'Check your folder for the Programs downloaded'.

5 REPLIES 5

GauthamV
Active Contributor
0 Kudos

Use this logic.


*& Program To Download All The Programs Present In A Package (Dev. Class)
REPORT  z_download_to_desktop.
TABLES: tadir.
TYPES: abapline(255) TYPE c.TYPES: BEGIN OF ty_reposit,
         pgmid    TYPE tadir-pgmid,
         object   TYPE tadir-object,
         obj_name TYPE tadir-obj_name,
         devclass TYPE tadir-devclass,
      END OF ty_reposit.DATA: it_reposit TYPE STANDARD TABLE OF ty_reposit,
      wa_reposit TYPE ty_reposit.DATA: it_repsrc TYPE STANDARD TABLE OF abapline,
      wa_repsrc TYPE abapline.DATA: prog(60)    TYPE c,
      mc_filename TYPE rlgrap-filename,
      filename    TYPE string.
PARAMETERS: p_dev TYPE tadir-devclass.
SELECT pgmid
       object
       obj_name
       devclass
  FROM tadir
  INTO TABLE it_reposit
  WHERE pgmid    = 'R3TR' AND
        object   = 'PROG' AND
        devclass = p_dev.
IF sy-subrc NE 0.
  MESSAGE s001(00) WITH 'No programs available in the given package'.
  EXIT.
ENDIF.
LOOP AT it_reposit INTO wa_reposit.
  prog = wa_reposit-obj_name.
  READ REPORT prog INTO it_repsrc.
  CONCATENATE 'C:\Documents and Settings\Desktop\desktop files'
              prog
              '.txt'
         INTO mc_filename.  filename = mc_filename.
 CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename                = filename
    TABLES
      data_tab                = it_repsrc
      CLEAR prog.
  CLEAR wa_repsrc.ENDLOOP.

  MESSAGE s001(00) WITH 'Check your folder for the Programs downloaded'.

Former Member
0 Kudos

Hi,

You need to provide the include name of the FM in the Read Report statement..

DATA prog TYPE c LENGTH 30.
DATA itab TYPE TABLE OF string.

prog = 'LZPPUT_TIME_MANAGEMENTU01'.  " ---> FM Include from Function Group

READ REPORT prog INTO itab.
IF sy-subrc EQ 0.

ENDIF.

Former Member
0 Kudos

Hi,

Give the FM include name in the while reading the program...

Former Member
0 Kudos

Hi!

i think we can give a include program name in the read statement of report itself it would solve the problem....

Former Member
0 Kudos

Thanks to your answers...

But i solved the problem myself.

I turned to a program that name is "FDT_CODE_SEARCH" in ecc 6.0

and the program has a 'perform' as follows.

PERFORM scan_devc_fugr  USING u_devc u_index u_count u_cnt_line.

I could solve the problem to analyze 'perform statement' in the above instance.

Thanks.