Monday, May 5, 2008

SAP ABAP Function Module te get Week from Date.

SAP ABAP Function Module te get Week from Date.

DATE_GET_WEEK

The following function module gets the week of the year from the entered date.

REPORT ZEX_DATEGETWEEK .


Parameters: P_date like sy-datum.

Data: d_week like SCAL-WEEK,
      d_week1(2).


* The following function module get the week of the entered date.


CALL FUNCTION 'DATE_GET_WEEK'
  EXPORTING
    DATE              = P_date
 IMPORTING
   WEEK               = d_week
 EXCEPTIONS
   DATE_INVALID       = 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.


move: d_week+4(2) to d_week1.

Write:/ 'Week ', d_week1.


If you enter the date as 05/04/2008 then the output would be as follows.

Gets the week of the year     
                              
Week  18                      





SAP ABAP Debugger WatchPoint Fileds Tables

SAP ABAP Debugger WatchPoint Fields Tables

In SAP ABAP a WatchPoint can be set to break the program at the point when the value of a filed in the program changes. In SAP ABAP a maximum of 10 WathPoints can be set in a session. This is a very handy tool if you want to break and debug the program only from the point when a field under consideration has the desired value.

Please see the figure given below.



Fields

If you want to see the contents of any filed in the debugger, please double click on the filed. A maximum of 4 fields can be seen at a time. In case you want to change the value of a filed at run time you need to enter it and then click on the pencil icon to change it.



Tables

If you need to see the contents of the Table, double click on the table name and click on the tables option in the debugger. Here you can see the contents of all the fields in the table. In case you need to forcefully change the contents of one or more fields you can do so by typing the desired value and clicking on the pencil icon. Make sure that you click on the pencil sign for each field before proceeding to the next filed. In case you forget to click on the pencil sign for any particular field it will reset to the original value.