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: 

HOW TO USE FUNCTION MODULE

Former Member
0 Kudos
203

Hi friends,

i have one function module which converts the number of Seconds into TIME format( HH:MM:SS)..

the function module name is :MONI_TIME_CONVERT

for this we need to give the seconds as input.. that function module will convert those and it will give the out put..

how can we define as variables.. and can u give me the code for using this FM..

how many variables can we decalr.. and how..?

regards

Babu

1 ACCEPTED SOLUTION

Former Member
0 Kudos
126

Hi BABU,

example code:

data: hh like sy-tabix, gg like SWL_PM_CVH-DURATION.

move 30 to hh.

CALL FUNCTION 'MONI_TIME_CONVERT'

EXPORTING

ld_duration = hh

IMPORTING

LT_OUTPUT_DURATION = gg

.

write:/ gg.

Reward if useful.

Regards,

Sachin

8 REPLIES 8

Former Member
0 Kudos
126

Hi Babu,

Use the Pattern Button that is available in the ABAP Editor (SE38). After clicking the Pattern Button you shall be asked for the function module name. Enter the name of the Function module and press enter. Inside your editor the code for that function module call gets generated. You need to just call the function module using the parameters that is defined in the function module code.

<b>Reward points if this helps,</b>

Kiran

former_member188827
Active Contributor
0 Kudos
126

go to se37.write name of the function module and click on display.

declare ur varaibles according to the types of import and export parameters variables.

0 Kudos
126

hi ,

that i know in se37 checking.. but i want to use the same thing in my program..

for that what can write additinally.. along with the calling of that function module..

i means.. import and export parameters..

and how can define the variables for giving import and export ...

regards

Babu

0 Kudos
126

Hi Babu,

Check out my message in detail that is posted above,

Kiran

former_member588853
Active Contributor
0 Kudos
126

Hi,

pass the No of seconds in LD_DURATION

and you get out put in LT_OUTPUT_DURATION in hours.

Copy paste the program below

<b>data: lv_in type sytabix,

lv_out type SWL_PM_CVH-DURATION.

lv_in = '76'. "76 seconds output should be 1 hrs 16 minutes

CALL FUNCTION 'MONI_TIME_CONVERT'

EXPORTING

ld_duration = lv_in

IMPORTING

LT_OUTPUT_DURATION = lv_out

.

write lv_out.</b>rewards if useful,

regards,

Nazeer

Former Member
0 Kudos
127

Hi BABU,

example code:

data: hh like sy-tabix, gg like SWL_PM_CVH-DURATION.

move 30 to hh.

CALL FUNCTION 'MONI_TIME_CONVERT'

EXPORTING

ld_duration = hh

IMPORTING

LT_OUTPUT_DURATION = gg

.

write:/ gg.

Reward if useful.

Regards,

Sachin

0 Kudos
126

hi sachin can i use.. parametrs statement insted of moving the data directly.. user needs to ener the value..

regards

Babu

0 Kudos
126

Hi Babu,

You can use parameters instead of data variables in your code. Just write parameters statement instead of data statement in your report and pass this parameter to ld_duration.

Check this code.

<b>PARAMETERS: P_HH LIKE SY-TABIX.</b>

DATA: gg like SWL_PM_CVH-DURATION.

CALL FUNCTION 'MONI_TIME_CONVERT'

EXPORTING

<b>ld_duration = P_HH</b>

IMPORTING

LT_OUTPUT_DURATION = gg.

write:/ gg.

Thanks,

Vinay