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

Simple custom rfc

Former Member
0 Likes
1,194

Hi,

Juz want to try a simple rfc for example to add 2 numbers.

res = a + b.

I know import paramters will be a ,b. Export parameter res. In the source code

res = a + b.

Save and activate.

Am i missing any step >? Urgently needed for custom rfc developement.

Any blogs available to try examples..

Thanks in advance.

<b>Cheers,

*RAJ*</b>

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,155

Hi.

You are getting that error because of your Function Group is inactive.

Goto SE80 enter your function group name press enter then u will get 2 includes.

LZname_of_the_function_groupTOP

LZname_of_the_fuction_groupUXX

Right click on each include and activate it and the Run Your RFC sure it will work.

Reward point if helpful.

ANEES AHMED

9886358645

11 REPLIES 11
Read only

Former Member
0 Likes
1,155

Hi,

Did u check RFC enabled in the attributes of the FM.

Regards,

sankar

Read only

Former Member
0 Likes
1,155

yeah

Read only

Former Member
0 Likes
1,155

Error ->

Program SAPLZTESTGRP 2

REPORT/PROGRAM statement missing, or program type is I (INCLUDE).

Read only

0 Likes
1,155

SOURCE CODE

FUNCTION ZTE.

*"----


""Local Interface:

*" IMPORTING

*" VALUE(A) TYPE INT4

*" VALUE(B) TYPE INT4

*" EXPORTING

*" VALUE(RES) TYPE INT4

*"----


RES = A + B.

ENDFUNCTION.

Any step missing

Read only

Former Member
0 Likes
1,155

Hi,

While creating function module in SE37 Go to Attributes tab, Select Remote-enabled module as Processing type .

Also mark import and export parameters as "Pass By Value" by selecting the check box available for each import/export parameter.

For this error Try to activate the function module + the function group. Go to Se80 and activate the function group.

/Geogy

Read only

0 Likes
1,155

Thanks Geogy done those steps before posting the tread itself ain't working

Read only

Former Member
0 Likes
1,156

Hi.

You are getting that error because of your Function Group is inactive.

Goto SE80 enter your function group name press enter then u will get 2 includes.

LZname_of_the_function_groupTOP

LZname_of_the_fuction_groupUXX

Right click on each include and activate it and the Run Your RFC sure it will work.

Reward point if helpful.

ANEES AHMED

9886358645

Read only

0 Likes
1,155

Thanks dude done 4got the steps long time back.

Juz in case suppose if have to insert the data in the a custom Ztable through rfc then what will be import, export parameters and the source code >?

<b>Cheers,

*RAJ*

**Points already allocated 4 every one thanks again **</b>

Read only

Former Member
0 Likes
1,155

Hi,

If u tel ur requirment clearly then only i can help u.

In general.

take the data in import parameters and then assing that parameters to table field than atlast use the insert statemet to insert the data.

For example u have import parameter name

ur passing value to the name

In progam

call function ztest.

export

name = ' john'.

In function module source code

table decleration all that....

code

ztabel_name -field_name = name (import parameters)

ztabel_name -field_name = if u have anyother parameters (import parameters)

insert ztabel_name.

If helpfull reward point

Anees Ahmed

9886358645

Read only

0 Likes
1,155

K,

We have a custom client dependent table *ztab intially with some parameters. ex mandt, employee, customer, material.

Is there are need to create structure.

Now need a rfc that can insert the data in to these feilds in r/3.

Should i have to define import and export parmeters or use the table tab >?

Source code for inserting the data.

This rfc will further need to be developed as BAPI.

Cheers.

*RAJ*

Read only

Former Member
0 Likes
1,155

Hi,

Yes it is better to creat the structure with required field.

ZSTRCOMPTRACKSUMMARY (is a structure)

(Structure is required if ur using only few field of a single table or fields from diffrent tables)

Use that structure in table parameters of your RFC

CTDETAILS (Table parameters) like ZSTRCOMPTRACKSUMMARY (is structure)

Through the program pass the values to table parametrs (table parameters work as import and export parameters)

then from that parameters update ur Ztable

Pls go through the code.

FUNCTION ZGET_COMPTRACK_SUMMARY_REPORT.

*"----


""Local Interface:

*" IMPORTING

*" VALUE(USERID) TYPE ZUSERID

*" VALUE(FROMDATE) TYPE ZFROMDATE

*" VALUE(TODATE) TYPE ZTODATE

*" TABLES

*" CTDETAILS STRUCTURE ZSTRCOMPTRACKSUMMARY

*"----


DATA : BEGIN OF IT_COMPTRACKHEADER OCCURS 0,

COMPTRACKDATE TYPE ZCOMPTRACKDATE,

COMTRACKID TYPE ZCOMTRACKID,

USERID TYPE ZUSERID,

SMUID TYPE ZSMUID,

BRANDID TYPE ZBRANDID,

END OF IT_COMPTRACKHEADER.

DATA: IT_COMPTRACKDETAIL LIKE ZCOMPTRACKDETAIL OCCURS 0 WITH HEADER LINE.

*****************************************************************************

  • Get COMTRACK Header details for the given user id and DCRDATE period

*****************************************************************************

SELECT * FROM ZCOMPTRACKHEADER INTO CORRESPONDING FIELDS OF TABLE IT_COMPTRACKHEADER

WHERE COMPTRACKDATE BETWEEN FROMDATE AND TODATE.

IF IT_COMPTRACKHEADER[] IS NOT INITIAL.

SELECT * FROM ZCOMPTRACKDETAIL INTO TABLE IT_COMPTRACKDETAIL

FOR ALL ENTRIES IN IT_COMPTRACKHEADER

WHERE COMTRACKID = IT_COMPTRACKHEADER-COMTRACKID.

SORT IT_COMPTRACKDETAIL BY COMTRACKID.

LOOP AT IT_COMPTRACKDETAIL.

READ TABLE IT_COMPTRACKHEADER WITH KEY COMTRACKID = IT_COMPTRACKDETAIL-COMTRACKID.

SELECT SINGLE BRANDFULLNAME FROM ZBRANDMASTER INTO CTDETAILS-BRAND WHERE BRANDID = IT_COMPTRACKHEADER-BRANDID.

SELECT SINGLE COMPCATSHORTNAME FROM ZCOMPCATMASTER INTO CTDETAILS-CATEGORY

WHERE COMPCATEGORYID = IT_COMPTRACKDETAIL-COMPCATEGORYID.

******************************************************************************

  • Get SMU Name from the ID *

******************************************************************************

SELECT SINGLE STEXT FROM HRP1000 INTO CTDETAILS-ORGUNIT

WHERE OBJID = IT_COMPTRACKHEADER-SMUID

AND OTYPE EQ 'O'

AND PLVAR EQ '01'

AND BEGDA LE SY-DATUM

AND ENDDA GE SY-DATUM.

*****************************************************************************

  • Append details to the CTDETAILS structure

*****************************************************************************

CTDETAILS-COMPTRACKDATE = IT_COMPTRACKHEADER-COMPTRACKDATE.

CTDETAILS-COMTRACKID = IT_COMPTRACKHEADER-COMTRACKID.

CTDETAILS-USERID = IT_COMPTRACKHEADER-USERID.

CTDETAILS-REMARKS = IT_COMPTRACKDETAIL-REMARKS.

APPEND CTDETAILS.

CLEAR CTDETAILS.

ENDLOOP.

SORT CTDETAILS BY BRAND CATEGORY.

ENDIF.

ENDFUNCTION.

Reward if usefull.

Anees Ahmed

9886358645