Monday, December 6, 2010

JAVA

 ABAP developer needs to gain different skills for better understanding of abap beside the other benefits. If you agree and still haven't decided where to start , you should take a look at JAVA. It is probably the most powerful language.

  Using JCO (Java connector) , you can directly call remote enabled functions. Sap Netweaver Developer Studio (NWDS) is the provided ide to develop java applications integrated with sap. You can download JCO and NWDS from SAP marketplace. There is also a book published by SAP Press to begin programming with java.





ABAP vs JAVA : http://enterprisegeeks.com/blog/2009/03/23/egeeks-podcast-episode-12/

Java Beginners : http://download.oracle.com/javase/tutorial/index.html

Netbeans IDE: http://netbeans.org/

JCO : http://help.sap.com/saphelp_nw04/helpdata/en/6f/1bd5c6a85b11d6b28500508b5d5211/frameset.htm

WDFJ : http://help.sap.com/saphelp_tm60/helpdata/en/15/0d4f21c17c8044af4868130e9fea07/content.htm

Thursday, November 11, 2010

New ABAP Debugger

New ABAP Debugger has many brand new features. It is a mistake not to take a look. If you think so here is the sdn blog ; New ABAP Debugger – Tips and Tricks

Tuesday, February 16, 2010

Change SAP logon screen

Refer to : Note 205487 - Own text on SAPGui logon screen


Go to SE61.



Select General Text , Write ZLOGIN_SCREEN_INFO to Name . Click Change/Create.

You may use icons at the beginning of lines by specifying icon code for example @58@ .

Title lines (can be recognized by format keys starting with a 'U') are highlighted in the display.

Note that there is space on the logon screen for 16 lines for every 45 fixed-font characters or for approximately 60 proportional font characters.

Warning
If you modify screen SAPMSYST 0020 (in older releases), then note that you may only insert text elements.
Changes to the flow logic, for example, by inserting subscreen, force a change in program SAPMSYST.
SAP strongly recommends not changing the system program SAPMSYST because by doing so, serious problems may arise (for example, the dialog logon is generally no longer possible!)



 

Thursday, January 21, 2010

Check If Background Job is Runing

*** We've got a standart FM to check a BG Jobs state SUBST_GET_JOBSTATE
*** Below you can see my code
*** I've the job name MY_JOB_NAME  and i am searching
*** if there is any active job still running for 2 days. if you have
*** program name then just use progname field instead of jobname.

 TABLES : tbtco.

  data : lt_tbtcp type table of tbtcp with header line.
  data : lv_datum type sy-datum.
  data : lv_message type string.
  data: lv_running.

** Check For A reasonable period
  lv_datum = sy-datum - 3.
 
 CLEAR : lv_running.
  select *
    into corresponding fields of table lt_tbtcp
    from tbtcp
   where jobname eq 'MY_JOB_NAME'
      and sdldate gt lv_datum.

  loop at lt_tbtcp.
    select single * from tbtco
           where jobname  = lt_tbtcp-jobname
             and jobcount = lt_tbtcp-jobcount.
    check sy-subrc eq 0.
    if  tbtco-status eq 'R'.
      "JOB is running
       message 'JOB is running' type 'I'.
       lv_running = 'X'.
      exit.
    endif.
  endloop.

if lv_running = 'X'.

  " We have a running job with the specified parameters
endif.

Sunday, January 10, 2010

USER EXISTENCE CHECK

***  Check if user exists :

*** BAPI_USER_EXISTENCE_CHECK
  call function 'BAPI_USER_EXISTENCE_CHECK'
    exporting
      username = p_user
    importing
      return   = ls_return.
if ls_return-number = '124'.
" DOES NOT EXISTS
elseif ls_return-number = '088'.
" EXISTS
endif.

*** SUSR_USER_CHECK_EXISTENCE
  call function 'SUSR_USER_CHECK_EXISTENCE'
       exporting
            user_name            = user_name
       exceptions
            user_name_not_exists = 1
            others               = 2.
if sy-subrc EQ 0.
" EXISTS
endif.

Thursday, January 7, 2010

Get ALV instance From ALV Function

While using ALV function to display ALV grid , there are some restrictions according to oo alv. FM below gives us the chance to use alv instance without restrictions.

****

 data: lr_grid type ref to cl_gui_alv_grid.

  call function 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    importing
      e_grid = lr_grid.

***

Merge Fieldcat From Dictionary Structure

*** FOR OO ALV

 data : gt_fcat type lvc_t_fcat.

  call function 'LVC_FIELDCATALOG_MERGE'
    exporting
      i_structure_name       = 'YOUR_DICT_STRUCTURE'
      i_bypassing_buffer     = 'X'
    changing
      ct_fieldcat            = gt_fcat[]
    exceptions
      inconsistent_interface = 1
      program_error          = 2
      others                 = 3.
  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.

*** FOR ALV FUNCTION

  data : gt_fieldcat type slis_t_fieldcat_alv.


  call function 'REUSE_ALV_FIELDCATALOG_MERGE'
    exporting
      i_structure_name = 'YOUR_DICT_STRUCTURE'
      i_bypassing_buffer     = 'X'
    changing
      ct_fieldcat      = gt_fieldcat.

--

Tuesday, January 5, 2010

HR : FM to Find Active Plan Variant

  DATA : gv_plvar TYPE plvar.

  call function 'RH_GET_ACTIVE_WF_PLVAR'
    importing
      act_plvar       = gv_plvar
    exceptions
      no_active_plvar = 1
      others          = 2.

ABAP Date Calculations

 Class CL_HRPAD_DATE_COMPUTATIONS has static methods for most of the date operations you need.

ADD_WEEKS_TO_DATE    Adfd No. of Weeks to Date
ADD_MONTHS_TO_DATE    Adds No. of Months to Date
ADD_YEARS_TO_DATE    Adds No. of Years to Date
SUBTRACT_WEEKS_FROM_DATE    Subtracts No. of Weeks from Date
SUBTRACT_MONTHS_FROM_DATE    Subtracts No. of Months from Date
SUBTRACT_YEARS_FROM_DATE    Subtracts No. of Years from Date
GET_WEEKDAY_NUMBER    Determines Number of Weekday
GET_WEEKDAY_NUMBER_SHIFTED    Determines Number of Weekday (Shifted)
GET_FIRST_DAY_CALENDAR_WEEK    Determines First Day of Calendar Week for Particular Year
GET_LAST_WEEKDAY_NUMBER    Determines Number of Last Weekday
GET_FIRST_DAY_IN_WEEK    Determines First Day of a Week
GET_FIRST_DAY_IN_SHIFTED_WEEK    Determines First Day of Week (Shifted)
GET_FIRST_DAY_PREVIOUS_MONTH    Determines First Day in Previous Month
GET_WEEK    Determines Week in Which Date Lies (Shifted)
GET_SHIFTED_WEEK    Determines Week in Which Date Lies (Shifted)
GET_LAST_DAY_IN_MONTH    Calculates Last Day of Current Month
GET_LAST_DAY_PREVIOUS_MONTH    Determines Last Day of Previous Month
GET_DAYS_PER_YEAR    Determines No. of Days per Year

*** Example

     call method cl_hrpad_date_computations=>get_last_day_in_month
      exporting
        date_in  = lv_begda
      receiving
        date_out = lv_endda.