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: 

Accessing a progam variable from a function module

mikesenikoglou
Explorer
0 Kudos
152

Hi all,

ABAP newbie here, so excuse the silly questions.

This code calls the GUI_UPLOAD function and stores the the values from a csv file into table type i_load.

My thought is that this table should be globally defined so I can access its contents from another function module that will read records.

FUNCTION YMSEN_DEMO.

*"----------------------------------------------------------------------

*"*"Local Interface:

*"----------------------------------------------------------------------

   call function 'GUI_UPLOAD'

     exporting

       filename = 'c:\temp\infile.csv'

     tables

       data_tab = i_load.

   if sy-subrc <> 0.

     message s368(00) with 'Unable to read file'.

     stop.

   endif.

ENDFUNCTION.


So in my program I defined the table as such


*&---------------------------------------------------------------------*

*& Module Pool       YMSEN_DEMO

*&

*&---------------------------------------------------------------------*

*&

*&

*&---------------------------------------------------------------------*

include ymsen_demotop                           .    " global Data

* INCLUDE YMSEN_DEMOO01                           .  " PBO-Modules

include ymsen_demoi01                           " PAI-Modules

* INCLUDE YMSEN_DEMOF01                           .  " FORM-Routines

data: i_load type table of ymsen_t_load.



But when I activate everything I get an error


                         Field I_load is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement.





1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos
120

Define the data in the top include of the function group, not in the caller program...

(some LyfunctiongroupTOP include)

Hint: Try to double-click the field in the  source and follow pop-up guide. (Also re-read your course material)

Regards,

Raymond

3 REPLIES 3

raymond_giuseppi
Active Contributor
0 Kudos
121

Define the data in the top include of the function group, not in the caller program...

(some LyfunctiongroupTOP include)

Hint: Try to double-click the field in the  source and follow pop-up guide. (Also re-read your course material)

Regards,

Raymond

0 Kudos
120

*&---------------------------------------------------------------------*

*& Include YMSEN_DEMOTOP                                     Module Pool      YMSEN_DEMO

*&

*&---------------------------------------------------------------------*

PROGRAM YMSEN_DEMO.

data: i_load type table of ymsen_t_load.


after tranfering the variable to the top include the problem is the same

0 Kudos
120

Sorry the answer is correct.