- 10 basic steps to create Enhancement Spot/ BADI
- How are RANGES different from SELECT-OPTIONS?
- How do I download data in my internal table in a CSV file?
- How can I get the IP address of the system programmatically?
- How can I download my internal table into an Excel file?
- How can I read an Excel file from presentation server?
- How can I convert numerals into the corresponding text?
- How can I solve dump due to insufficient memory (SELECT)?
- How can I access parameters to MACROS?
- How do I create a long text for a document?
- How do I display / add the Terms and Conditions to the business document?
- How to convert from one currency value to other?
- How do I send e-mail?
- How do I receive and process e-mail?
- How do I generate PDFs?
- How to calculate last date of the month?
- How to change the deadline of the workitem programmatically in SAP?
- How to convert a date to internal or external format?
- How to find BADI/Exit calls in any transaction?
- What is this new transaction 'n' all about?
- What does ABAP stand for?
- What does R/3 stands for?
- Where are the long texts of a document stored and how to access the same?
- Where does the ABAP program run?
- When selection-screen output will use?
What is this new transaction 'n' all about?
It is actually a quickstart transaction for Standard business process. For example if you take Purchase order creation ME21 you have to go through different screens( header data, item data) where as in the new enjoy transaction ME21n it can be found in single screen itself. BDC's wont work in Enjoy Transactions, you have to use BAPI.
What does ABAP stand for?
ABAP currently stands for Advanced Business Application Programming; however the original meaning was Allgemeiner Berichtsaufbereitungsp rozessor, which is German for "generic report preparation processor"
A different explanation is Anfänger Basteln An Programmen, which is german for "beginners tinker with programs"
It is a structured language like C.
What does R/3 stands for ?
R/3 stands for Real time data processing / 3 tier architecture (as against mainframe's 2 tier architecture).
Where does the ABAP program run?
The processing logic of an application program, written in ABAP, is processed by the ABAP Interpreter.
More information can be found here.
How are RANGES different from SELECT-OPTIONS?
They are the same, except SELECT-OPTIONS will provide an interface
on the selection screen for the user to input data.
How to convert a date to internal or external format?
Use the functions modules CONVERT_DATE_TO_EXTERNAL or CONVERT_DATE_TO_INTERNAL
to convert the date. When converting to external format, the date format from the user's user profile will be used.
When converting to internal format, the result will be in YYYYMMDD format.
How do I download data in my internal table in a CSV file?
Use the Function Module SAP_CONVERT_TO_CSV_FORMAT to convert the internal table into Comma seperated format then download this
internal table using the Function Module GUI_DOWNLOAD.
See a sample program below:Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
TYPE-POOLS: truxs. TYPES: BEGIN OF ty_Line, vbeln LIKE vbap-vbeln, posnr LIKE vbap-posnr, END OF ty_Line. ty_Lines TYPE STANDARD TABLE of ty_Line WITH DEFAULT KEY. DATA: itab TYPE ty_Lines. DATA: itab1 TYPE truxs_t_text_data. SELECT vbeln posnr UP TO 10 ROWS FROM vbap INTO TABLE itab. CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT' EXPORTING i_field_seperator = ';' TABLES i_tab_sap_data = itab CHANGING i_tab_converted_data = itab1 EXCEPTIONS conversion_failed = 1 OTHERS = 2. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. CALL FUNCTION 'GUI_DOWNLOAD' EXPORTING filename = 'C:\TEMP\test.txt' TABLES data_tab = itab1 EXCEPTIONS OTHERS = 1.
How can I get the IP address of the system programmatically?
You can use cl_gui_frontend_services to get the system IP address.Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
DATA ip_addr TYPE c LENGTH 50. CALL METHOD cl_gui_frontend_services=>get_ip_address RECEIVING ip_address = ip_addr EXCEPTIONS cntl_error = 1 error_no_gui = 2 not_supported_by_gui = 3 OTHERS = 4.
DATA terminal LIKE USR41-TERMINAL. CALL FUNCTION 'TERMINAL_ID_GET' EXPORTING USERNAME = sy-uname IMPORTING TERMINAL = terminal.
How can I download my internal table into an Excel file?
Use the function module SAP_CONVERT_TO_XLS_FORMAT to download the internal table to an excel file.Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
PARAMETERS: p_file LIKE rlgrap-filename DEFAULT 'c:\tmp\test.xls'. DATA: t100_Lines TYPE STANDARD TABLE OF t001 WITH DEFAULT KEY. SELECT * FROM t001 INTO TABLE t100_Lines. CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT' EXPORTING i_filename = p_file TABLES i_tab_sap_data = t100_Lines.
Or get much more control by creating an XML file
How can I read an Excel file from presentation server?
You can use the Function module ALSM_EXCEL_TO_INTERNAL_TABLE to read the Excel file into the internal table of type alsmex_tabline.
From this internal table you can fill the target internal table.
TYPES: BEGIN OF ty_upload, field1 TYPE c length 12, field2 TYPE c length 12, field3 TYPE c length 12, END OF ty_upload. DATA it_upload TYPE STANDARD TABLE OF ty_upload WITH DEFAULT KEY. DATA wa_upload TYPE ty_upload. DATA itab TYPE STANDARD TABLE OF alsmex_tabline WITH DEFAULT KEY. FIELD-SYMBOLS: <wa> type alsmex_tabline. CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE' EXPORTING filename = filename i_begin_col = 1 i_begin_row = 1 i_end_col = 3 i_end_row = 65535 TABLES intern = itab. LOOP AT itab ASSIGNING <wa>. CASE <wa>-col. WHEN '0001'. wa_upload-field1 = <wa>-value. WHEN '0002'. wa_upload-field2 = <wa>-value. WHEN '0003'. wa_upload-field3 = <wa>-value. ENDCASE. APPEND wa_upload TO it_upload. CLEAR wa_upload. ENDLOOP.
How can I convert numerals into the corresponding text?
Use the Function Module SPELL_AMOUNT to convert the integer into text.Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
DATA v_int TYPE i VALUE '1000'. DATA words LIKE SPELL. CALL FUNCTION 'SPELL_AMOUNT' EXPORTING AMOUNT = v_int LANGUAGE = SY-LANGU IMPORTING IN_WORDS = words . WRITE words-word.
How can I solve dump due to insufficient memory (SELECT)?
I am using a SELECT query on a database table. Since the number of records in the table is very large,
the program dumps due to insufficient memory. How can I solve this?
In this case you could use the PACKAGE SIZE addition in the SELECT query to process in limited amount of data,
thus avoiding the memory overloads.
Eg:Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
SELECT * FROM <table> INTO TABLE itab PACKAGE SIZE <n>. IF sy-subrc EQ 0. \*" Process the n records ENDIF. ENDSELECT.
How can I import and export my ABAP developments?
SAPlink is an opensource community project that makes it easy to share ABAP developments between programmers.
It provides the ability to easily distribute and package custom objects.
Where are the long texts of a document stored and how to access the same?*
The long texts of a document are stored in a encrypted format in the STXH and STXL tables, where STXH stores the header information of the
long text like TDOBJECT, which indicates which text object the long text belongs to, TDID which indicates the Text ID and TDNAME which is
the actual name of the long text.
As these texts are stored in a encrypted format, the text cannot be read using a SELECT statement. You will have to use the function READ_TEXT. The easiest way of getting to know the parameter values is to go to a document, open the long text in a full screen mode. For example, when you wan to see the long text for a Purchase order, go to transaction ME23n. Assume, you want to see the parameters for the Header Text. In the first Tab Strip Control, click on the Texts tab and select the Header Text node on the left hand side, which will display the text on the right hand side. Now, double click on the text editor on the right hand side. This will open the text in the full screen mode. In the menu Go To --> Header, you should be able to see the values for all the three parameters we discussed above. We will have to do the same thing for whichever text parameters we want to see.Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
CALL FUNCTION 'READ_TEXT' EXPORTING * CLIENT = SY-MANDT ID = LANGUAGE = NAME = OBJECT = * ARCHIVE_HANDLE = 0 * LOCAL_CAT = ' ' * IMPORTING * HEADER = TABLES LINES = * EXCEPTIONS * ID = 1 * LANGUAGE = 2 * NAME = 3 * NOT_FOUND = 4 * OBJECT = 5 * REFERENCE_CHECK = 6 * WRONG_ACCESS_TO_ARCHIVE = 7 * OTHERS = 8 . IF SY-SUBRC <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF.
How do I create a long text for a document?*
Please refer to the important parameters that are discussed in the previous question of reading texts. We will need the same parameters for saving the text as well. The function modules that you can use for this will be SAVE_TEXT followed by COMMIT_TEXT. The parameters play a very important roles as you might not see the saved text in the standard transaction if you give wrong parameter values.Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
CALL FUNCTION 'SAVE_TEXT' EXPORTING * CLIENT = SY-MANDT HEADER = * INSERT = ' ' * SAVEMODE_DIRECT = ' ' * OWNER_SPECIFIED = ' ' * LOCAL_CAT = ' ' * IMPORTING * FUNCTION = * NEWHEADER = TABLES LINES = * EXCEPTIONS * ID = 1 * LANGUAGE = 2 * NAME = 3 * OBJECT = 4 * OTHERS = 5 . IF SY-SUBRC <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. CALL FUNCTION 'COMMIT_TEXT' * EXPORTING * OBJECT = '*' * NAME = '*' * ID = '*' * LANGUAGE = '*' * SAVEMODE_DIRECT = ' ' * KEEP = ' ' * LOCAL_CAT = ' ' * IMPORTING * COMMIT_COUNT = * TABLES * T_OBJECT = * T_NAME = * T_ID = * T_LANGUAGE = .
How do I display / add the Terms and Conditions to the business document?
I would suggest that you create separate SMART Form for the Terms and conditions and call that right after the PO main smart form. It gives the flexibility in calling the same smart form for other documents also, as generally these are the same Terms and Conditions for all the documents that a company uses.
We can have the Terms and Conditions stored as long texts in SO10 (Standard Text, TDOBJECT - TEXT and TDID - ST and TEXTNAME - Whatever name you want to give). This way if you want to change the text, its easy to change and you can transport the changes using program RSTXTRAN.
We have a text element in the smart form, and the general attributes of the text change the type to "Include Text". This will change the screen and you should be able enter the parameter values of Object, ID and name.
This will automatically print the entire long text on the smart form, we just need to make sure that this is a part of the main window of the smart form as the text might run into multiple pages.
How to convert from one currency value to other?
We can Use the Following Function Module to convert from one Currency vale to other
In following function module we need to pass Foreign currency, Local Currency type_rate:Type of rate M=Average rate G=Bank buying rate B=bank selling rate
We Get Exchange rate for that day, foreign factor, Local factor.
And Foreign currency can be calculated as below mentioned in IF ENDIF
DATA: l_er TYPE tcurr-ukurs, " l_ff TYPE tcurr-ffact, l_lf TYPE tcurr-tfact, l_erate(12) TYPE c, CALL FUNCTION 'READ_EXCHANGE_RATE' EXPORTING date = sy-datum foreign_currency = wa_bseg-pswsl local_currency = c_euro type_of_rate = 'M' IMPORTING exchange_rate = l_er foreign_factor = l_ff local_factor = l_lf EXCEPTIONS no_rate_found = 1 no_factors_found = 2 no_spread_found = 3 derived_2_times = 4 overflow = 5 OTHERS = 6. IF sy-subrc = 0. l_erate = l_er / ( l_ff / l_lf ). wa_itab-wrbtr = wa_itab-wrbtr * l_erate. ENDIF.
How do I send e-mail?
There are several methods to accomplish this:
Sending E-Mail from ABAP - Version 610 and Higher - BCS Interface
Sending E-Mail from ABAP - Version 46D and Lower - API Interface
BCS interface in BSPs
Develop a Web Service that sends an Email - in ABAP, Netweaver 04S
How do I receive and process e-mail?
Receiving E-Mail and processing it with ABAP - Version 610 and Higher
How do I generate PDFs?
BSP/HowTo: Generate PDF Output (from a BSP)
How to change the deadline of the workitem programmatically in SAP?
Following code is used to changes the deadline of any work item which is in WAITING state. The FMs needs the input like the object type for which the workflow has executed, the workflow ID to which the workitem belongs and the Task id of the standard task which is executed and in waiting state.Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
DATA: lit_deadline TYPE TABLE OF swwdeadlin, lt_workitem TYPE TABLE OF swr_wihdr, lt_rel_wi TYPE TABLE OF swwwihead, w_workitem TYPE swr_wihdr, w_rel_wi TYPE swwwihead, w_deadline TYPE swwdeadlin, l_objkey TYPE swo_typeid, l_retcode TYPE sy-subrc. * Retrieve the work items executed for desired Object type CALL FUNCTION 'SAP_WAPI_WORKITEMS_TO_OBJECT' EXPORTING objtype = l_objtype objkey = l_objkey top_level_items = space selection_status_variant = '0001' IMPORTING return_code = l_ret_code TABLES worklist = lt_workitem. * Select the workitems executed for particular Workflow. SORT lt_workitem BY wi_rh_task wi_stat. READ TABLE lt_workitem INTO w_workitem WITH KEY wi_rh_task = 'WS91001143' wi_stat = 'STARTED' BINARY SEARCH. * Select the dependent workitems of 'WS91001143'. CALL FUNCTION 'SWI_GET_DEPENDENT_WORKITEMS' EXPORTING wi_id = w_workitem-wi_id TABLES dependent_wis = lt_rel_wi. * Select the workitems for which the deadline needs to be changed. SORT lt_rel_wi BY wi_rh_task wi_stat. READ TABLE lt_rel_wi INTO w_rel_wi WITH KEY wi_rh_task = 'TS91001414' wi_stat = 'WAITING' BINARY SEARCH. * Update the deadline of the waiting task. w_deadline-wi_dattype = 'DS'. w_deadline-wi_date = l_new_date. w_deadline-wi_time = '000001'. APPEND w_deadline TO lt_deadline. CALL FUNCTION 'SWW_WI_DEADLINES_CHANGE' EXPORTING wi_id = w_rel_wi-wi_id do_commit = 'X' TABLES deadline_attributes = lt_deadline EXCEPTIONS no_authorization = 1 invalid_type = 2 update_failed = 3 invalid_status = 4 OTHERS = 5. if sy-subrc <> 0. endif.
When selection screen-screen output will use?
Mostly selection screen will use for Repoting purpose.We can give range of inputs or particulat input or single input by selection screen.
How to calculate last date of the month?
Mostly this problem arises since the months have variable end date and we need to know at runtime, whether last date is 31 or 30 or in case of Feb 28 or29!!
Here's what can be done:Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
DATA : LV_DATE TYPE DATS, LV_LASTDAY TYPE DATS, WF_DATE TYPE DATS, LV_MONTH(2) TYPE N. WF_DATE = SY-DATLO.&NBSP; "This is just for demo \*WF_DATE CONTAINS THE DATE IN THE FORMAT 20071026 LV_MONTH = WF_DATE+4(2) + 1. CONCATENATE WF_DATE+0(4) LV_MONTH '01' INTO LV_DATE. LV_LASTDAY = LV_DATE - 1.
This method is better:
Use the function module FIMA_DATE_CREATE
DATA: LV_ACTUAL_DATE TYPE SY-DATUM, LV_END_OF_MONTH_DATE TYPE SY-DATUM. LV_ACTUAL_DATE = SY-DATUM. CALL FUNCTION 'FIMA_DATE_CREATE' EXPORTING I_DATE = LV_ACTUAL_DATE * I_FLG_END_OF_MONTH = ' ' * I_YEARS = 0 * I_MONTHS = 0 * I_DAYS = 0 * I_CALENDAR_DAYS = 0 I_SET_LAST_DAY_OF_MONTH = 'X' IMPORTING E_DATE = LV_END_OF_MONTH_DATE
With the other Exporting Parameters you can get the date of other years or months.
For example: I_YEARS = 2 => Input_Years = 2005 Output_Years = 2007
I_MONTHS = '-3' => Input_Month = 07 Output_Month = 04
How to find BADI/Exit calls in any transaction?
Sometimes it is not so easy to find a BADI method or user exit to implement at an exact momment of the execution of a program. Here is one of the ways that can be used to spot which BADI method or user exit should be implemented.
1. Enter SE24;
2. Enter the class name CL_EXITHANDLER;
3. Double-click the method GET_INSTANCE;
5. Set a break-point at command line CASE sy-subrc (near line 25);
6. Execute the transaction you want to analyse; It will stop at the break-point you have just set on class CL_EXITHANDLER when it finds any BADI method/Exit call.
7. On debug screen, type the field name exit_name. This field contains the BADI method/Exit name which is being called in the program on that momment.
8. Press F8 to see the next calls.
10 basic steps to create Enhancement Spot/ BADI
1. Go to se18.
2. Enter the name enhancement spot and click create.
3. On next screen click on create new BADI.
4. Once the BADI is created then expand the tree on the left side.
5. Then double click on interface and give the name of the interface.
6. On the next screen it will ask for interface methods and its level ,that is it static or instance ?
7. Go to se19, and then click on enhancement spot ,enter the name of enhacement spot created above and click on implement.
8. On next pop up give the name of enhancement implementation.
9. On next screen give the name of BADI implementation and its implementation class and also BADI definition just created above and save.
10. Now back to se18 and there activate both enhancement spot and BADI implementaion.And see both BADI interface and implementation.
Unknown User (vlen7n2)
hi this is nagesh....
what is the difference between REFRESH and CLEAR
Unknown User (qaszo37)
How can you convert a table to excel and email it (not download it) as a background job?
Iam new to ABAP and now learning BDC.
Iam want to know use of field BDC_OK and BDC_CURSOR
Pls help me
Unknown User (10678ua1x)
this wiki is superb you can learn all the ABAP kick starts from this single source, As you go head with your work one can horn the skills in the specific area.
I find one more superb abap interview questions and answers link.http://www.troveinterview.com/sap-interview-questions