How to log input parameters for Function Modules?
Hi,
I need to create a Logging system to trace input parameters for function modules.
The log functionality could be done by developing a class method or a function module (For example 'write_log'), and calling it within each function module that I want to log. The 'write_log' code should be independent from the interface of the Function Module that I want to log.
For example, I'd like to write a function/class method that can log both these functions modules:
Function DummyA
Input parameters: A1 type char10, A2 type char10.
Function DummyB
Input parameters: B1 type char20, B2 type char20, B3 type char20, B4 type Z_MYSTRUCTURE
Now the questions...
- Is there a "standard SAP" function that provide this functionality?
- If not, is there a system variable in which I can access runtime all parameters name, type and value for a particular function module?
- If not, how can I loop at Input parameters in a way that is independent from the function module interface?
Thank you in advance for helping!
check this sample code. here i am capturing only parameters (import) values. you can extend this to capture tables, changin, etc.
FUNCTION y_test_fm.
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(PARAM1) TYPE CHAR10
*" REFERENCE(PARAM2) TYPE CHAR10
*" REFERENCE(PARAM3) TYPE CHAR10
DATA: ep TYPE STANDARD TABLE OF rsexp ,
ip TYPE STANDARD TABLE OF rsimp ,
tp TYPE STANDARD TABLE OF rstbl ,
el TYPE STANDARD TABLE OF rsexc ,
vals TYPE tihttpnvp ,
wa_vals TYPE ihttpnvp ,
wa_ip TYPE rsimp .
FIELD-SYMBOLS: <temp> TYPE ANY .
CALL FUNCTION 'FUNCTION_IMPORT_INTERFACE'
EXPORTING
funcname = 'Y_TEST_FM'
* INACTIVE_VERSION = ' '
* WITH_ENHANCEMENTS = 'X'
* IGNORE_SWITCHES = ' '
* IMPORTING
* GLOBAL_FLAG =
* REMOTE_CALL =
* UPDATE_TASK =
* EXCEPTION_CLASSES =
TABLES
exception_list = el
export_parameter = ep
import_parameter = ip
* CHANGING_PARAMETER =
tables_parameter = tp
* P_DOCU =
* ENHA_EXP_PARAMETER =
* ENHA_IMP_PARAMETER =
* ENHA_CHA_PARAMETER =
* ENHA_TBL_PARAMETER =
* ENHA_DOCU =
EXCEPTIONS
error_message = 1
function_not_found = 2
invalid_name = 3
OTHERS = 4
IF sy-subrc = 0.
LOOP AT ip INTO wa_ip .
MOVE: wa_ip-parameter TO wa_vals-name .
ASSIGN (wa_vals-name) TO <temp> .
IF <temp> IS ASSIGNED .
wa_vals-value = <temp> .
ENDIF .
APPEND wa_vals TO vals .
ENDLOOP .
ENDIF.
ENDFUNCTION.
Similar Messages
-
What are the input parameters for Function Module
Dear Experts,
I want to generate a Sales Tax returns report,those fields are not available in my existing Datasources.
For that i want to write a Generic Datasource with Function Module.
audat
bukrs
vkorg
vtweg
spart
aurat
auart
netwr
mwsbp
kschl zedp(consition type)
kschl zvat(condition type)
ksch zcst(condition type)
matkl material group
Here what are the Input parameters for Function Module.
Thanks in Advance.
Srinivasan.Srinivasan-
For creating a Generic extractor based on a FM, you first of all need to know what is going to be your structure.. i.e. what all fields you need to pull from what all tables. A functional consultant may help you identify the exact DB tables.
Once you know them, hand over the requirement and the pdf mentioned by Krishna to the ABAP guy, he would be able to take this up further.
Also decide 1st whether you would be using a full load or delta. There is a slight difference in the way they are built.
Let me know how it goes.
-Bhushan. -
Hi
Im going to use FM: CS_BOM_EXPL_MAT_V2 and I want to only pass WERKS, but when I execute FM is gives exception as CALL_INVALID.
I saw all the Import parameters are Optional, but I think I need to pass more inputs to FM.
Please let me know what are MINIMUM input parameters required to run this FM
ThanksHi
In my requirement, there are range of WERKS and MATNR which has to be given from selection screen, where as In CS_BOM_EXPL_MAT_V2 function module I can only give single value for WERKS and MATNR.
Can any one guide me how can I implement this? -
Input data for Function module SO_OBJECT_SEND for testing
Hi,
can anyone help me in providing the test data for the function module SO_OBJECT_SEND so that i can test it out.
regards.Hi,
Plese check the below link
[http://www.thespot4sap.com/articles/SAP_Mail_SO_Object_Send.asp]
Cheers,
Surinder -
Hi,
I have a Exit function module EXIT_SAPLCVV1_003. i wrote my code in the include and i dont know how to activate it in CMOD. i dont have the user exit name. can anyone tell me how to find user exit for function module.
Regardshi
you should find the enhancement name for your function module exit.
go to CMOD Utilities->SAP Enhancement->extended selection->
give the program name(SAPLCVV1) in Component name field and execute.
it will display the enhancement name.Afterwards u should create the enhancement project.
Steps to create enhancement Project:
1.Goto CMOD.
2.Give project name.->Create
3.Assign the enhancement using the option.
4.select Components and choose change.go to ur code and activate.
5.activate the exit
6.activate the enhancement.
Cheers,
Abdul Hakim
mark all useful answers.. -
How to send input parameters to a file adapter module
Hi all,
i have a requirement like , i need to pick a file from a file server based on a condition. that condition we write in adapter module (in file sender channel).
the condition needs some input , so how can we send input parameters to adapter module.
please suggest me some way,
thanks in advance
jhansihi jhansi,
u define the parameters to send to a module in 'module configuration' (in module tab) by giving the key to identify the module for which u r giving giving the parameters.
for details refer this:
Adapter module
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/02706f11-0d01-0010-e5ae-ac25e74c4c81
This is all u have to do
http://help.sap.com/saphelp_nw04/helpdata/en/8b/895e407aa4c44ce10000000a1550b0/content.htm
[reward if helpful]
regards,
latika. -
Search help(f4) for function module input
can we create a serch help for function module input giving process
Hello basichodary,
You can encapsulate the function module within a program. Include the search help in a parameter statement in the calling program and pass the parameter to the function module. For example, suppose you want to have field i_carrid to have a search help. Use the following code.
report call_function_module.
parameters p_carrid type s_carr_id matchcode object demo_f4_de.
call function 'FUNCTION_MODULE'
exporting
i_carrid = p_carrid
Kind Regards,
Rae Ellen Woytowiez -
Hello friends,
I am displaying values ie, amounts in the screen using write statements here i have to display the
sign left side , i am using Function module 'CLOI_PUT_SIGN_IN_FRONT'
Does anybody help me - How to pass paramter into this Function module.
Regards,
PhaneendraIf you look to the code of the function module, you can see it is condensing the value.
I would make a copy of this function, and remove the condense lines to give the result you want.
data: text1(1) type c.
search value for '-'.
if sy-subrc = 0 and sy-fdpos <> 0.
split value at '-' into value text1.
condense value.
concatenate '-' value into value.
else.
condense value.
endif. -
Looking for Function module through which I can get Logged comments
Hi,
I am new to CRM.
On an activity task we have 'Logged comments' section. I am looking for FM that I could use to import 'Logged comments' for an activity task.
I guess that I can use CRM_ORDER_READ. I was trying to find some documentation but did not find anything. I am not sure which object I should export.
Could anyone help me?
Many thanks,
JanIf you are refering to text called logged comments then use function module READ_TEXT.
Regard. -
How to make use of SE37- Function Module & how to find out the table?
Hi ,
1.Could anyone help me what's this SE37-Function module is all about,How to make use of this?
For Eg,If i want to delete a BOM permanently from the system then I have to use the Function module CM_DB_DEL_FROM_ROOT_BOM.
But after giving the particular name what should i do?
Please help me.
2.How to find out the respective table for a particular field sya for T code-COGI, T code MFBF,where its values are getting populated.,Please help in this issue.
Thanks in adavnce for spending some time
Raj.SHi Raj
Function Modules
Function modules are procedures that are defined in special ABAP programs only, so-called function groups, but can be called from all ABAP programs. Function groups act as containers for function modules that logically belong together. You create function groups and function modules in the ABAP Workbench using the Function Builder.
Function modules allow you to encapsulate and reuse global functions in the SAP System. They are managed in a central function library. The SAP System contains several predefined functions modules that can be called from any ABAP program. Function modules also play an important role during updating and in interaction between different SAP systems, or between SAP systems and remote systems through remote communications.
Unlike subroutines, you do not define function modules in the source code of your program. Instead, you use the Function Builder. The actual ABAP interface definition remains hidden from the programmer. You can define the input parameters of a function module as optional. You can also assign default values to them. Function modules also support exception handling. This allows you to catch certain errors while the function module is running. You can test function modules without having to include them in a program using the Function Builder.
The Function Builder also has a release process for function modules. This ensures that incompatible changes cannot be made to any function modules that have already been released. This applies particularly to the interface. Programs that use a released function module will not cease to work if the function module is changed.
Check this link
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htm
You can execute function module in SE37ie you can perform the activiites defined in the function module by executing it.
By deleting BOM you mention the FM name in se37 and execute. In some function module it will ask input parameters as developed in the program , you have to give the input parameters and execute. -
How to Create a Remotely Enabled Function Module
Hi All,
How to Create a Remotely Enabled Function Module.
I Want to Create a FM Using Sample Data , This for Practice
What Fields can i give in the Import and Export Parameters.
Please Give me one Example
Can Any one Give me the Steps to do this.
Regards
VamsiHi Vamsi,
Lets do simple example where you will first create a RFC in one server (say A) and create normal program in othere server (say B). Finally you will call the RFC in A from B.
Do the following steps for creating RFC in server A.
1. log on to server A
2. go to se37
3. Edit -> function groups-> create function group and give the function group name (say ZGRP).
4. create a FM ( say Z_TEST_RFC) in se37 providing the function group which is created just now.
5. go to attribute tab -> choose remote-enabled module from processing type.
so that your FM will become RFC.
6. provide the import parameter in import tab.
we will provide only two import parameters.
- parameter name : P_NUM1, typing: TYPE, associated type : I & <b>check the pass value</b> (all the parameters of RFC must pass by value).
- parameter name : P_NUM2, typing: TYPE, associated type : I & <b>check the pass value</b>
7. provide the export parameter in export tab.
parameter name : P_SUM, typing: TYPE, associated type : I & <b>check the pass value</b>
8. write the given simple code in source code tab.
FUNCTION Z_TEST_RFC.
P_TOT = P_NUM1 + P_NUM2.
ENDFUNCTION.
Do the following steps for creating ABAP program which will call the RFC in server B.
1. se38 - > creat a program.
2. write the given simple code.
data tot type i.
call function 'Z_TEST_RFC' destination '<b>XXXXXX</b>'
exporting
p_num1 = 10
p_num2 = 15
importing
p_tot = tot.
write tot.
please note that <b>XXXXXX</b> is RFC connection which is avialable in <b>sm59</b> transaction in server A.
-go to sm59 - > abap connection (list of RFC connection configurations are avialable). choose server B connection and replace it of <b>XXXXXX</b> in the code.
finally you can execute the normal abap program that will call the RFC and display the result.
Regards,
Sukhee -
How to write the exceptions in function module
dear all,
how to write the exceptions in function modules with example.
thanq
jyothiHi,
Raising Exceptions
There are two ABAP statements for raising exceptions. They can only be used in function modules:
RAISE except.
und
MESSAGE.....RAISING except.
The effect of these statements depends on whether the calling program handles the exception or not. The calling program handles an exception If the name of the except exception or OTHERS is specified after the EXCEPTION option of the CALL FUNCTION statement.
If the calling program does not handle the exception
· The RAISEstatement terminates the program and switches to debugging mode.
· The MESSAGE..... RAISING statement displays the specified message. Processing is continued in relation to the message type.
If the calling program handles the exception, both statements return control to the program. No values are transferred. The MESSAGE..... RAISING statement does not display a message. Instead, it fills the system fields sy-msgid, sy-msgty, sy-msgno , and SY-MSGV1 to SY-MSGV4.
Source Code of READ_SPFLI_INTO_TABLE
The entire source code of READ_SPFLI_INTO_TABLE looks like this:
FUNCTION read_spfli_into_table.
""Local Interface:
*" IMPORTING
*" VALUE(ID) LIKE SPFLI-CARRID DEFAULT 'LH '
*" EXPORTING
*" VALUE(ITAB) TYPE SPFLI_TAB
*" EXCEPTIONS
*" NOT_FOUND
SELECT * FROM spfli INTO TABLE itab WHERE carrid = id.
IF sy-subrc NE 0.
MESSAGE e007(at) RAISING not_found.
ENDIF.
ENDFUNCTION.
The function module reads all of the data from the database table SPFLI where the key field CARRID is equal to the import parameter ID and places the entries that it finds into the internal table spfli_tab. If it cannot find any entries, the exception NOT_FOUND is triggered with MESSAGE ... RAISING. Otherwise, the table is passed to the caller as an exporting parameter.
Calling READ_SPFLI_INTO_TABLE
The following program calls the function module READ_SPFLI_INTO_TABLE:
REPORT demo_mod_tech_fb_read_spfli.
PARAMETERS carrier TYPE s_carr_id.
DATA: jtab TYPE spfli_tab,
wa LIKE LINE OF jtab.
CALL FUNCTION 'READ_SPFLI_INTO_TABLE'
EXPORTING
id = carrier
IMPORTING
itab = jtab
EXCEPTIONS
not_found = 1
OTHERS = 2.
CASE sy-subrc.
WHEN 1.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno.
WHEN 2.
MESSAGE e702(at).
ENDCASE.
LOOP AT jtab INTO wa.
WRITE: / wa-carrid, wa-connid, wa-cityfrom, wa-cityto.
ENDLOOP.
The actual parameters carrier and jtab have the same data types as their corresponding interface parameters in the function module. The exception NOT_FOUND is handled in the program. It displays the same message that the function module would have displayed had it handled the error.
Or
just have to decide what exceptions u want and under what conditions.
then declarethese exeptions under the exceptions tab.
in the source code of ur function module.
if
like this u can code .
now when u call the function module in tme mainprogram.
if some error occurs and u have declared a exception for this then it will set sy-subrc = value u give inthe call of this fm.
in the fm u can program these sy-subrc values and trigger the code for ur exception.
Please reward if useful
Regards,
Ravi
Edited by: Ravikanth Alapati on Mar 27, 2008 9:36 AM -
RFC Lookup error :No RFC authorization for function module
Hi All,
I have created RFC in the PI system and enabled it as remote. I am working on PI7.1
I have imported RFC into Repository.But when i am trying to execute RFC lookup function in the graphical mapping I am getting No RFC authorization for function module error.
Unhandled RFC exception: <rfc:Z_MAIL_LOOKUP.Exception xmlns:rfc="urn:sap-com:document:sap:rfc:functions"><Name>RFC_ERROR_SYSTEM_FAILURE</Name><Text>No RFC authorization for function module Z_MAIL_LOOKUP.</Text><Message><ID>RFC_ERROR_SYSTEM_FAILURE</ID><Number>341</Number></Message><Attributes><V1>RFC_NO_AUTHORITY</V1></Attributes></rfc:Z_MAIL_LOOKUP.Exception> com.sap.aii.mapping.api.StreamTransformationException: Unhandled RFC exception: <rfc:Z_MAIL_LOOKUP.Exception xmlns:rfc="urn:sap-com:document:sap:rfc:functions"><Name>RFC_ERROR_SYSTEM_FAILURE</Name><Text>No RFC authorization for function module Z_MAIL_LOOKUP.</Text><Message><ID>RFC_ERROR_SYSTEM_FAILURE</ID><Number>341</Number></Message><Attributes><V1>RFC_NO_AUTHORITY</V1></Attributes></rfc:Z_MAIL_LOOKUP.Exception> at com.sap.aii.mappingtool.flib7.RfcLookup.cacheMore(RfcLookup.java:95) at com.sap.aii.mappingtool.tf7.rt.AMultiResIterator$MultiOutIterator.gotoNextContext(AMultiResIterator.java:95) at com.sap.aii.mappingtool.tf7.AMappingProgram.processNode(AMappingProgram.java:315) at com.sap.aii.mappingtool.tf7.AMappingProgram.processNode(AMappingProgram.java:406) at com.sap.aii.mappingtool.tf7.AMappingProgram.start(AMappingProgram.java:496) at com.sap.aii.mappingtool.tf7.Transformer.start(Transformer.java:133) at com.sap.aii.mappingtool.tf7.AMappingProgram.transform(AMappingProgram.java:626) at com.sap.aii.ibrep.server.mapping.exec.ExecuteXiMappingCommand.transformInternal(ExecuteXiMappingCommand.java:197) at com.sap.aii.ibrep.server.mapping.exec.ExecuteXiMappingCommand.execute(ExecuteXiMappingCommand.java:94) at com.sap.aii.ib.server.mapping.exec.CommandManager.execute(CommandManager.java:43) at com.sap.aii.ibrep.server.mapping.ServerMapService.execute(ServerMapService.java:40) at com.sap.aii.ibrep.server.mapping.MapServiceBean.execute(MapServiceBean.java:40) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceedFinal(RequestInvocationContext.java:43) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:166) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatesTransition.invoke(Interceptors_StatesTransition.java:19) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Resource.invoke(Interceptors_Resource.java:71) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.doWorkWithAttribute(Interceptors_Transaction.java:38) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.invoke(Interceptors_Transaction.java:22) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:189) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatelessInstanceGetter.invoke(Interceptors_StatelessInstanceGetter.java:16) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_SecurityCheck.invoke(Interceptors_SecurityCheck.java:21) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_ExceptionTracer.invoke(Interceptors_ExceptionTracer.java:16) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177) at com.sap.engine.services.ejb3.runtime.impl.DefaultInvocationChainsManager.startChain(DefaultInvocationChainsManager.java:133) at com.sap.engine.services.ejb3.runtime.impl.DefaultEJBProxyInvocationHandler.invoke(DefaultEJBProxyInvocationHandler.java:164) at $Proxy1005_10002.execute(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.sap.engine.services.rmi_p4.P4DynamicSkeleton.dispatch(P4DynamicSkeleton.java:234) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:351) at com.sap.engine.services.rmi_p4.server.ServerDispatchImpl.run(ServerDispatchImpl.java:70) at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:62) at com.sap.engine.services.rmi_p4.P4Message.execute(P4Message.java:37) at com.sap.engine.services.cross.fca.FCAConnectorImpl.executeRequest(FCAConnectorImpl.java:872) at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:53) at com.sap.engine.services.cross.fca.MessageReader.run(MessageReader.java:58) at com.sap.engine.core.thread.execution.Executable.run(Executable.java:108) at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:304) Runtime exception when processing target-field mapping /ns0:MT_FileDummy/File; root message: Unhandled RFC exception: <rfc:Z_MAIL_LOOKUP.Exception xmlns:rfc="urn:sap-com:document:sap:rfc:functions"><Name>RFC_ERROR_SYSTEM_FAILURE</Name><Text>No RFC authorization for function module Z_MAIL_LOOKUP.</Text><Message><ID>RFC_ERROR_SYSTEM_FAILURE</ID><Number>341</Number></Message><Attributes><V1>RFC_NO_AUTHORITY</V1></Attributes></rfc:Z_MAIL_LOOKUP.Exception>
13:42:37 End of test
Edited by: Rams on Apr 17, 2009 1:43 PMHi! Rams,
I think the issue is related to Authentification Issue..Even though u did correctly please check once the below
1) Check any Typo Erros are there while configuring or giving names in Lookups.
2) please check Authorizations like ID and PWD and Sufficient Roles
3) Also please check did u given paramters correctly while doing RFC look up I mean paramers , Binding parameters and RFC channel name and adapter type or Simple type it must be an adapter
4) In ID part while configuring Interface determinaition you need to give your RFC look Up name there also..Hence check whether u given or not if yes correctly or not
5) Also remember one thing if your scenario is correct mostly you can know the result in mapping itself it seems while testing Message mapping and Interface mappings give your RFC look up paramters in the parameters tab present in TEST tab and later in Document tab give Input...and execute it works if it doesn;t works and if there is an issue with RFC you can get there only..ok
Also go through the below document::
[https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/20befc9a-aa72-2b10-ae9b-b0988791d457]
I hope this will give u brief idea...
Also check with basis while taking SAP_ALL authorization so that first u ill came to know whether issue is related to authentification or RFC module itself remote enabled and also do SXI_CACHE also ocne to refresh ESR and ID objects..
Regards::
Amar Srinivas Eli -
Creating Includes for Function Modules
Hi Experts,
Can you please let me know how to create includes for function modules.
I came across this in a standard include program, which was generated by a function library. The includes inside this program where linked to the function modules (when I double clicked on them).
Please let me know how to create it.
Thanks in advance !
Regards,
Anand Patil.Hi,
have a look at the code for better understanding
Declaration of Workareas *
DATA: lwa_e1bp2017_gm_item_create TYPE e1bp2017_gm_item_create,
lwa_data TYPE edidd, " Work area for IDOC
lwa_control TYPE edidc. " Work Area for control rec
Read the control data information of idoc.
loop at idoc_contrl INTO lwa_control Where mestyp = lc_mbgmcr.
Extract the data from the segments.
LOOP AT idoc_data INTO lwa_data
WHERE docnum = lwa_control-docnum and
segnam = lc_item_create.
*->> Set the tabix of the internal table
lv_index = sy-tabix.
Move the Material Document Item Segment data
MOVE lwa_data-sdata TO lwa_e1bp2017_gm_item_create.
Modify the material document item data internal table
PERFORM sub_modify_idocdata changing lwa_e1bp2017_gm_item_create.
*->> set the changed values to the IDOC SDATA
MOVE lwa_e1bp2017_gm_item_create TO lwa_data-sdata.
*->> Modify the table
MODIFY idoc_data FROM lwa_data index lv_index.
Clear the Work areas
CLEAR : lwa_data,
lwa_e1bp2017_gm_item_create.
ENDLOOP. "LOOP AT t_idoc_data
Call the BAPI function module to create the
appropriate Material Document
CALL FUNCTION 'BAPI_IDOC_INPUT1'
EXPORTING
input_method = input_method
mass_processing = mass_processing
IMPORTING
workflow_result = workflow_result
application_variable = application_variable
in_update_task = in_update_task
call_transaction_done = call_transaction_done
TABLES
idoc_contrl = idoc_contrl
idoc_data = idoc_data
idoc_status = idoc_status
return_variables = return_variables
serialization_info = serialization_info
EXCEPTIONS
wrong_function_called = 1
OTHERS = 2.
IF sy-subrc = 1.
RAISE wrong_function_called.
ENDIF.
endloop.
ENDFUNCTION.
here when we write the statment
PERFORM sub_modify_idocdata changing lwa_e1bp2017_gm_item_create and double click on sub_modify_idocdata .
it will create a include with the name "LZDTSINT052F_GPOMS_GMF01 ".
now we can write the FORM ..END FORM In this inculde.like this.
***INCLUDE LZDTSINT052F_GPOMS_GMF01 .
*& Form sub_modify_idocdata
Modify the material document item data internal table
FORM sub_modify_idocdata
CHANGING pwa_e1bp2017_gm_item_create TYPE e1bp2017_gm_item_create.
contant declaration
CONSTANTS: lc_261(3) TYPE c VALUE '261'.
DATA : lv_aplzl LIKE resb-aplzl,
lv_aufpl LIKE resb-aufpl,
lv_subrc LIKE sy-subrc,
lv_charg LIKE resb-charg,
lv_uom LIKE pwa_e1bp2017_gm_item_create-entry_uom.
CLEAR: pwa_e1bp2017_gm_item_create-reserv_no,
pwa_e1bp2017_gm_item_create-res_item.
*->> Get SAP storage bin & Storage type from the Z table
SELECT lgtyp lgpla
INTO (pwa_e1bp2017_gm_item_create-stge_type,
pwa_e1bp2017_gm_item_create-stge_bin)
UP TO 1 ROWS
FROM zdtsint050_sttyp
WHERE zstorage_typ = pwa_e1bp2017_gm_item_create-stge_type
AND zstorage_bin = pwa_e1bp2017_gm_item_create-stge_bin.
ENDSELECT.
IF sy-subrc NE 0.
CLEAR: pwa_e1bp2017_gm_item_create-stge_type,
pwa_e1bp2017_gm_item_create-stge_bin.
ENDIF.
PERFORM get_oper CHANGING pwa_e1bp2017_gm_item_create.
Get the Reservation number and Reservation item number
basing on the idoc data.
SELECT rspos werks lgort
INTO (pwa_e1bp2017_gm_item_create-res_item,
pwa_e1bp2017_gm_item_create-plant,
pwa_e1bp2017_gm_item_create-stge_loc)
FROM resb
UP TO 1 ROWS
WHERE rsnum = pwa_e1bp2017_gm_item_create-reserv_no
AND matnr = pwa_e1bp2017_gm_item_create-material
AND charg = pwa_e1bp2017_gm_item_create-batch
AND aufnr = pwa_e1bp2017_gm_item_create-orderid
AND vornr = pwa_e1bp2017_gm_item_create-activity
AND bwart = lc_261.
ENDSELECT.
IF sy-subrc <> 0.
Start of insertion for R31K993797
CLEAR lv_charg.
SELECT rspos werks lgort
INTO (pwa_e1bp2017_gm_item_create-res_item,
pwa_e1bp2017_gm_item_create-plant,
pwa_e1bp2017_gm_item_create-stge_loc)
FROM resb
UP TO 1 ROWS
WHERE rsnum = pwa_e1bp2017_gm_item_create-reserv_no
AND matnr = pwa_e1bp2017_gm_item_create-material
AND charg = lv_charg
AND aufnr = pwa_e1bp2017_gm_item_create-orderid
AND vornr = pwa_e1bp2017_gm_item_create-activity
AND ( splkz = 'X' or
splkz = space )
AND bwart = lc_261.
ENDSELECT.
IF sy-subrc <> 0.
End of insertion for R31K993797
SELECT SINGLE werks lgort
INTO (pwa_e1bp2017_gm_item_create-plant,
pwa_e1bp2017_gm_item_create-stge_loc)
FROM resb
WHERE rsnum = pwa_e1bp2017_gm_item_create-reserv_no.
CLEAR : pwa_e1bp2017_gm_item_create-reserv_no,
pwa_e1bp2017_gm_item_create-res_item.
ENDIF.
ENDIF.
get SAP UOM
SELECT SINGLE zsap_uom
INTO lv_uom
FROM zca_uom_conv
WHERE zext_uom = pwa_e1bp2017_gm_item_create-entry_uom.
IF sy-subrc = 0.
pwa_e1bp2017_gm_item_create-entry_uom = lv_uom.
ENDIF.
ENDFORM. " sub_modify_idocdata
*& Form get_oper
Get the operation
<--P_PWA_E1BP2017_GM_ITEM_CREATE_RE Segment
FORM get_oper CHANGING p_pwa_e1bp2017_gm_item_create TYPE
e1bp2017_gm_item_create.
DATA : l_aufpl LIKE afko-aufpl,
l_aplzl LIKE afvc-aplzl.
REFRESH : i_op.
UNPACK p_pwa_e1bp2017_gm_item_create-orderid TO
p_pwa_e1bp2017_gm_item_create-orderid.
Get the reservation and routing number for the order
SELECT SINGLE
rsnum
aufpl
FROM afko
INTO (p_pwa_e1bp2017_gm_item_create-reserv_no,
l_aufpl)
WHERE aufnr = p_pwa_e1bp2017_gm_item_create-orderid.
IF sy-subrc = 0.
CALL FUNCTION 'CONVERSION_EXIT_NUMCV_INPUT'
EXPORTING
input = p_pwa_e1bp2017_gm_item_create-activity
IMPORTING
output = p_pwa_e1bp2017_gm_item_create-activity.
ENDIF.
ENDFORM. " get_oper
Regards,
nagaraj -
What are the parameters of Function Module
Hi,
What are the parameters of Function Module?Function Modules are special external subroutine stored in a central library. The R/3 system provides numerous predefined function modules that you can call from the ABAP/4 programs.
All the function Modules are created under the Function Groups. Function Groups are nothing but the related group of function modules.
The function modules can be maintained through T.CodeSE37 and T.Code SE80.
In general the function module has the following components.
Documentation:
This is the place where you can find the discription/purpose of the function module.
Import & Export Parameters.
Import parameters correspond to the formal input parameters of subroutines. They pass data from the calling program to the function module.
Export parameters correspond to the formal input parameters of subroutines. They pass data from the function module back to the calling program.
Table Parameters.
Table parameters are internal tables. Internal tables are treated like changing parameters and are always passed by reference.
Exceptions.
Exceptions are used to handle error scenarios which can occur in the function modules. The function modules checks for any type of error and raise exception and returns SY-SUBRC value to the calling program.
Source Code:
the programming logic of the function module is written in this source code.
Rewards if useful.
Maybe you are looking for
-
Screen compatabil​ity help needed
Hi, I have used the T400 for last 4 years and still like it as my laptop. I like it so much in fact that I have just about worn mine out (usb's don't work, keys are wearing out, etc). I recently purchased a very lightly used one on ebay and would l
-
Use my PowerMac G5 + MacPro with 1 Apple 23" Aluminum Display?
While I have a 17" Apple Studio Display (plastic surround) for my PowerMac G5, I'd like to have both computers (MacPro) share the Apple 23" display (aluminum display) so I can free up the 17" Studio Display for my MacBook Pro. I think this can be don
-
Hi! I am working on a Struts-based JSP BC4J application. I have created just one application module in which I have a short method for validating usernames and passwords. The try section of the method is listed below: try String func = "select my_col
-
Hi, I would like to know how the attribute exchange takes place between CAD and SAP system in Document Management. Thanks and Regards, Madhu
-
Tried to erase OS X Yosemite on 2011 Macbook Pro, can't reinstall any OS
Hi there I have a 2011 13" Macbook Pro which was running OS Yosemite. I just tried to erase the hard drive, following the instructions here: OS X Yosemite: Erase and reinstall OS X However, when I got to this step: Select Reinstall OS X, click Contin