How to create function module to update z tables?
Hi,
I am new to ABAP. I checked the forum but did not find relevant solutions.
I have 2 z tables - ZFLIGHT and ZCUSTOMER. I have a few entries in each table.
I want to write a report to update the entries in the table using function modules. For that I have created a function module - zflight_fm and also a function group- zflight_fg and assigned the function group to the Fm. I do not know how to proceed further, what to put as import, export parameters, tables, changing etc. Further I want exceptions to handle the successful update of the entries.
Thanks and regards,
Smruthi
Steps:
1) Changing --->a) Zflight TYPE ZFLIGHT(DDIC Ref) OR Zflight TYPE ANY TABLE
b) ZCustomer TYPE ZFLIGHT(DDIC Ref) OR ZCustomer TYPE ANY TABLE
2) Execptions:
a) Upload_failed_Flight
b) Upload_Failed_Customer
3) Exporting ---> a) Information what rows are uploaded
Source Code:
Insert Zflight from Zflight(changing parameter).
If insert failed
RAISE Upload_failed_Flight.
endif.
Insert ZCustomer from ZCustomer(changing parameter).
If insert failed
RAISE Upload_failed_Customer.
endif.
Regards,
Gurpreet
Similar Messages
-
How to create function module for getting customer name
Hi Experts,
How to create function module? when in import parameter kunnr values to be passed it must give name1 details according to the customer number...
how to write the logic in source code....
Regards,
Thiru. R1. First of all create function group.
2. Create function module using this function group.
3. If only one kunnr is needed at a time, create import parameter for it. But if many kunnr to be entered at a time,use table.
4. Fetch name1 for each kunnr from KNA1 table.
"->> if many kunnr
if not t_kunnr[] is initial.
select kunnr as kunnr name1 as name1
into table t_kunnr_name1
from kna1
for all entried in table t_kunnr
where kunnr = t_kunnr-kunnr.
endif.
sort t_kunnr_name1 by kunnr name1.
delete adjacent duplicates from t_kunnr_name1 comparing kunnr name1.
table t_kunnr_name1 will contain kunnr and its name1.
I hope logic is clear for you now.
Regards,
Aparna -
How to create function module in abap for VirtualProvider in bi
how to create function module in abap for VirtualProvider in bi ???????????????
can any one help me with simple example ?????????????????
Moderator message : Duplicate post locked. Read forum rules before posting.
Edited by: Vinod Kumar on Jun 15, 2011 4:40 PMHi ,
Thanks for replies about my question??.
If i am using the exit in my char relation ship how can i debugg that exit???
if i am using BPS0 how to do it???If i am using BPS_WB how to do it??
Case1.Variable (type Exit) I known how to do debugg this one in BPS0 but i'm not sure in BPS_WB??
Case2:Char Relation Ship(Type Exit) how to do in BPS0 and BPS_WB??.
Thanks. -
How to use function module to update data
Hello ,
Can any body have idea how we can use function module SAVE_TEXT to update the master recipe header and operation long text.
I want to use this functional module to update the master recipe long text
step by step procedure is highly appreciated
thanks & regards
siddhasrthHi
SAVE_TEXT
SAVE_TEXT writes a text module back to the text file or the text memory, depending on the storage mode of the corresponding text object.
You can use this module either to change existing texts or to create new texts. If you know for sure that the text is new, use the parameter INSERT to indicate this. The system then does not have to read the text first, which improves the performance of the function module.
If the lines table passed with the function module is empty, the system deletes the text from the text file.
Function call:
CALL FUNCTION 'SAVE_TEXT'
EXPORTING CLIENT = SY-MANDT
HEADER = ?...
INSERT = SPACE
SAVEMODE_DIRECT = SPACE
OWNER_SPECIFIED = SPACE
IMPORTING FUNCTION =
NEWHEADER =
TABLES LINES = ?...
EXCEPTIONS ID =
LANGUAGE =
NAME =
check thi sample code
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
HEADER = t_header
SAVEMODE_DIRECT = 'X'
* OWNER_SPECIFIED = ' '
* LOCAL_CAT = ' '
* IMPORTING
* FUNCTION =
* NEWHEADER =
TABLES
LINES = t_long
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5
Reward all helpfull answers
Regards
Pavan -
How to debug function module in update task ?
Hi ,
i have following code :
CALL FUNCTION 'ZSD_t_UPDATE' IN UPDATE TASK
TABLES
it_xvbkd = xvbkd.
Inside this function module i have some code to debug . How can i debug it ?
I put the breakpoint in it but its not working .
It is triggered on save of a tcode .
Thanks and Regards .My home-grown method:
Set your breakpoint in the FM.
In your transaction, just before you press save, enter hobble mode in your command box with '/h'.
press save.
In your first debug screen, toggle settings>system debugging ON (NetWeaver Drop-down menu) or see previous notes for earlier WebAS versions.
Select continue (F8).
The program should then stop at your break-point in the FM. -
How to create function module step by step
hi experts,
i am new to ABAP.
can anybody tell me the step by step process on how to create a function module for adding two numbers without using editor screen.
ex: 2+3=5.Hi,
You can only create function modules and function groups using the Function Builder in the ABAP Workbench. For further information, refer to Creating New Function Modules. This section uses an example to illustrate how a function module is created from the point of view of ABAP programming.
Function Groups and Function Modules:
Firstly, we create a new function group DEMO_SPFLI to hold the function module. Then, we can create the new function module.
Parameter Interface:
You can specify the types of interface parameters in function modules in the
same way as the parameter interfaces of subroutines. Since function
modules can be used anywhere in the system, their interfaces can only contain
references to data types that are declared systemwide. These are the elementary
ABAP data types, the systemwide generic types, such as ANY TABLE, and types
defined in the ABAP Dictionary. You cannot use LIKE to refer to data types
declared in the main program.
Exceptions:
Our function module needs an exception that it can trigger if there are no entries
in table SPFLI that meet the selection criterion. The exception NOT_FOUND
serves this function.
Source Code:
Having defined the parameter interface and exceptions, we can now write the
source code of our function module. To do this, choose Source code in the
Function Builder. This opens the ABAP Editor for the include program
L<fgrp>U<xx> (see Function Groups). This is the include that will
hold the program code for the function module;
Data in Function Modules
You can use the TYPES and DATA statements to create local data types and
objects. The interface parameters also behave like local data objects. In
addition, you can access all of the global data of the main program. This data is
defined in the include program L<fgrp>TOP. To open this include, choose Goto
Global data. The global data behaves like the instance attributes of a class.
The first time you call a function module in a particular function group, the data is
loaded into memory. It can then be accessed and changed by all of the function
modules in the group. The system retains the values until the next time a function
module is called.
Calling Subroutines
You use subroutines for local modularization. Function modules can
also use this technique. The function module that they call are defined in the
corresponding main program.
If you only want to call a subroutine from a single function module, it is best to
define them in the same include program as the function module itself, directly
after the ENDFUNCTION statement. These subroutines can be called from all
function modules in the function group, but for clarity, they should only be called
from the function module that precedes them.
If you want to define a subroutine that will be called from several different function
modules, you can define a special include program for it with the name
L<fgrp>F<xx>.
Raising Exceptions
There are two ABAP statements for raising exceptions. They can only be used in
function modules:
RAISE <except>.
and
MESSAGE..... RAISING <except>.
The effect of these statements depends on whether the calling program handles
the exception or not. If the name <except> of the exception or OTHERS occurs
in the EXCEPTIONS addition of the CALL FUNCTION statement, the exception is
handled by the calling program.
If the calling program does not handle the exception
The RAISE statement terminates the program and switches to debugging mode.
The MESSAGE ..... RAISING statement display the specified message. How the
processing continues depends on 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, SYMSGTY,
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 using MESSAGE...RAISING. Otherwise, the
table is passed to the caller as an exporting parameter.
Regards,
Chandru -
How to create function module in real time
hi experts,
can somebody explain a real time requiremwnt , to create a function module.
its very urgent.
i want elaborately.
regards,
subhasis.hi,
In real time
1. as per my knowledge we create function modules to Inbound IDOC /outbound processing..
2.Interface between a program..
Example we need to take some data from a report say materials and plant and process some bapi and return logfiles to the report we can use FM here too.
To create a function module
First you need to create a function group (function group holds a number of function modules relevant)
SE37>goto>function groups-->create group ..click this create group..
Now in the pop up enter the function groupname Eg: ZW_FG1 plus short text and saveit
Now again goto SE37--> enter new Function module name eg:ZW_FM1
and press F5.
Now again a popup you need to enter
function group name : ZW_FG1
and short test and save it..
Now the Function module is created under the Function group ZW_FG1.
write your export import table parameters and you source code.
rewards if useful
regards,
nazeer
Message was edited by:
nazeer shaik -
Bapi function module to update PRPS table
Hi ,
Presently i have a requirement which needs to update some data from ZIOS table into PRPS table. Can any one tell me what is the Bapi function module for updating data into PRPS table.
<REMOVED BY MODERATOR - REQUEST OR OFFER POINTS ARE FORBIDDEN>
Thanks,
Satish Raju
Edited by: Alvaro Tejada Galindo on Jan 12, 2010 11:46 AMThese ZZ fields are specific to your application, use the EXTENSION parameters.
Look in BAPI_PS_INITIALIZATION documentation, there is an explanation how-to fill specific fields.
For the BAPIs used to create and change project definitions, WBS
elements, networks, activities, and activity elements, you can
automatically fill the fields of the tables PROJ, PRPS, AUFK, and AFVU
that have been defined for customer enhancements in the standard system.
For this purpose, help structures that contain the respective key
fields, as well as the CI include of the table are supplied. The BAPIs
contain the parameter ExtensionIN in which the enhancement fields can be
entered and also provide BAdIs in which the entered values can be
checked and, if required, processed further.
CI Include Help Structure Key
CI_PRPS BAPI_TE_WBS_ELEMENT WBS_ELEMENT
Procedure for Filling Standard Enhancements
Before you call the BAPI for each object that is to be created or
changed, for which you want to enter customer-specific table enhancemen
fields, add a data record to the container ExtensionIn:
o STRUCTURE: Name of the corresponding help structure
+o VALUEPART1: Key of the object + start of the data part+
o VALUEPART2-4: If required, the continuation of the data part
VALUPART1 to VALUPART4 are therefore filled consecutively, first with
the keys that identify the table rows and then with the values of the
customer-specific fields. By structuring the container in this way, it
is possible to transfer its content with one MOVE command to the
structure of the BAPI table extension.
Note that when objects are changed, all fields of the enhancements are
overwritten (as opposed to the standard fields, where only those fields
for which the respective update indicator is set are changed).
Therefore, even if you only want to change one field, all the fields
that you transfer in ExtensionIn must be filled.
You have to use these parameters in BAPI_BUS2054_GETDATA as well as in BAPI_BUS2054_CHANGE_MULTI.
Regards -
How to find function modules used in maintenance table views
Hi,
How do I find the function modules used in maintenance table views?
I'm using SM30 and trying to open the custom table but there is an error message saying CREATE DATA PROCESSING FUNCTION MODULE.
Thanks.
Kathhi
in se80 select functon group and put your table function group name there and click display. it will show you the function modules used for that tables.
Regards
Madhu -
How to save function module in a custom table..
hi experts,
i need your help, how can i save a customize function module into a custom table?is this possible?
i need your reply ASAP..
thanks,
mauHi,
pls chk this links:
Generic extraction via function module blog siggi
/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
Generic extraction via function module
BW genenric delta not TABLE but VIEW
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/d1/801ee8454211d189710000e8322d00/frameset.htm
Re: how to use a function module
http://help.sap.com/saphelp_nw70/helpdata/en/2a/f9ff95493111d182b70000e829fbfe/frameset.htm
**pls assign points,if link is useful*
Regards
CSM Reddy -
Bapi Or Function Module for Updating a table
Can u Plz let me know , is there any bapi or function module to update few fields of a standard table using an internable.
Hi Shiva Kumar Tirumalasetty ,
There is no FM / BAPI to update directly to any SAP tables . SAP won't suggests to develop a FM/BAPI like that , as it will cause some data inconsistency problem .
We have to search and find BAPI's/ FM's for requirement specific if not exists then need to think about the alternate options (LSMW/ BDC etc..)
Hope this answers your question.
Thanks,
Greetson -
Any Bapi or function Module to update standard table
Can u Plz let me know , is there any bapi or function module to update few fields of a standard table using an internable.
I don't know if any FM exists for your requirement. But you may like to copy it into a custom table and modify it according to your enterprise needs.
-
Function module for updating COBRB table
Hi,
Is there any function module to update the entries in COBRB table.
I have already tried the following but it's not updating ithe entries:
1) k_settlement_rule_fill : get the objnr from PRPS and use it for CORBA and COBRB
2) k_settlement_rule_delete : using objnr only
3) k_posting_rule_insert
Regards
PrabhatHi,
Please check this FM K_SETTLEMENT_RULES_UPDATE.
Check FM AUC_SETTLEMENT_POST for sample codes.
Regards,
Ferry Lianto -
How to Create Function Module BAPI_GETGLACCPERIODBALANCES Carry Forward
Dear All,
In SAP there is a Function Module BAPI_GETGLACCPERIODBALANCES to carry forward balance GL account. But in this case GL account (Balance Sheet) that i used (BS200150) using IO Number as is cost object, I want to know if there is a function module standard provide by SAP that can get carry forward balance the GL account per IO Number if in the Year End Closing , we run T-code F.16 to carry forward balance that posting in previous fiscal year, or we have to create a new function module, how to create it?
Kindly help with this issue
Thanks,
Regards
Aries SYes, I tried passing constant '10.000', but still quantity is not getting updated.
My code is:
CALL FUNCTION 'BAPI_CUSTOMERRETURN_CREATE'
EXPORTING
SALESDOCUMENTIN =
RETURN_HEADER_IN = RETURN_HEADER_IN
RETURN_HEADER_INX = RETURN_HEADER_INX
SENDER =
BINARY_RELATIONSHIPTYPE = 'VORA'
INT_NUMBER_ASSIGNMENT =
BEHAVE_WHEN_ERROR =
LOGIC_SWITCH =
TESTRUN =
CONVERT = ' '
IMPORTING
SALESDOCUMENT = SALESDOCUMENT
TABLES
RETURN = RETURN
RETURN_ITEMS_IN = RETURN_ITEMS_IN
RETURN_ITEMS_INX = RETURN_ITEMS_INX
RETURN_PARTNERS = RETURN_PARTNERS
RETURN_SCHEDULES_IN = RETURN_SCHEDULES_IN
RETURN_SCHEDULES_INX = RETURN_SCHEDULES_INX
RETURN_CONDITIONS_IN =
RETURN_CFGS_REF =
RETURN_CFGS_INST =
RETURN_CFGS_PART_OF =
RETURN_CFGS_VALUE =
RETURN_CFGS_BLOB =
RETURN_CFGS_VK =
RETURN_CFGS_REFINST =
RETURN_TEXT =
RETURN_KEYS =
EXTENSIONIN =
PARTNERADDRESSES = -
Hi,
I am trying to create a function module using RSAX_BIW_GET_DATA_SIMPLE as a template. Can someone tell me how can I modify and rename this module. Also, how can I create extract structure from the function module.
I have tried to create a module in the module group by right cliking and then 'create', but it wouldn't let me do that way instead it giving me message 'function module name is reserved for SAP'. I get this message no matter what name I provide.
Basically I am trying to create a function module to extract data from SD module into BW. I appreciate your help with reward.
Thanks,
Rao.Hi,
It is almost the same but a different transaction.
1. Goto SE37.
2. Follow the path
Goto --> Function Group --> Create Group
3. Then enter a function name Z***** and click create.
The following link gives you more information about the functions and groups and others:
http://cma.zdnet.com/book/abap/ch19/ch19.htm
If you are looking for ENHANCEMENT kind of a thing then follow the following path:
1. Log onto R/3
2. TCODE: SMOD
3. Enhancement RSAP0001.
4. Double click on the one you are looking for i.e. Transaction / Master Data.
5. In the Function Module Double click on the INCLUDE.
Hope it helps,
Regards,
GPK.
Message was edited by: Praveen
Maybe you are looking for
-
Error in report builder wizard user interface
I am getting error 'REP-31954: Error in the Report Builder Chart Wizard user interface'. The help subsystem states that I should make sure that the Chart Builder Wizard libraries are properly installed. I am sure they are because all other wizards wo
-
Recover deleted photo's from my Ipad
I deleted a lot of photo's to clean my Ipad1 memory a bit. Some of the photo's though were uploaded directly to the Ipad with the SD card kit and therefor not backed up in iTunes..... What can I do to get these pictures back? I have tried Various too
-
Time Machine vs Backup Clarification
Hello all, I need to reinstall my OS (10.6.8), and recently purchased an external hard drive to backup all my data beforehand. I intend to use Time Machine to backup said data before reinstalling the operating system from the DVD, but want to avoid r
-
Is it possible to reinstall Font Book only?
since I've been having Font Book trouble lately, I wonder if it possible to reinstall Font Book only-
-
Fusion Security, SearchResponse next returning array index out of bound
I am trying to fetch all the roles under a search base and while iterating i am getting array index out of bound exception. SimpleSearchFilter filter=store.getSimpleSearchFilter(RoleProfile.NAME,SimpleSearchFilter.TYPE_EQUAL,null); String wildCardCha