Pages

Tuesday, May 27, 2008

ABAP/4 functions:

  • Popup_to_confirm_loss_of_data
    Create a dialog box in which you make a question whether the user wishes to perform a processing step with loss of data.
  • Popup_to_confirm_step
    Create a dialog box in which you make a question whether the user wishes to perform the step.
  • Popup_to_confirm_with_message
    Create a dialog box in which you inform the user about a specific decision point during an action.
  • Popup_to_confirm_with_value
    Create a dialog box in which you make a question whether the user wishes to perform a processing step with a particular object.
  • Popup_to_decide
    Create a dialog box in which you require the user between the two processing alternatives, or to cancel the action.
  • Popup_to_decide_with_message
    Create a dialog box in which you inform the user about a specific decision point via a diagnosis text.
  • Popup_to_display_text
    Create a dialog box in which you display a two-line message.
  • Rfc_system_info
    Fetch information from the current instance filling the structure FRCSI.
  • Rs_send_mail_for_spoollist
    Send messages from ABAP/4 programs to SAPoffice. The structure SOLI may contain the message.

Report command field formats

%pri : Print the current report

%pc : Download the current report

%sc : Call the find function

p+ : Go to the next page

p- : Go to the previous page

p++ : Go to the last page

p-- : Go to the first page

Friday, May 23, 2008

How to find out the Form and Report Name from Standard?

By using transaction code nace, you can find out all the form and report name for the standard output using for standard module.

---> goto se93>nace>enter

Convert the sapscript from spoollist to pdf

Convert the sapscript from spoollist to pdf.

When opening layout with "OPEN_FORM" function module specify:
DEVICE = 'PRINTER'
and OPTIONS = your_itcpo_variable
with your_itcpo_variable-TDGETOTF = 'X'.

When you close your layout with "close_form" function module suply an array to get OTFDATA.

This will generate your "print order" to an internal array not to spool. This will be in OTF format.

Then call "CONVERT_OTF_2_PDF" function module to get your OTF traslated to PDF. The array obtained can be saved to disk to get a pdf archive.

This works fine at least in 4.5B

You can use the standard program RSTXPDF4.

Hope this should work.

When u use the standard program [b]rstxldmc[/b] , there might be some probs with uploading of the bmp file.
So, a better approach is :
1. Go to T.C : se78(Graphics management).
2. select > Graphics > BMP.
3. Then click on Import on the standrad toolbar.
4. Press f4 and give the path where your BMP file is on the local system.
5. Give some name for your logo,,, Eg : 'MYLOGO' .
6. select the radiobutton for TYPE as Color Bitmap Image.
Continue. Finished.
Click on the print prewiev to view your Uploaded logo into the SAP System.

Saturday, May 10, 2008

SAPScript Transaction codes

SE71 - Form painter

SE72 - Style maintenance

SE78 - SapScript Graphics Management

SO10 - Create standard text module

Sapscript

Sometimes user have a requirement to create form. Using normal Abap Code this is not possible. Instead SAP provides an object called SAPSCRIPT to generate such kind of documents which can contain logos, tables and other objects and which can look like pre-printed documents.


A layout set is a template designed in SAP to place the stream of data coming from a SAP program on different parts of a physical page. The designer needs to lay out the various elements that need to be printed on the page and store it as an object in the SAP system. An ABAP program will subsequently call this object to generate an instance of the template – thus generating an output document from the program.

  • Standard Attributes in Sapscript
  1. Description - Brief description or title of the layout set
  2. Default paragraph - The base paragraph that is globally applicable to the document. This can be overridden at lower level of the layout set by using other paragraphs
  3. Tab Stop - The base tab-stop that is globally applicable to the document. These can be overridden at lower level of the layout set by using other tab stops
  4. First Page - The start page of the layout set
  5. Page Format
  6. Orientation - The direction of printing the data on a page – P for portrait (vertical) and L for landscape (horizontal)
  7. Lines per inch
  8. Characters/inch

Thursday, May 8, 2008

General command field formats

You can use this command in SAP screen field:
/n Skip to the next record if you are processing one batch input session
/bend Cancel a batch input foreground process
/nend Close all R/3 sessions and logoff
/nxxxx Call the transaction xxxx in the same session
/o Generate a session list
/oxxxx Call the transaction xxxx in an additional session
/i Delete the current session
/h Turn the debug mode on
/$tab Reset all buffers (for System Administrators)
/$sync Synchronize instances buffers (for System Administrators)

Transactions

search_sap_menu - Finds the menu path to a transaction
  • WE09 / WE02 IDoc lists according to content. View IDocs via specific IDoc number or business application detail contained within the contents of a segment.

  • WE05 View IDocs

  • WE19 EDI test tool. Use to test inbound Function module changes.

  • WE20 Partner profile configuration. Add partner detail together with inbound and outbound relationships. We also incorporate message control on the outbound IDocs. Utilize the organizational units to trap functional errors for further processing

  • WE30 Create IDoc extension type

  • WE31 Segment create

  • WE57 Assign function module to logical message and IDoc type

  • WE60 IDoc type documentation tool

  • WE82 Link Release detail to Extension IDoc Type

  • BD55 Conversion rule user exit. Link conversion rule user exit to the different system \ partner combinations

  • BD87 Reprocess IDocs in error or waiting for action. (Both inbound and outbound in 4.6. Use BD88 in prior versions)

  • BALA ALE Application Distribution

  • BALM ALE Master Data Distribution


  • VA02 Sales order change

  • VA05 List of sales orders

  • VA22 Quotation change

  • VA32 Scheduling agreement change

  • VA42 Contract change

  • VF02 Change billing document

  • VF11 Cancel Billing document

  • VF04 Billing due list

  • FBL5N Display Customer invoices by line

  • FBL1N Display Vendor invoices by line

  • VL02N Change delivery document

  • VL04 Delivery due list

  • VKM5 List of deliveries

  • VL06G List of outbound deliveries for goods issue

  • VL06P List of outbound deliveries for picking

  • VL09 Cancel goods issue

  • VT02N Change shipment

  • VT70 Output for shipments

  • VKM3, VKM4 List of sales documents

  • VKM1 List of blocked SD documents

  • VD52 Material Determination

Tuesday, May 6, 2008

BASICS OF INTERACTIVE REPORTS:

BASICS OF INTERACTIVE REPORTS:

When the user starts an executable (type 1) program, the program context and memory space for data objects (variables and structures) are made available on the application server. The subsequent program flow is controlled by the ABAP runtime system.

If the program contains a selection screen, the ABAP runtime system sends it to the presentation server at the start of the program.

Once the user has finished entering data on the selection screen, he or she chooses 'Execute' to tell the system to start processing the rest of the program. The data entered on the selection screen is automatically placed in the corresponding data objects. The ABAP runtime system takes over control of the program.

In this simple example, there is only one ABAP processing block to be processed by the runtime system.

This processing block contains a read access to the database. The program sends information to the database about the records that should be read.

The database returns the required database records and the runtime system ensures that the data is placed in the relevant data objects.

The list output is also programmed in the processing block. After the processing block finishes, the runtime system sends the list as a screen to the presentation server.

Selection screens allow users to enter ranges of values. They are normally used to define the set of data that needs to be read from the database.

As well as the normal graphical elements (group boxes, checkboxes, radio buttons, and so on) that you use in screens, selection screens also have input/output fields (PARAMETERS) and special groups of input/output fields (SELECT-OPTIONS).

You place a single input/output field on the selection screen using the PARAMETERS statement.

You can use the SELECT-OPTIONS statement to place a group of fields on the screen that allows users to enter complex selections. The selection may be a single value, or any form of interval (discrete or continuous). You can also use patterns. (See following slides).

You can create variants for selection screens.

If you declare an input field with reference to an ABAP Dictionary field, any search helps defined for the Dictionary field will be available on the selection screen.

Selection texts can be translated into other languages. They are then displayed in the user's logon language.

Selection ranges are stored in programs using an internal table.

The ABAP statement SELECT-OPTIONS FOR declares an internal table called , containing four fields - SIGN, OPTION, LOW, and HIGH. The fields LOW and HIGH have the same type as the field .

The SIGN field can take the value 'I' (for inclusive) or 'E' (for exclusive).

The OPTION field can contain relational operators, pattern operators, and operators that allow you to enter intervals.

For more information about selection ranges, choose Goto -> Selection screen help from any selection screen.

To define a selection screen, include the required PARAMETERS and SELECT-OPTIONS statements in your data declarations. If you define more selection screens than just the standard selection screen, you must enclose the additional definitions in the statements SELECTIONSCREEN BEGIN OF SCREEN and SELECTION-SCREEN END OF SCREEN where is the number of the selection screen.

For information about other graphical elements that you can place on a sele ction screen, such as group boxes, checkboxes, radio buttons, references to input fields on other selection screens and so on, see the keyword documentation for the SELECTION-SCREEN statement

The standard selection screen is displayed by the ABAP runtime system when the program starts.

User-defined selection screens are displayed when you use the statement CALL SELECTIONSCREEN . This statement sets the return code sy-subrc to zero if the user chooses 'Execute', and to 4 if the user chooses 'Cancel'.

You can also call a selection screen as a modal dialog box. To do this, use the syntax CALL SELECTION-SCREEN STARTING AT ENDING AT where and are the coordinates of the top left-hand corner of the screen. and are the coordinates of the bottom right-hand corner.

Selection screen processing is event-driven. Events are ABAP processing blocks that are called by the runtime system in a particular order and processed sequentially. In the program, each event is introduced by an event keyword. The processing block ends when the next event block starts, or the definition of a subroutine or dialog module occurs.

AT SELECTION-SCREEN OUTPUT is processed before the selection screen is displayed. You can use this event to modify the selection screen dynamically.

AT SELECTION-SCREEN ON HELP-REQUEST FOR and
AT SELECTION-SCREEN ON VALUE-REQUEST FOR allow you to define your own F1 and F4 help.

AT SELECTION-SCREEN is processed when the user presses ENTER or chooses another function on the selection screen. You can use this event to check the values the user entered on the screen. The addition ON... allows you to control which fields or groups of fields should accept input again in the event of an error.

An ABAP program consists of a sequence of processing blocks (events) that are processed by the runtime system in a particular order.

LOAD-OF-PROGRAM is triggered directly after the system has loaded a program with type 1, M, F, or S into an internal session. The processing block is executed once only for each program in each internal session.

INITIALIZATION is processed in executable (type 1) programs, directly before the selection screen is displayed. You can use the corresponding processing block to preassign values to the parameters and selection options on the selection screen.

START-OF-SELECTION is processed after the selection screen has been processed. If you are working with a logical database, the corresponding GET events are triggered after START-OFSELECTION.

END-OF-SELECTION is processed after all of the data has been read, and before the list is displayed.

TOP-OF-PAGE is an event in list-processing. The processing block is always executed when you start a new page in the list.

Once the basic list has been displayed, you can react to possible user actions. Detail lists allow you to distribute the information you want to display across several lists.

This makes the lists easier for the user to understand, and improves performance, since you can delay reading extra information from the database until the user actually requests it.

You can also use additional selection screens to allow the user to enter further restrictions.

For each basic list you can use up to 20 detail lists. Each list is stored in its own list buffer. When the user chooses 'Back' (green arrow) or 'Cancel' (red cross), he or she returns to the previous list.
This action initializes the list buffer of the list level the user just le ft.

When the user chooses 'Exit' (yellow arrow), the system terminates the list processing and returns to the standard selection screen.

The events START-OF-SELECTION, GET, END-OF-SELECTION, TOP-OF-PAGE and END-OFPAGE can be used only to create basic lists.

To create detail lists, use the events AT LINE-SELECTION or AT USER-COMMAND.

Use TOP-OF-PAGE DURING LINE-SELECTION for page headers on detail lists.

Each detail list event exists only once in the program and is shared by all detail lists. You must therefore ensure yourself, within the processing block, that the correct list is created. To do this, use a CASE structure that uses the system field sy-lsind. This system field contains the list index of the list that you are currently generating.

Use the statement HIDE global_field to store the contents of the global data field
global_field for the current line.

If the user selects the line, the data field is automatically filled with the value that you retained for the line.

You do not have to display the field on the list in order to retain its value using HIDE.

The field can be a structure. However, deep structures (structures containing internal tables as components) are not supported.

When the user selects a line on an interactive list, all of the global data fields whose values you stored using the HIDE statement while you were creating the basic list are filled with those values.

The line selection is based on the cursor position when the AT LINE-SELECTION and AT USERCOMMAND events occur. (system field sy-lilli).

If you choose a line using the READ LINE... statement, the values are placed back in the original fields according to the line numbers.

To check whether the user selected a valid line, you can use the fact that the hide area only contains data for valid lines. When you have finished creating the list, initialize a suitable test field. This allows you to check before you create the detail list whether a value from the hide area has been placed in the test field.

Once you have created the detail list, re-initialize the test field to ensure that the user cannot choose an invalid line once he or she returns from the detail list and attempts to select another line for a new detail list.

source from : http://abapprogramming.blogspot.com

Sunday, May 4, 2008

SQL Interface.

SQL Interface.

Select Where VS Select + Check
Always specify your conditions in the Where-clause instead of checking them yourself with
check statements. The database system can then use an index (if possible) and the network
load is considerably less.

Select with Index Support
For all frequently used Select statements, try to use an index. You always use an index if
you specify (a generic part of) the index fields concatenated with logical Ands in the Select statement's Where clause. Note that complex Where clauses are poison for the
statement optimizer in any database system.


Select single vs. Select-Endselect

if there exists at least one row of a database table or view with a certain condition, use
the Select Single statement instead of a Select-Endselect-loop. Select Single requires one
communication with the database system, whereas Select-Endselect needs two.

Select Into table t
It is always faster to use the Into Table version of a Select statement than to use Append
statements.

Select aggregates
If you want to find the maximum, minimum, sum and average value or the count of a database
column, use a select list with aggregate functions instead of computing the aggregates
yourself. Network load is considerably less.

Select Endselect VS Aray Select
If you process your data only once, use a Select-Endselect-loop instead of collecting data
in an internal table with Select Into Table. Internal table handling takes up much more
space.


Select with View
To process a join, use a view instead of nested Select statements. Network load is
considerably less.

Select with join
To read data from several logically connected tables use a join instead of nested Select
statements. Network load is considerably less.

Select with select list
Use a select list or a view instead of Select * , if you are only interested in specific
columns of the table. Network load is considerably less.

Select with buffer support
For all frequently used, read-only tables, try to use SAP buffering. Network load is
considerably less.

Thursday, May 1, 2008

Better Aproach - Coding in Abap (Coding Format)

1.One Command Per line

-Each ABAP/4 command line consists of a sentence ending with a period. Each command
should start on a new line (Even though ABAP allows several commands per line). This will
provide the option for easier deleting, commenting and debugging.

Recommended:

IF F_STATUS EQ K_ERROR.

EXIT.

ENDIF.

Not Recommended:

IF F_STATUS EQ K_ERROR. EXIT. ENDIF.

2.Program Comments

Comments should be used to describe the program statements. Half line comments should be used to provide description of data declaration and parameters. Complex or unusual program logic should be documented with full line of comments prior to the statement and leaving one blank line before the comments.



Indexes - Form and Use

Purposed of Indexes - to speed up selection from the database. Consist of a sorted copy of certain database table fields.

The primary index is always created automatically in the SAP System. It consists of the primary key fields of the database table, and there is at most one record in the table matching each possible combination of these fields. This kind of index is called a UNIQUE index.

If you cannot use the primary index to determine a selection result (for example, WHERE condition may not contain any primary index fields), the system searches the whole table. To prevent this, and determine the selection result by searching through a restricted number of database records, you can create a secondary index.

Creating an index

You can create an index in Transaction SE11 by choosing Change → Indexes... → Create. To make the index unique, select UNIQUE. To specify the fields that will comprise the index, choose "Choose fields". You then need to save and activate the index.