Wednesday, May 7, 2008

SAP ABAP Version Management

SAP ABAP Version Management.

In SAP ABAP version Management is very useful to keep track of the changes that you make to your program. Version Management helps in keeping a record of the changes that you make and in case you want to revert back to the older version you can do so by activating the appropriate version. Version management is a better way of trying out some change in the code and if this leads to undesirable results then you can go back to the earlier version. In case you want to revert back to the earlier version you need to re-activate it. Version management is also useful to an auditor to review the complete history of a program. The system administrator can view the version management to track changes in a specific time interval.

To create a version of a program please follow the path given below.

From the ABAP Editor

Utilities >>>>>>>>>>>>>>>> Version >>>>>>>>>>>>>>> Create Version



To activate the the previous version navigate to

Utilities >>>>>>>>>>>>>>>> Version >>>>>>>>>>>>>>> Version Management

Select the appropriate version and activate it.


SAP ABAP Drill Drill Down Report Concept

SAP ABAP Drill Down Report Concept (Double click to get the secondary list.)

In ABAP if you wish to get the secondary list by double clicking any of the lines of a report then you can make use of the event

AT LINE-SELECTION

as follows

REPORT ZEX_DOUBLECLICK .

*&---------------------------------------------------------------------*
*& ABAPLOVERS: Example of Double Click to get secondary List
*&---------------------------------------------------------------------*

* Table Declaration
TABLES: VBAK,
        VBAP.

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

* 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 to Add Months to a Date and get the resulting date

SAP ABAP Function Module to Add Months to a Date and get the resulting date

In case you want to add months to a date filed and get the resulting Day, Month and year you can use the following function module.

MONTH_PLUS_DETERMINE

The above mentioned function module accepts the date in SY-DATUM type and months in NUMC. The 2 Parameters are imported in the function module and processed and the resulting date is exported to the calling program.

Please see the program given below.

REPORT ZEX_ADDMONTHSTOYEAR .

Parameters: P_Months(4) type n,
            P_odate like sy-datum.

Data: D_NewDate like sy-datum.

CALL FUNCTION 'MONTH_PLUS_DETERMINE'
  EXPORTING
    MONTHS        = P_Months
    OLDDATE       = P_odate
 IMPORTING
   NEWDATE        = D_NewDate.


   Write:/ 'New Date is ', D_NewDate.

We will see the output of the above program for the following inpu.

P_MONTHS = 10
P_odate    = 05/05/2004

The Output would be as follows.

Add Months To Year           
                             
New Date is  03/05/2005