07-12-2006 9:18 AM
HI ALL,
How can we call a function module from a program? Do we need to copy the definition (i.e. importing ,exporting ...etc) in the calling program ?
especilly i want to know ,how to call BDC_OPEN_GROUP in a BDC program.
07-12-2006 9:21 AM
Hai Geetha
Just put the cursor at the start of the line where ever you want to insert the Function module
press 'Ctrl+F6'
give 'BDC_OPEN_GROUP' and press enter
then you will pass mandatory parameters
Thats it
Check this as bellow
form open_group.
call function 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
DEST = FILLER8
GROUP = 'SRINU_PPP'
HOLDDATE = FILLER8
KEEP = 'X'
USER = sy-uname
RECORD = FILLER1
PROG = SY-CPROG
IMPORTING
QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform.
Thanks & regards
Sreenivasulu P
07-12-2006 9:20 AM
Hello,
In the abap editor click the Pattern button in the Application tololbar.
Click the CAll function radio button and give the name of the FM u want to call in the report.
If useful reward points.
Regards,
Vasanth
07-12-2006 9:21 AM
Hai Geetha
Just put the cursor at the start of the line where ever you want to insert the Function module
press 'Ctrl+F6'
give 'BDC_OPEN_GROUP' and press enter
then you will pass mandatory parameters
Thats it
Check this as bellow
form open_group.
call function 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
DEST = FILLER8
GROUP = 'SRINU_PPP'
HOLDDATE = FILLER8
KEEP = 'X'
USER = sy-uname
RECORD = FILLER1
PROG = SY-CPROG
IMPORTING
QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform.
Thanks & regards
Sreenivasulu P
07-12-2006 9:23 AM
Hi,
You can write
CALL FUNCTION <function-module name>.
and write the importing and exporting parameters if required.
The easiest way to call is:
Click on the Pattern tab in the toolbar and write the fuction module namein the text box adjacent to the 'call' label.
You can call your BDC fuction module name also like that.
Regards,
Sangeeta.
07-12-2006 9:28 AM
Hi Geeta,
the above post it's perfect.
I post you a little exapmle
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING CLIENT = SY-MANDT
"name of session you find in SM35
GROUP = GROUP
"the sap user who creates the session
USER = USER
"'X' if you want to keep the session
after start it
KEEP = KEEP
" Session locked until specified date
HOLDDATE = HOLDDATE.
bye
enzo