Tuesday, August 14, 2018

ALV FCAT EXAMPLE

  CLEAR ls_fcat.
  ls_fcat-fieldname 'PRODH-PRODH1'.
  ls_fcat-seltext_s ls_fcat-seltext_m ls_fcat-seltext_l 'Business Segment Code'.
  APPEND ls_fcat TO gt_fcat.

  CLEAR ls_fcat.
  ls_fcat-fieldname 'PRODH-PRODH2'.
  ls_fcat-seltext_s ls_fcat-seltext_m ls_fcat-seltext_l 'Brand Code'.
  APPEND ls_fcat TO gt_fcat.

  CLEAR ls_fcat.
  ls_fcat-fieldname 'MATKL'.
  ls_fcat-ref_tabname 'VBRP'.
  ls_fcat-ref_fieldname 'MATKL'.
  APPEND ls_fcat TO gt_fcat.




  DATA ls_layout TYPE slis_layout_alv.
  ls_layout-colwidth_optimize 'X'.

  DATA ls_variant TYPE disvariant.
  ls_variant-report sy-repid.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      is_layout     ls_layout
      i_save        'A'
      is_variant    ls_variant
      it_fieldcat   gt_fcat
    TABLES
      t_outtab      gt_out
    EXCEPTIONS
      program_error 1
      OTHERS        2.
  IF sy-subrc <> 0.
* Implement
  ENDIF.

ABAP GUIDS



  DATA lv_guid TYPE sysuuid_c22.



  TRY.
      CALL METHOD cl_system_uuid=>if_system_uuid_static~create_uuid_c22
        RECEIVING
          uuid lv_guid.
      .
    CATCH cx_uuid_error .
      .
  ENDTRY.

ABAP EXCEL OLE


  CREATE OBJECT lv_application 'Excel.Application'
 CALL METHOD OF
      lv_application
      'Workbooks'    lv_workbook

CALL METHOD OF
      lv_workbook
      'Open'
   
    EXPORTING
      #1          lv_filename.


  GET PROPERTY OF lv_application 'ACTIVESHEET' lv_worksheet
                NO FLUSH.


  CALL METHOD OF
      lv_worksheet
      'Cells'      lv_cell
      NO
      FLUSH

    EXPORTING
      #1           lv_start_row
      #2           lv_start_col.