Function Module Call Via CMOD Logic For Master Data Enhancement

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Function Module Call Via CMOD Logic for Master Data Enhancement

1 of 6

https://archive.sap.com/discussions/thread/355632

10/27/2016 10:32 AM

Function Module Call Via CMOD Logic for Master Data Enhancement

2 of 6

https://archive.sap.com/discussions/thread/355632

Hi Friends Please help me to resolve this, would really be very kind of all of you.
Requirement. I want to Enhance the field ZFACTREG from VIBDBE table in my datasource 0busentity_attr
extract structure l_s_REIS_BUSENTITY_ATTR, I want to create the logic in CMOD exit_saplrsap_002 to
call my function module for enhancement of master data. Please help me Step by Step
Thanks
Poonam Roy
<b>Step #1</b>
I put this code which gives me error in CMOD like this
ERROR : Das formale Argument 'OTHERS' muss am Schluss der Ausnahmeliste stehen.
ABAP Code#1 IN exit_saplrsap_002
DATA: l_d_fmname(30) TYPE c.
CONCATENATE 'Z_DS_' i_datasource(25) INTO l_d_fmname.
TRY.
CALL FUNCTION l_d_fmname
EXPORTING
I_DATASOURCE = I_DATASOURCE
I_UPDMODE = I_UPDMODE
TABLES
I_T_SELECT = I_T_SELECT
I_T_FIELDS = I_T_FIELDS
I_T_DATA = I_T_DATA
C_T_MESSAGES = C_T_MESSAGES
EXCEPTIONS

10/27/2016 10:32 AM

Function Module Call Via CMOD Logic for Master Data Enhancement

3 of 6

https://archive.sap.com/discussions/thread/355632

EXCEPTIONS
RSAP_CUSTOMER_EXIT_ERROR = 1
OTHERS = 2
IF FOUND.
IF SY-SUBRC <> 0.
RASIE RSAP_CUSTOMER_EXIT_ERROR.
END IF
CATCH CX_SY_DYN_CALL_ILLEGAL_FUNC.
ENDTRY.
<b>Step#2</b>
I simple created the Function module Z_DS_BUSINESS
and put the code in source code which gives me error . what should i put in other tabs like"Import", Export",
Tables" i kept blank
ABAP CODE give me error : The Dictionary structure or table "FIELD-SYMBOLS" is either not active. i
have to remove include in the FM. WHY SO??
FUNCTION Z_DS_BUSINENSS
*"----

""Lokale Schnittstelle:
*" IMPORTING
*" VALUE(I_DATASOURCE) TYPE RSAOT_OLTPSOURCE
*" VALUE(I_CHABASNM) TYPE SBIWA_S_INTERFACE-CHABASNM
*" VALUE(I_UPDMODE) TYPE SBIWA_S_INTERFACE-UPDMODE
*" TABLES
*" I_T_SELECT TYPE SBIWA_T_SELECT
*" I_T_FIELDS TYPE SBIWA_T_FIELDS
*" I_T_DATA
*" C_T_MESSAGES STRUCTURE BALMI OPTIONAL
*" EXCEPTIONS
*" RSAP_CUSTOMER_EXIT_ERROR
*"----

10/27/2016 10:32 AM

Function Module Call Via CMOD Logic for Master Data Enhancement

4 of 6

https://archive.sap.com/discussions/thread/355632

*"----

INCLUDE ZXRSAU02.
WRITE: / 'INSIDE THE Z_DS_MEASUREMENTS PROGRAM'.
TABLES: REIS_BUSENTITY_ATTR,
VIBDBE,
field-symbols:.<fs_REIS_BUSENTITY_ATTR> like REIS_BUSENTITY_ATTR.
DATA: BEGIN OF i_c_t_data OCCURS 0.
include structure REIS_BUSENTITY_ATTR.
DATA END OF i_c_t_data.
DATA: i_c_t_data_copy like i_c_t_data OCCURS 0 WITH HEADER LINE,
begin of i_vibdbe occurs 0,
INTRENO like vibdbe-INTRENO,
ZFACTREG like vibdbe-ZFACTREG,
end of i_vibdbe.
i_c_t_data_copy[] = i_c_t_data[] = c_t_data[].
sort i_c_t_data_copy by vibdbe.
Select INTRENO
into table i_VIBDBE from VIBDBE
for all entries in i_c_t_data_copy
where INTRENO = i_c_t_data_copy- INTRENO.
if sy-subrc = 0.
sort i_VIBDBE by INTRENO.
loop at i_c_t_data assigning <fs_REIS_BUSENTITY_ATTR>.
clear: i_VIBDBE.
read table i_VIBDBE with key INTRENO = <fs_REIS_BUSENTITY_ATTR>-INTRENO
BINARY SEARCH
transporting ZFACTREG .
if sy-subrc = 0.
<fs_REIS_BUSENTITY_ATTR>-ZZFACTORY = i_vibebe-ZFACTREG
endif.

10/27/2016 10:32 AM

Function Module Call Via CMOD Logic for Master Data Enhancement

5 of 6

https://archive.sap.com/discussions/thread/355632

endif.
null

Poonam Roy
March 23, 2007 at 18:26 PM
0 Likes

Sanjay Sinha

replied

March 23, 2007 at 21:13 PM

You need to put your code inside the include ZXRSAU02 and not directly in
function module exit_saplrsap_002 . The same exit is called for all data sources ,
so make sure you put code with "CASE I_DATASOURCE" and use your specific
datasource . Check the below link on enhancing data source using exits. You can
also find some help in transaction SMOD for enhancement RSAP0001 . Go to
Comopnents -> Documentation .
http://help.sap.com/saphelp_nw2004s/helpdata/en/6e
/fe6e420f00d242e10000000a1550b0/frameset.htm
Regards.
Sanjay
0

Poonam Roy

replied March 23, 2007 at 22:31 PM

if i put in cmod it is not good since that cause performance issue if we have
too much code in cmod so i want towrite the call in cmod only suggest only
if you are aware of functionality

10/27/2016 10:32 AM

Function Module Call Via CMOD Logic for Master Data Enhancement

6 of 6

https://archive.sap.com/discussions/thread/355632

too much code in cmod so i want towrite the call in cmod only suggest only
if you are aware of functionality
thanks
0

Raymond Giuseppi

replied
March 23, 2007 at 22:51 PM

Remove the IF FOUND in call function. (originally


perform?)
Use OM_FUNC_MODULE_EXIST to check existence of
function module.
I used a

1.
2.
3.
4.
5.

CASE I_DATASOURCE.
WHEN '0CUSTOMER_ATTR'.
PERFORM 0customer_attr.
...
ENDCASE.

Never get into performance problem. (always SELECT


FOR ALL ENTRIES in SUBROUTINES)
Regards
0

Poonam Roy

replied March 23, 2007 at 23:05 PM

Thanks Please help me understand this, if you can paste the code from
your cmod as sample and also the code from function module how u link
that to code in cmod that would be great help. millions of thanks
in advance
Poonam
0

10/27/2016 10:32 AM

You might also like