cancel
Showing results for 
Search instead for 
Did you mean: 

Call Function in Web Dynpro

Former Member
0 Kudos

Hi all, does anyone know how to call function 'RH_GET_DATE_DAYNAME' in WDDOINIT?

Regards,

YC

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

hi,

u can use the code wizard(control+F7) for the same,it is the same as you do in normal ABAP functions..

regards,

Amit

Former Member
0 Kudos

Hi Amit, so in order to use that wizard. Do I need to create a Call Service in the controller?

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Really for calling such a simple function module using the service call wizard is quite a waste. Just call the function module with normal ABAP coding as you would in any other application type.

Former Member
0 Kudos

Hi all, thanks for your advice and I'm a little bit confuse. So far I know there are three approach to call function in web dynpro. This first one is call using Pattern, second is Code Wizard, and the third one is using Service Call. But what is the differences between them? Thanks.

Regards,

Calvert

Former Member
0 Kudos

Hi YC,

see.. for example you have some FM or BAPI or Class method already there, now that you want to use in webdynpro,

so by using SERVICE CALL option you can use this.

Generally, WD is MVC pattern, so bussiness logic statements like SELECT, MODIFY, INSERT like commands directly

not use in webdynpro methods, for this we create any FM or Class method and use those FM in webdynpro using

SERVICE CALLS.

Check this example for your understand..

http://wiki.sdn.sap.com/wiki/display/WDABAP/WebdynproApplicationtocalltwoBAPIsfordisplayingtheFlightdetailsusingtab+strips

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/9cb5d345-0801-0010-6a8e-fc57c23fd...

And read this..

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/a189b0ee583b8be10000000a421937/frameset.htm

->using CALL FUNCTION you can call any FM in webdynpro abap.. same works with pattern too.

Cheers,

Kris.

Edited by: kissnas on Mar 9, 2011 7:00 AM

Answers (2)

Answers (2)

gill367
Active Contributor
0 Kudos

Hi

you can create a service call for the FM.

for this

right click on the web dynpro comp.

then choose create -> serivc call.

continue .

then choose existing controller and click continue.

select function module radio button and continue

give the FM name and continue

then make the import and export parameter either context or attirbute.

continue and finish .

then one method will be created with name execute_<FM name> in the comp controller.

also there will be correspongind context attribute created.

fill those attributes and call this method in the wddoinit.

thanks

sarbjeet singh

Former Member
0 Kudos

Hi YC,

Just put curson in wddoint method click on pattern .. give FM name ..yo get FM

CALL FUNCTION 'RH_GET_DATE_DAYNAME'

EXPORTING

LANGU =

DATE =

  • CALID =

  • IMPORTING

  • DAYNR =

  • DAYTXT =

  • DAYFREE =

  • EXCEPTIONS

  • NO_LANGU = 1

  • NO_DATE = 2

  • NO_DAYTXT_FOR_LANGU = 3

  • INVALID_DATE = 4

  • OTHERS = 5

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Cheers,

Kris.