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

passing parameters

Former Member
0 Likes
587

how you pass the parameters in function modules and subroutines?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
548

You can get the pattern of the function from the PATTERN button of the EDITOR and then just pass the variable names against the parameters

For Subruoutine, you call that using a PERFORM and pass the parameters along with it.

Example

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db979d35c111d1829f0000e829fbfe/content.htm

Regards,

Ravi

Note Please mark all the helpful answers

3 REPLIES 3
Read only

Former Member
0 Likes
549

You can get the pattern of the function from the PATTERN button of the EDITOR and then just pass the variable names against the parameters

For Subruoutine, you call that using a PERFORM and pass the parameters along with it.

Example

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db979d35c111d1829f0000e829fbfe/content.htm

Regards,

Ravi

Note Please mark all the helpful answers

Read only

Former Member
0 Likes
548

Hi,

For Function modules..

-


Example for passing parameter to GUI_DOWNLOAD.

DATA: T_DOWNLOAD(100) OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'C:\TEST.TXT'

tables

data_tab = T_DOWNLOAD

EXCEPTIONS

FILE_WRITE_ERROR = 1

NO_BATCH = 2

GUI_REFUSE_FILETRANSFER = 3

INVALID_TYPE = 4

NO_AUTHORITY = 5

UNKNOWN_ERROR = 6

HEADER_NOT_ALLOWED = 7

SEPARATOR_NOT_ALLOWED = 8

FILESIZE_NOT_ALLOWED = 9

HEADER_TOO_LONG = 10

DP_ERROR_CREATE = 11

DP_ERROR_SEND = 12

DP_ERROR_WRITE = 13

UNKNOWN_DP_ERROR = 14

ACCESS_DENIED = 15

DP_OUT_OF_MEMORY = 16

DISK_FULL = 17

DP_TIMEOUT = 18

FILE_NOT_FOUND = 19

DATAPROVIDER_EXCEPTION = 20

CONTROL_FLUSH_ERROR = 21

OTHERS = 22

.

For subroutines..

-


  • Single values.

PERFORM DISPLAY_MATERIAL USING V_MATNR.

FORM DISPLAY_MATERIAL USING LV_MATNR TYPE MATNR.

WRITE: / LV_MATNR.

ENDFORM.

  • internal table.

DATA: T_MARA LIKE MARA OCCURS 0 WITH HEADER LINE.

PERFORM DISPLAY_MATERIAL USING T_MARA.

FORM DISPLAY_MATERIAL USING LT_MARA LIKE T_MARA.

LOOP AT LT_MARA.

WRITE: / LT_MARA-MATNR.

ENDLOOP.

ENDFORM.

Thanks,

Naren

Read only

Former Member
0 Likes
548

Hi,

To pass parameters in a Function when u go to SE37 and type the program names you need to select the Improt tab where you can define the parameters that you wish to pass.

These variables are the variables which will have to be mentioned in the main program while calling the function.

The Import variables for func will not be changed unless they are exported.

while passing the value to the subrouines you can do it by going n mentioning in the Perform and Form statement which will need to be ensured that the variable is either passed by value or by reference.

when in Form clause if the variable is mentioned as passed by value then the value will not be reflected in the main program

I guess tht is almost rite

hope it helps..................

cheers

Janak