Simple Examples on ABAP Objects without using include or function modules
Hi,
I am new to ABAP. I need simple example codes on ABAP Objects. It should not have Includes or Function Modules. Just simple codes, using local & global classes, interfaces etc. I searched the forum and even <<the site that shall not be mentioned>>, but did not find a solution. Kindly help please.
Regards,
Smruthi.
Edited by: Matt on Mar 1, 2009 1:20 PM - forbidden site reference removed
Hello Smruthi
If you go to the Forum Search and choose the forum ABAP Objects then serach for ZUS_SDN and you will find many of my simple sample reports.
These reports usually do not contain any includes but they may call function modules which makes perfectly sense. For example, if you are still doing a direct table SELECT instead of using an available BAPI (or class) to get a business object then this is a clear sign of poor (=non-ABAP-OO) programming.
Regards
Uwe
Similar Messages
-
How to delimit leading zero in vendor number in OO ABAP ALV without using conversion routine
Hi,
How to delimit leading zero in OO ABAP ALV without using conversion routine, because I have many fields like vendor, customer, material number etc..
How to address this leading zero.
I appreciate your quick response.
Regards,
Nalini S.Hi Nalini,
Delimiting leading zeros in fields has to be done via conversion routines, as suggested by Vadamalai you need to pass on the conversion routine name in you field catalog variable.
Now as to which object oriented approach are you using to have your table contents display in ALV as it matters -
Using FACTORY method of CL_SALV_TABLE class, or
Using SET_TABLE_FOR_FIRST_DISPLAY method of CL_GUI_ALV_GRID class.
Using FACTORY method of CL_SALV_TABLE will do your own work, no need to apply any conversion routines or set long/medium/short text for columns as we do in field catalogs!
Cheers,
Varun -
How to convert mm/dd/yy to dd/mm/yy in ABAP PROGRMS without using offsets
how to convert mm/dd/yy to dd/mm/yy in ABAP PROGRMS without using offsets
Do this way..
data: lv_date(8) type c.
write sy-datum to lv_date DD/MM/YY.
or
write:/ sy-datum using edit mask '__/__/__'
Regards,
Santosh
Message was edited by:
Santosh Kumar Patha -
Is there a way to use business objects in the program or function module?
Hi Experts,
Is there a way to use business objects in the program or function module.
Thanks in Advance.
Naval bhattHi Naval,
Ofcourse you can use business objects in your programms/ methods.
You can use function modules or macros (available from include <cntn01>) for using business objects in your application.
refere following two links for startup information
http://www.sap-img.com/abap/reading-attribute-of-a-business-object-in-abap.htm
http://www.jt77.com/business-warehouse/work-flow-12619.html
Regards,
Abhijit -
To use SubRoutines and function modules and include
Hellow Friends ,
Can any body suggest me at waht situations we have to use SubRoutines and function modules and include in an abap report and also i need the standards in an abap program.Hi Rajesh,
You use create subroutines within your programs for those block of codes which are used often within the scope of the development. Function modules are like global subroutines , hence any number programs which might want to use the functionality within the function module can do so.
Creating includes is a good programming prctise, e.g. one for data declerations , one for subroutines, so that it makes the code more reader friendly and also helps in modularizing the program. Also once you put a subroutine in an include, you can use the same subroutine in other programs by referring to the include with the INCLUDE statement in your other programs.
Hence basically they are used for :
1. Reusability
2. Modularization of code (make it more readable)
Hope this is of some help.
Regards,
Aditya -
Last Year MTD/YTD Column Without Using Time Series Function
I need to calculate MTD and YTD of last year without using time series function.
My requirement is like:
We are working on Fiscal year.
Suppose user will select a date: 15-Jan-2013Use a period table with Period Ago attributes and join these to an alias of your fact table. In other words, use a period table (let's say Day is grain) that would have
WAgo, QAgo, YAgo, (etc.) attributes for each day. Join this table to aliases of the fact tables on these columns.
Thanks. -
How do i lock all fields without using the signature function with adobe lifecycle designer 9
How do i lock all fields without using the signature function with adobe lifecycle designer 9 ...
I want it to have the same affect as when a signature is used but not use that function. I want a button that says lock all fields. And then you can click it again to unlock all fields...
ThanksHere you go!
LOCK the form once its SAVEd? -
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. -
Use of BILDSEQUENZ_IDENTIFY Function module
Hi Friends,
what is the use of BILDSEQUENZ_IDENTIFY Function module.. and when we use ???
Regards,ITS_DOWNLOAD is used when trying to download a file via the ITS. For example you have created an ABAP program with the ability to download the file. You then make that program available through the WEBGui or other ITS Service. The function modules mentioned above do a check whether the user is logged in through the ITS or the SAPGui. If it is the ITS, then this function module is called.
I am not sure of the exact issues, but the normal download from SAP Gui does not work through the ITS.
Regards,
Chris -
Is it necessary to use the standard function modules always?
Hi All,
Suppose i can retrieve the BUSINEES PARTNER ID from the table BUT000 with the help of 'BP_GUID' field through a select query statement.
Now is it necessary to use a standard function module to retrieve the same data. what about the performance? which is the better solution. to implement our own code or to use the function module available.
Please someone clarify me about this issue.
Regards,
Sharry.If you'd ask the question in general it's obvious that there is no good answer as it always would depend on the circumstance. However, as you've posted your question in the performance tuning forum, let's look at your question in this context first. I think it's fairly safe to say, that in almost 100% of the cases a standard function module will not be as fast as any well implemented and custom tailored code. If in doubt, just try reading the code of the function module you want to read; most likely you will find lots of unnecessary fluff in there, often they read data that you don't even need.
And as far as buffering is concerned, that can also be an issue. E.g. let's say you do a massive read of distinct business partners and you only need the data once for each partner. Obviously buffering is silly in this case and it might even slow down your program, because the implemented buffering is not necessarily well implemented. I've come across a few cases, where the buffer tables where standard tables with no efficient read access (so no sorted table or hash table) and once tons of data were buffered, it actually took a moment to look up if the record already was buffered (just to find it wasn't there yet).
Now most of the times this slowdown is not an issue as the lookup is still fast compared to the (usually) prevalent database accesses with their slower IO timing. But another factor to consider is memory consumption and why buffer data in memory (and waste it), if you can't use the buffer anyway? So when I do use standard function modules, I usually try to see what they retain in global memory, to better understand if I need to call some initialization/clearing/refresh function...
Note also that often you need to process lots of data, but don't find a standard function module for "mass access", so you need to read your object one by one. Obviously that's another good candidate for implementing your own queries, where you can process the data in packages.
So what might be the reason to use a standard function module? Well, often it's required because the logic is so complex that it would take you too much time to implement it (not to mention that we often simply don't know all the logic that's coded in there). Another advantage is that you might get independent of the data model. E.g. for IDoc interfaces SAP switched in some release the tables where the data is stored. So if you had coded your own queries to get IDoc data, they wouldn't have worked after this particular release upgrade. The standard function on the other hand, checks both the old and new tables, so by using it you would have been fine.
The one major caveat I'd give though is to always check whether the function module is released or at least documented to some degree. I.e. if it's not released, SAP won't support it and does not guarantee that the interface or logic stays the same. In my experience lots of functions I do want to use are not released (or documented), but I will still use them because they seem to be the best alternative in certain scenarios.
Cheers, harald -
How to do data source ehancement by using "Extraction by function module"
I have one customized datasource "ZSOURCE" in R/3, this datasource use Extraction by function module, namely one functiona
module "ZBI_FM_EX"and Extract. struct "ZBI_EX".
Now I want to add one field "ZNEW" from standard SAP table LIKP into extractor "ZBI_EX" and write coding in ZXRSAU01.
Question, could I add new field "ZNEW" into Structure:"ZBI_EX"? Do I need to change anything in functional module "ZBI_FM_EX" itself?
Many Thanks!
rajatina.Hi Dear,
It is good to write the code in your function module i.e. ZBI_FM_EX. becuase writing the code in ZXRSAU01 include program will affect the loading performance. instead of looping the data two time (one in your FM and again in ZXRSAU01 ), you can get the same will only loop.
Thanks
Obaid
Edited by: obaid shaikh on Jan 21, 2011 11:53 AM -
Using subroutines in Function Module
Hi , experts ,
I want to know how to use performs in function module,
If created subroutine must be used in all FM in Func.Group ?
if you have articles about this or any information , I will be glad .
Please help.
Regards,
Tatiana.If i am not mistaken you want to use forms in function module.
To enable forms in function module you have to follow these steps:
Create a Z include in your function module.
INCLUDE ZTEST_INCLUDE.
Inside this include you need to write your form routine which will be accessable from your function module.
Now you can use perform statement in your funtion module.
Thnaks & Regards,
Lalit Mohan Gupta -
Using of SXPG_COMMAND_EXECUTE Function Module.
I am using the below Function Module
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = p_cmnd
operatingsystem = syst-opsys
targetsystem = w_target
stdout = 'X'
stderr = 'X'
terminationwait = 'X'
IMPORTING
status = w_status
exitcode = w_exitcode
TABLES
exec_protocol = t_protocol
EXCEPTIONS
no_permission = 1
command_not_found = 2
parameters_too_long = 3
security_risk = 4
wrong_check_call_interface = 5
program_start_error = 6
program_termination_error = 7
x_error = 8
parameter_expected = 9
too_many_parameters = 10
illegal_command = 11
wrong_asynchronous_parameters = 12
cant_enq_tbtco_entry = 13
jobcount_generation_error = 14
OTHERS = 15.
WRITE :/ 'SY-SUBRC = [', sy-subrc ,']'.
WRITE :/ 'STATUS = [', w_status ,']'.
WRITE :/ 'EXITCODE = [', w_exitcode ,']'.
WRITE :/ 'EXEC_PROTOCOL ='.
But By using the above function module I am getting the SY-SUBRC as equal to '1' and in the import parameters w_status getting as BLANK and T_PROTOCOL as Blank so it is raising the "Problem in executing UNIX command." in my program. Can anybody suggest how can i rectify this problem.
Thanks in Advance.> no_permission = 1
Seems like an authorization problem. Call SU53 immediatly after the failed function call and check with your security or system administrator (authorization object S_LOG_COM).
Thomas -
hi,
can anyone explain the use of this function module, i coudn't find any documentation .
This function module prints the data selected in selection screen.. but i want a breif explanation y we use this and wat for is this....
FM_SELECTION_CRITERIA_PRINTHi,
1. Suppose the requirement is to know the parameters/select-options selected on the selection screen, on the list output (report).
Because once we are on the report output , we wouldnt know the selection parameters made. The only way is to go back & check. Instead of going back we can use this FM to know even when we are on the o/p.
2. Also to take a print of both the report output& selection parameters.
Reward if useful.
Thanks
SMS -
How to get tables used by a Function Module
Hi,
How to know the tables used by a function module dynamically.
Cuurently im using BAPI_MATERIAL_SAVEDATA in my report program.
I tried FM GET_TABLES to know the tables, but could see only tables used in the report.
Main issue in my case is when im running this update program, could observe different tables being displayed as updated in SM50(Process Overview).Want to clarify as why these tables which are not being used in my report are being displayed in SM50.
So was doubtin weather this FM is using these displayed tables.
Thanks in advance for u r replys.
Regards,
DedeepyaHi Dedeepya,
you could use a SQL Trace (tx. ST05) to list all tables affected and operations that realize. Just active the trace, execute FM, and Deactive trace. Then click in "Display trace" and check it.
Best regards,
Pablo
Maybe you are looking for
-
How to use one application with multiple schema without copying application?
Hi, Previously we are using oracle forms and by that we can manage by using a set of folders containing fmx and use different schema/database for different customers. so the source code comes from one individual file but used for different database u
-
A playbook purchase is imminent if I can just figure out if there is an app to allow me to electronically sign my name to pdf documents? I receive multiple doc's during the day that require my approval and having the playbook while I'm on the go is
-
How can i make a JTextField not scroll
i have a JTextField which can show 10 columns, while i setText 20 cols, but i do not want the TextField scroll to show it all, any idea? thx
-
I am using Windows 7 and have been using Firefox for a long time. This the first time this has happened. I am using Firefox 5.
-
Can anyone advise me how to configure the listener on a Solaris platform to start automatically at reboot?