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

Method calls and IMPORTING parameters

Former Member
0 Likes
1,309

I took the BC400 class awhile ago and am getting some free time to go back over the material in the class. Since I'm not an SAP dev by day I didn't have the opportunity to use the material right away. I'm finding it quite difficult to do this considering I don't have a training environment setup but I'll manage.

My question relates to method calls and the use of the importing and exporting statements. Please see the code snippet below. I've removed much of the code that I don't have questions on. The method call is meant to get a list of all connections from some database table and store it in an internal table gt_connections. Why is it doing this using an IMPORTING statement? I thought the purpose of the IMPORTING statement is to pass values to the called method and then use the EXPORTING statement to assign the values passed back to the calling method to some sort of data object.

TRY.
  CALL METHOD cl_bc400_flightmodel=>get_connections
    IMPORTING
      et_connections = gt_connections.
  CATCH cx_bc400_no_data.
    WRITE: / 'No data found!'(ndf). 
ENDTRY.

SORT gt_connections ASCENDING BY deptime.

LOOP AT gt_connections INTO gs_connection.
  WRITE: / gs_connection-carrid,
          ...
          ...
          ...
ENDLOOP.

1 REPLY 1
Read only

Former Member
0 Likes
1,094

After taking a look at the material in the manual in more detail I realized that I had it backwards. IMPORTING is used to receive values back from the called method/function module. EXPORTING is used to send values from the caller.

Edited by: Chuck DiRaimondi on Oct 26, 2010 4:52 PM