Thursday, 21 March 2013

Parallel Cursor Method

 SORT: lt_vbpa BY kunnr,  "Sorting by key is very important
      lt_kna1 BY kunnr.  "Same key which is used for where condition is used here
LOOP AT lt_vbpa INTO wa_vbpa.
  READ lt_kna1 INTO wa_kna1     " This sets the sy-tabix
       WITH KEY kunnr = wa_vbpa-kunnr
       BINARY SEARCH.
  IF sy-subrc = 0.              "Does not enter the inner loop
    v_kna1_index = sy-tabix.
    LOOP AT lt_kna1 INTO wa_kna1 FROM v_kna1_index. "Avoiding Where clause
      IF wa_kna1-kunnr <> wa_vbpa-kunnr.  "This checks whether to exit out of loop
        EXIT.
      ENDIF.

****** Your Actual logic within inner loop ******

    ENDLOOP.                                                "KNA1 Loop
  ENDIF.
ENDLOOP.  " VBPA Loop 

Friday, 1 March 2013

Removing buttons in Oops Editable ALV

below is the code to remove all buttons except  plus +  and - minus push buttons.


   lw_exclude = cl_gui_alv_grid=>mc_fc_maximum .
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_minimum .
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_subtot .
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_sum .
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_average .
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_mb_sum .
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_mb_subtot .
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_sort_asc.
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_sort_dsc .
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_print .
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_views.
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_pc_file .
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_graph .
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_loc_copy .
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_loc_cut .
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_loc_undo .
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_refresh .
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_check .
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_detail .
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_filter .
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row .
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_loc_copy .
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_loc_cut .
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_find.
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_help .
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_mb_export.
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_load_variant.
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_save_variant.
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_current_variant.
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_maintain_variant.
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_mb_variant.
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_html.
  APPEND lw_exclude TO gt_exclude.
  lw_exclude = cl_gui_alv_grid=>mc_fc_info.
  APPEND lw_exclude TO gt_exclude.



At last pass this Gt_exclude to the method as below.

  CALL METHOD gcl_cl_gui_alv_grid->set_table_for_first_display
  EXPORTING
*    I_BUFFER_ACTIVE               =
*    I_BYPASSING_BUFFER            =
*    I_CONSISTENCY_CHECK           =
*    I_STRUCTURE_NAME              =
*    IS_VARIANT                    =
*    I_SAVE                        =
        i_default                     = 'X'
*    IS_LAYOUT                     =
*    IS_PRINT                      =
*    IT_SPECIAL_GROUPS             =
        it_toolbar_excluding          = gt_exclude*    IT_HYPERLINK                  =
*    IT_ALV_GRAPHICS               =
*    IT_EXCEPT_QINFO               =
      CHANGING
        it_outtab                     = gt_conid
        it_fieldcatalog               = gt_fieldcat
*    IT_SORT                       =
*    IT_FILTER                     =
*  EXCEPTIONS
*    INVALID_PARAMETER_COMBINATION = 1
*    PROGRAM_ERROR                 = 2
*    TOO_MANY_LINES                = 3
*    others                        = 4
            .
    IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.


Tuesday, 19 February 2013

Module Pool : To make few fields in a screen to INVISIBLE



Group a number of fields ( whether it is input or output  doesn't matter ) , give a group name to it.
Check the below example using group name.


Below is the example



  LOOP AT SCREEN.
    IF screen-group1 = '001'.
      screen-invisible = '1'.
      screen-input = '0'.
      screen-output = '0'.
      screen-active = '0'.
      MODIFY SCREEN.
    ENDIF.

   IF screen-group2 = '111'.
      screen-input = '0'.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

Wednesday, 3 October 2012

What’s an ALV field catalog?

In order to display some tabular data in an ALV, the ALV needs some information about the columns/ fields which will be displayed in the ALV. Field catalog is basically the internal table which carries information about each of the columns/ fields with which ALV has to deal with. It need not necessarily contain information about each of the columns/ fields in the data table used as data source of ALV. Only the fields which are important for display or of some technical use for ALV need to be informed to ALV through field catalog.

Standard program for Enabling and disabling MS word in Smartforms and Scripts

RSCPSETEDOTOR

Friday, 6 July 2012

Difference between CALL TRANSACTION and SESSION Method


Call Transaction method
Classical or session method
In this method, the ABAP/4 program uses the call transaction <T-code > using <bdc_tab> mode <mode> update <update >  method.
In this method, ABAP/4 program read the external data that is to be entered to the SAP system and stores the data in the batch input session.
When the prgm has finished creating the session, we can run the session thro the TC SM35. This method involves FM like BDC_OPEN,BDC_INSERT,BDC_CLOSE 
In ‘Call Transaction’, the transactions are triggered at the time of processing itself and so the ABAP program must do the error handling.
Whereas in Batch Input Sessions, the ABAP
program creates a session with all the transactional data, and this session can be viewed, scheduled and processed (using
Transaction SM35) at a later time. The latter technique has a built-in error processing mechanism too.
Synchronous Processing
Asynchronous Processing 
We can update the database both synchronously and asynchronously. We can specify the mode in the program.
 
Synchronous Database update.
During processing, no transaction is started until the previous transaction has been written to the database.
No batch input processing log
 
Detailed Log will be generated for all the sessions
While execution it starts from the first.
 
While executing it wont start from the first. It will start from the place where it ends with error.
Faster than session method
Not as fast as call transaction method