Monday, June 16, 2014

Monday, December 16, 2013

IDOC


WE02/WE05 - IDOC Status - Status

BD87 - Process pending IDOCS

BD64 - Distribution Model

WE21 - Port

WE20 - Partner Profile

WE30 - IDOC Types and Extension

WE31 - Segments

BD50 - Activate Change Pointers

WE19 - Testing tool for IDOC processing

PFAL - Transaction to distribute HR Master Data




 

Thursday, January 5, 2012

BADI for HRMD IDOC

BADI for modifying HRMD IDOC data - HRALE00OUTBOUND_IDOC

Receiver should be checked inside the method - IDOC_DATA_FOR_RECEIVER_MODIFY in order to do receiver specific checks.

Friday, December 23, 2011

Function module to insert infotype


HR_INFOTYPE_OPERATION can be used for all the operation on infotypes.  Recently with the decoupled infotypes being introduced there were some instances where the program would give a dump when HR_INSERT_INFOTYPE_OPERATION is used.  (The dump would be something like  CL_HRPA_INFOTYPE_FACTORY======CP ....).

 There are two ways to avoid this dump -
  1)  If its a report then use the following statement in the report -

              LOAD-OF-PROGRAM.
              PERFORM do_nothing(sapfp50p).

 2) Use HR_ECM_INSERT_INFOTYPE.

     Sample code --

     Data: lref_msg TYPE REF TO cl_hrpa_message_list,
              lv_ok TYPE boole_d,
              lt_msg TYPE hrpad_message_tab.

      .....
      .....
     ASSIGN ls_pxxxx TO <record>..

     IF <record> is assigned.

           CREATE OBJECT lref_msg.
           CALL FUNCTION 'HR_ECM_INSERT_INFOTYPE'
           EXPORTING
                  pnnnn           = <record>
                  "no_auth_check   = 'X'
                  message_handler = lref_msg
           IMPORTING
                  is_ok           = lv_ok.

           CALL FUNCTION 'HR_ECM_FLUSH_INFOTYPE'
           EXPORTING
                  nocommit        = ''
                  message_handler = lref_msg
           IMPORTING
                  is_ok           = lv_ok.

          TRY.
              CALL METHOD lref_msg->get_message_list
                     IMPORTING
                            messages = lt_msg.
                     CATCH cx_hrpa_violated_assertion .
           ENDTRY.
    ENDIF.

SELECT-OPTIONS to show only single selection


Sample form to suppress tabs in select-option.............

FORM initialization .
  PERFORM selopt_no_interv.
ENDFORM.                    " initialization

*&---------------------------------------------------------------------*
*&      Form  selopt_no_interv
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM selopt_no_interv.

  DATA: restriction TYPE sscr_restrict,
        w_opt_list TYPE sscr_opt_list,
        w_ass_tab TYPE sscr_ass.

  w_opt_list-name = 'OBJECTKEY1'.
  w_opt_list-options-eq = 'X'.
  APPEND w_opt_list TO restriction-opt_list_tab.
  w_ass_tab-kind = 'S'.
  w_ass_tab-name = 'CUSOBJ'.
  w_ass_tab-sg_main = 'I'.
  w_ass_tab-sg_addy = ' '.
  w_ass_tab-op_main = 'OBJECTKEY1'.
*  w_ass_tab-op_addy = 'OBJECTKEY1'.
  APPEND w_ass_tab TO restriction-ass_tab.

  w_opt_list-name = 'OBJECTKEY2'.
  w_opt_list-options-eq = 'X'.
  APPEND w_opt_list TO restriction-opt_list_tab.
  w_ass_tab-kind = 'S'.
  w_ass_tab-name = 'EMAILS'.
  w_ass_tab-sg_main = 'I'.
  w_ass_tab-sg_addy = ' '.
  w_ass_tab-op_main = 'OBJECTKEY2'.
*  w_ass_tab-op_addy = 'OBJECTKEY2'.
  APPEND w_ass_tab TO restriction-ass_tab.

  CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
      EXPORTING
*         PROGRAM                =
           restriction            = restriction
*         DB                     = ' '
EXCEPTIONS
      too_late               = 0
      repeated               = 0
      selopt_without_options = 0
      selopt_without_signs   = 0
      invalid_sign           = 0
      empty_option_list      = 0
      invalid_kind           = 0
      repeated_kind_a        = 0
      OTHERS                 = 0.
ENDFORM.                               " SELOPT_NO_INTERV

Send Email from ABAP

Sample form to send email from ABAP using BCS method

FORM sub_send_mail.
DATA: l_message TYPE soli_tab,
l_send_result TYPE c,
l_cnt TYPE i,
l_doc_len TYPE so_obj_len,
l_subject(50) TYPE c,
l_email_body TYPE soli,
lo_sender TYPE REF TO cl_sapuser_bcs,
lo_receiver TYPE REF TO if_recipient_bcs,
lo_email TYPE REF TO cl_bcs,
lo_email_body TYPE REF TO cl_document_bcs,
lx_exception TYPE REF TO cx_bcs,


l_email_id TYPE ad_smtpadr.

* Fill the Subject Text


l_subject = 'Subject Line'.
REFRESH: l_message.
CLEAR: l_email_body.
l_email_body = '<html>'.
APPEND l_email_body TO l_message.

CLEAR: l_email_body.
l_email_body = '<body>'.
APPEND l_email_body TO l_message.

CLEAR: l_email_body.
l_email_body = '<p style="FONT-FAMILY: arial; FONT-SIZE: 12px">'.
APPEND l_email_body TO l_message.

CLEAR: l_email_body.


CONCATENATE 'Vamsi wants to send an email'
'using BCS'
INTO l_email_body SEPARATED BY space.
APPEND l_email_body TO l_message.

CLEAR: l_email_body.
l_email_body = '<br/>'.
APPEND l_email_body TO l_message.

CLEAR: l_email_body.
l_email_body = '<br/>'.
APPEND l_email_body TO l_message.

CLEAR: l_email_body.
CONCATENATE 'Second Line'
'</p>'
INTO l_email_body SEPARATED BY space.
APPEND l_email_body TO l_message.

CLEAR: l_email_body.
l_email_body = '</body>'.
APPEND l_email_body TO l_message.

CLEAR: l_email_body.
l_email_body = '</html>'.
APPEND l_email_body TO l_message.

CLEAR: l_email_body.

TRY.
lo_email = cl_bcs=>create_persistent( ).

* Get the length of the line
CLEAR l_cnt.
DESCRIBE TABLE l_message LINES l_cnt.
READ TABLE l_message INTO l_email_body INDEX l_cnt.
l_doc_len = ( l_cnt - 1 ) * 255 + STRLEN( l_email_body ).

lo_email_body = cl_document_bcs=>create_document(
i_type = 'HTM'
i_text = l_message
i_length = l_doc_len
i_subject = l_subject
i_language = sy-langu ).

lo_email->set_document( lo_email_body ).
* Sender - System User
lo_sender = cl_sapuser_bcs=>create( sy-uname ). "Use WF-BATCH for workflow batch
lo_email->set_sender( i_sender = lo_sender ).



lo_email->set_status_attributes( i_requested_status = 'E' ). "needed to avoid read receipts.

* Receiver Employee Email ID
l_email_id = 'receiver@abc.com'.
lo_receiver =
cl_cam_address_bcs=>create_internet_address( l_email_id ).
lo_email->add_recipient( i_recipient = lo_receiver
i_express = abap_true ).

lo_email->set_send_immediately( abap_true ).



lo_email->send( EXPORTING
i_with_error_screen = gc_checked
RECEIVING
result = l_send_result ).

IF l_send_result = abap_true.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = abap_true.
ENDIF.
CATCH cx_bcs INTO lx_exception.

ENDTRY.

ENDFORM. " SEND_EMAIL

Wednesday, February 2, 2011

HR INFOTYPES

Payroll

0008 - Basic Pay

0009 - Bank Details

0014 - Recurring Payments and deductions

0015 - Additional Payments

0207 - Resident Tax Area

0208 - Work Tax Area

0209 - Unemployment Insurance

0210 - W4

0211 - COBRA Beneficiaries

0212 - COBRA Health Plans


Benefits

0021 - Family

0022 - Education

0378 - Benefits Adjustment Reasons


167 - Medical Plans

168 - Insurance Plans

169 - Savings plans

170 - Flexible Spending Accounts

171 - General Benefits information


Time Infotypes

2001 - Absences

2002 - Attendances

2006 - Absence Quota

2007 - Attendance Quota

2010 - Employee Remuneration