Posts

How to add a "My Default" Button on Selection Screen

Image
This is the procedure to add "My Default" to selection screen ************************************************************************ *Source Code For MY Default Button ************************************************************************ *SAP standard Include for Variant Maintenance for User INCLUDE  rq00mf10 . ************************************************************************ *-------------------------- INITIALIZATION  ---------------------------* ************************************************************************ INITIALIZATION .   sscrfields - functxt_01  =  text - 001 .  "Default    PERFORM  variant_start_f10 .    TRY  . *      CREATE OBJECT o_input. *      CREATE OBJECT o_events_h1. "Event Handler      CATCH  cx_sy_create_object_error       cx_root .        MESSAGE  e001 .  "Error While Creating object    ENDTRY . ************************************************************************ * AT SELECTION-SCREEN ******

How to Open Outlook Mail from ABAP

We know that there is option to send mail directly from ABAP, but it uses SAP account to send email. In many cases we may not have access or configuration to send email from SAP directly. In certain scenario it might be necessary to send email with outlook, but we want SAP to populate some text/information in advance. We will be using OLE objects for the same.     DATA : lr_outlook  TYPE  ole2_object ,         lr_mi  TYPE  ole2_object ,         lv_body  TYPE  string ,         lv_sig  TYPE  string .    CREATE  OBJECT lr_outlook  'Outlook.Application' .    CALL  METHOD  OF       lr_outlook        'CreateItem'  =  lr_mi      EXPORTING       #1            =  0 .    SET  PROPERTY  OF  lr_mi  'To'  =   'firstname.lastname@domain.com' .    IF   p_emailcc <> space .      SET  PROPERTY  OF  lr_mi  'CC'  =  'mr.cc@domain.com' .    ENDIF .    SET  PROPERTY  OF  lr_mi  'Subject'  =  'Test Subject Line' .

Simplest ALV Code

Well, if not you, I reluctant to code for ALV. It's so much stereotype. And most of the boring job is to create the field catalog. Here is a quick and simple way to create ALV in just 3-4 lines of code :) To achieve this we will use the class  CL_ALV_TABLE . Even if you are not aware of object oriented programming, you can use these simple lines of codes to generate ALV report. I_TAB can be any table. You can declare it as normal table (either through type / like db table / or even OCCURS 0 type table).   DATA : lo_alv  TYPE   REF   TO  cl_salv_table,         lx_salv_msg  TYPE   REF   TO  cx_salv_msg,         l_msg( 40 )  TYPE   c  .    TRY .        CALL   METHOD  cl_salv_table=>factory *    EXPORTING *      list_display   = IF_SALV_C_BOOL_SAP=>FALSE *      r_container    = *      container_name =          IMPORTING           r_salv_table   = lo_alv          CHANGING           t_table        = i_tab           .      CATCH  cx_salv_msg  INTO  lx_salv

Function Module to get DDIC details

TFW_GET_DDIC_INFO *" IMPORTING *" REFERENCE(IV_TABNAME) TYPE TABNAME *" REFERENCE(IV_RESOLVE_SUBSTRUCTURES) TYPE TFW_BOOLEAN DEFAULT *" ' ' *" REFERENCE(IV_LANGUAGE) TYPE SPRAS DEFAULT SY-LANGU *" EXPORTING *" REFERENCE(ET_DFIES) TYPE TFW_DFIES_TAB *" EXCEPTIONS *" WRONG_CALL *" ERRONEOUS_INPUT_DATA *" DDIC_DATA_READ_FAILED *" ERROR_OCCURRED

Few Tips for Transport Request Manipulation

Image
DON’T USE THESE UNLESS ABSOLUTELY NEEDED. The purpose of transport request is to organize and move development objects from one server (say development) to other server. But sometime due to conflict in timing of different releases, we may need to move objects from one transport to other transport to release lock / dependency / to avoid transport failure due to missing object. It’s not very easy task always, especially if the Transports are complex and contain multiple components. Things get more difficult if objects are locked in one transport or the transport is partially released (few tasks are released and locked object is inside that task). These off hand tips will help developer to manipulate transport request if complex situation arises. These methods are not very advisable as this may lead to transport inconsistency if not done properly or with proper understanding of the consequences. How to toggle the status of a Transport request? Here is a transport request where o

Sample OOPS ALV with Docking Container

*&---------------------------------------------------------------------* *& Report ZACHI_TEST_ALV_DOCK *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT  zachi_test_alv_dock. CONSTANTS : n  TYPE   i   VALUE   '10' . CLASS  lcl_event_rcvr  DEFINITION  DEFERRED. DATA : go_cont  TYPE   REF   TO  cl_gui_docking_container, go_alv  TYPE   REF   TO  cl_gui_alv_grid, go_event  TYPE   REF   TO  lcl_event_rcvr, go_toolbar  TYPE   REF   TO  cl_alv_event_toolbar_set. TYPES :  BEGIN   OF  ty_data , object_id  LIKE  crmd_orderadm_h-object_id, process_type  LIKE  crmd_orderadm_h-process_type, posting_date  LIKE  crmd_orderadm_h-posting_date, style  TYPE  lvc_t_styl, END   OF  ty_data. DATA : gt_data  TYPE   STANDARD   TABLE   OF  ty_data, wa_data  TYPE  ty_data, gs_lay  TYPE  lvc_s_layo, it_fcat  TYPE  lvc_t_fcat, it_fcat2