Active TopicsActive Topics  Display List of Forum MembersMemberlist  CalendarCalendar  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
 One Stop SAP ForumSAP NetWeaver / ABAPApplication Platform

Message Icon Topic: SAP-ABAP (Important)..

Post Reply Post New Topic
Author Message
nidhi dutta
Senior Member
Senior Member


Joined: 26Mar2007
Online Status: Offline
Posts: 150
Quote nidhi dutta Replybullet Topic: SAP-ABAP (Important)..
    Posted: 21May2007 at 12:23am
Dear All,
         Here i am posting some very important topics of SAP-ABAP, i SAW many
ABAPian to fighting through these questions....

What is this new transaction 'n' all about?

 It is actually a quickstart transaction for se16n.    


What does ABAP stand for?

ABAP currently stands for Advanced Business Application Programming; however the original meaning was AllgemeinerBerichtsaufbereitungsprozessor, 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.


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:

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.

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.

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.

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.

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.


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:

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?

SAP Link 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.

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.

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.

Helloooooooooooooooooooooo...
[color=BROWN]Its Nidhi Dutta here.. [color].. People who are interested in studdy stuff.. i want to disscuss with those cool people...



Post Resume: Click here to Upload your Resume & Apply for Jobs

IP IP Logged
vimalmss
Newbie
Newbie
Avatar

Joined: 27May2007
Location: India
Online Status: Offline
Posts: 1
Quote vimalmss Replybullet Posted: 27May2007 at 9:54pm
Thanks Nidhi

really got useful information from you.
IP IP Logged
rao_peram
Newbie
Newbie


Joined: 19Nov2007
Location: India
Online Status: Offline
Posts: 1
Quote rao_peram Replybullet Posted: 19Nov2007 at 5:59am
Hi Nidhi ,
 
Keep Rocking , i would like to see u in SDN ?
 
 
Regards
Prabhu Peram,


Edited by rao_peram - 19Nov2007 at 6:00am
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You can vote in polls in this forum

GET LATEST FRESHERS JOBS IN YOUR MAIL





This page was generated in 0.125 seconds.
Vyom is an ISO 9001:2000 Certified Organization

© Vyom Technosoft Pvt. Ltd. All Rights Reserved.

Privacy Policy | Terms and Conditions
Job Interview Questions | Placement Papers | Free SMS | Freshers Jobs | MBA Forum | Software Testing | Web Hosting