21 Eylül 2008 Pazar

Display message

  DATA: mesTAB TYPE TABLE OF BDCMSGCOLL with header line.
  DATA: W_TEXTOUT LIKE T100-TEXT.


   LOOP AT MESTAB WHERE MSGTYP = 'S' or MSGTYP = 'E'.

          CALL FUNCTION 'MESSAGE_TEXT_BUILD'
            EXPORTING
                MSGID                      =  mestab-msgid
                MSGNR                     =  mestab-msgnr
                MSGV1                     =  mestab-msgv1
                MSGV2                     =  mestab-msgv2
                MSGV3                     =  mestab-msgv3
                MSGV4                     =  mestab-msgv4
           IMPORTING
                MESSAGE_TEXT_OUTPUT       = W_TEXTOUT.


CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
  EXPORTING
*   TITEL              = ' '
    TEXTLINE1          = W_TEXTOUT
*   TEXTLINE2          = ' '
*   START_COLUMN       = 25
*   START_ROW          = 6
          .

   ENDLOOP.

3 Eylül 2008 Çarşamba

Run an Executable Program with Parameters

If you wish to run an executable program from SAP it can be done by using the following Function Module.

GUI_RUN

These function modules are useful when you want to create an interface with SAP. Many a times it may be required to call an executable program from SAP and pass some Parameters to it. The called user program can then process the data and return back parameters to SAP. Function modules similar to GUI_RUN can be used to build such interfaces.

We will see a simple example of opening a Notepad file from SAP and another example by opening a website through a browser.

Example 1

REPORT ZEX_GUIRUN .


CALL FUNCTION 'GUI_RUN'
EXPORTING
COMMAND = 'NOTEPAD.EXE'
PARAMETER = 'c:\TEST.TXT'
* CD = '
* IMPORTING
* RETURNCODE = .

Example 2

REPORT ZEX_GUIRUN .


CALL FUNCTION 'GUI_RUN'
EXPORTING
COMMAND = 'FIREFOX.EXE'
PARAMETER = 'GOOGLE.COM'
* CD = '
* IMPORTING
* RETURNCODE = .

comparing 2 programs with Split Screen Editor



In ABAP you may want to compare 2 programs. If you wish to compare the inactive version of the same program or of you want to compare 2 completely different programs. This can be done using the Split Screen Editor. Please follow the path shown below to open the Split Screen Editor.

Open the ABAP Editor Transaction SE38. Open any of the programs.

Click on Utilities >>>>>>>>>> More Utilities >>>>>>>>>>> Split Screen Editor.

In the following figure you will see the Split Screen Editor.

Popup screen

If you wish to POPUP a screen in SAP ABAP then it can be done as shown below. Do experiment with the X,Y co-ordinates for the POP-UP Screen. The following program pulls out sales orders from the sap database and displays them on the screen. When the user clicks on a particular sales order, it displays the Sales order number and the Customer number in the POP-UP Screen

REPORT ZEX_POPUPSCREEN .

*&---------------------------------------------------------------------*
*& ABAPLOVERS POPUP SCREEN
*&---------------------------------------------------------------------*

* Table Declaration
TABLES VBAK.
* Start of Selection
START-OF-SELECTION.
SELECT * FROM VBAK.
WRITE / VBAK-VBELN HOTSPOT ON.
ENDSELECT.
* Display the screen
AT LINE-SELECTION.
WINDOW STARTING AT 10 10
ENDING AT 40 25.
WRITE:/ 'VBAK-VBELN, VBAK-KUNNR'

Calculator

Function Module Calculator.

FITRV_CALCULATOR

Finding Path to SAP Transaction in Menu

You may be knowing the SAP transaction, and would like to trace the path to this transaction in the SAP menu. To do this SAP has provided a way. There is a transaction called SEARCH_SAP_MENU.

With the help of this transaction you can easily search the path to a particular transaction. For example if you wish to search the path to the transaction XD01 (Create Customer Centrally) then you can execute the transaction
SEARCH_SAP_MENU and hit enter. You will see the following. You can then choose the one that has the shortest path.

2 Eylül 2008 Salı

Copy to Windows ClipBoard

If you wish to copy the contents of the internal table to the Windows clipboard, you can do so by using the following function module.


SAP ABAP Function Module Copy to Clipboard
CLPB_EXPORT

If you use this function module, then the contents of the internal table can be copied to the Clipboard of the Presentation Server. Once the contents are copied to the clipboard they can be pasted into any windows application.


Find the code below.

REPORT ZEX_CLIPBOARDEXP .

types: ty_tab(200) type c.
Data: wa_tab type ty_tab,
int_tab type table of ty_tab.

Move: 'This is line 1 again' to wa_tab.
append wa_tab to int_tab.
clear wa_tab.

Move: 'This is line 2 again' to wa_tab.
append wa_tab to int_tab.
clear wa_tab.

CALL FUNCTION 'CLPB_EXPORT'
TABLES
DATA_TAB = int_tab
EXCEPTIONS
CLPB_ERROR = 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.