Tuesday, May 6, 2008

SAP ABAP Example of creating a HOT SPOT

Creating HOTSPOT Area in SAP ABAP

While creating interactive reports it may be required to create a HOTSPOT. Please find the sample code below.

REPORT ZEX_HOTSPOT .

*&---------------------------------------------------------------------*
*& ABAPLOVERS: Example of HOTSPOT
*&---------------------------------------------------------------------*

* Table Declaration
TABLES: VBAK,
        VBAP.

* Start-Of-Selection
START-OF-SELECTION.
  SELECT single vbeln INTO (VBAK-VBELN) FROM VBAK.
    WRITE / VBAK-VBELN HOTSPOT ON.

* Single click
AT LINE-SELECTION.
  Select Single posnr
                matnr
                INTO (VBAP-POSNR,
                      VBAP-MATNR) from vbap
                            where VBELN = VBAK-VBELN.


 Write:/ VBAK-VBELN, VBAP-POSNR, VBAP-MATNR.


SAP ABAP Function Module for getting day of the week

SAP ABAP Function Module for getting day of the week

The function module to get the day of the week is given below.

DAY_IN_WEEK

This function module computes the day of the week from the date. Examine the program given below.


REPORT ZEX_DAYINAWEEK .

Parameters: P_date like sy-datum.

data: d_wotnr type p.


CALL FUNCTION 'DAY_IN_WEEK'
     EXPORTING
          DATUM = P_date
     IMPORTING
          WOTNR = d_wotnr.


Case d_wotnr.

  when '1'.
    Write:/ 'Day = ', 'Monday'.

  when '2'.
    Write:/ 'Day = ', 'Tuesday'.

  when '3'.
    Write:/ 'Day = ', 'Wednesday'.

  when '4'.
    Write:/ 'Day = ', 'Thursday'.

  when '5'.
    Write:/ 'Day = ', 'Friday'.

  when '6'.
    Write:/ 'Day = ', 'Saturday'.

  when '7'.
    Write:/ 'Day = ', 'Sunday'.

Endcase.

The output of the above program is as follows.

Input 05/05/2008

OutPut

Get day in a week         
                          
Day =  Monday   

Input 03/05/2008

OutPut

Get day in a week  
                   
Day =  Wednesday   

Input

05/05/2008

OutPut

Get day in a week    
                     
Day =  Thursday 

    



         

SAP ABAP comparing 2 programs with Split Screen Editor

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