Sunday, 15 October 2017

Delete WBS Element

1. TCode OPSX : Check Budget
2. TCode CJ20N : Delete Project and Sub Project
3. Table VSPRPS_CN : Delete WBS Element by function SE16N_INTERFACE

Wednesday, 10 May 2017

How to Reset different SAP buffers

SAP Buffers can be reset with below commands :

  1. /$SYNC - Resets the buffers of the application server
  2. /$CUA - Resets the CUA buffer of the application server
  3. /$TAB - Resets the TABLE buffers of the application server
  4. /$NAM - Resets the nametab buffer of the application server
  5. /$DYN - Resets the screen buffer of the application server
  6. /$ESM - Resets the Exp./ Imp. Shared Memory Buffer of the application server
  7. /$PXA - Resets the Program (PXA) Buffer of the application server.
  8. /$OBJ - Resets the Shared Buffer of the application server.
SU53 and click authorization values —> Reset User Buffer.
SU01 -> environment -> mass changes -> reset all user buffers
Executing transaction PFUD or running program RHAUTUPD_NEW
se38 and program: RSUSR405

Ref. https://wiki.scn.sap.com/wiki/display/Basis/How+to+Reset+different+SAP+buffers

Wednesday, 15 March 2017

Transaction

Transaction Description

cf01,02,03 Production Resoure/Tool (PRT)
cmod                Project Management of SAP Enhancements
cr01,02,03 Work Center Capacity
db13                Check Tape Backup
mb52               Check Stock Material
mmpv              Close Period for Material Master Records
msc1n              Create Batch
oaor                 Upload Word and Excel File
pa40                Personal Actions (สถานะการทำงาน)
pdsy                HR Documentation ไว้ดูฟังก์ชันสำหรับเขียน Schema
pe01                Schema Editor
pe02                Personal Calculation Rules (PCR)
pe04                Maintain Function and Operation
pfcg                 Create Role
se03                 ใช้สำหรับ Release จาก DEV ไปที่ QA
se11                 Database Table, Type
se16n               เรียกดู Table
se19                 BADI
se20                 Enhancements
se22                 Check Error
se24                 Class
se30                 ใช้ดูค่า Config / ABAP Runtime Analysis
se37                 Function Module
se61                 Document Maintenance
se71                 Form Painter, SAPScript
se80                 หน้า Object Navigator
se91                 Message Class
se93                 Create Transaction Code
shdb                 Create Screen BDC
sm12                Table Lock
sm30                Maintain Table View, เพิ่มข้อมูล Table แบบ Config
sm36                Define Background Job
sm50                Check Process Job
sm59                Configuration of RFC Connections
smartforms      SAP Smart Forms
snro                 Number Range
so10                 สำหรับ Print, สร้าง Standard Text, Include Text
spad                 เกี่ยวกับการ Print
spro                 User Exit, Customizing
st05                 Performance Analysis
st22                 Error Message ของ User
stms                Transport Request
su01                Edit Password User or Lock, Unlock
su10                User Maintenance
su3                  สำหรับ Set Default Printer

Sunday, 12 March 2017

Class Timer in PBO Screen


Declaration Variable


   CLASS  xcl_event_receiver      DEFINITION DEFERRED.
   DATA: xo_timer  TYPE  REF TO cl_gui_timer.
   DATA: xo_event  TYPE  REF TO xcl_event_receiver.

          ___________________________________________________________________________


CLASS xcl_event_receiver DEFINITION.
  PUBLIC SECTION.

    CLASS-METHODS:
      timer_finished       FOR EVENT  finished
                                  OF  cl_gui_timer.

ENDCLASS.               

CLASS xcl_event_receiver IMPLEMENTATION.

      METHOD timer_finished.
             Do anything....
   ENDMETHOD. 
               
ENDCLASS.       

          ___________________________________________________________________________

PBO : Status_0100

MODULE status_0100 OUTPUT.
  SET PF-STATUS 'TOOLBAR'.
  
  IF xo_timer IS INITIAL.
    CREATE OBJECT xo_timer
      EXCEPTIONS
        OTHERS = 4.

    CHECK sy-subrc EQ  0.
    CREATE OBJECT xo_event.
  ENDIF.

  SET HANDLER xo_event->timer_finished FOR xo_timer.

  xo_timer->interval = 1.

  "Create Container and ALV...

  xo_timer->run( ).

ENDMODULE.

Get Extension File

Func : TRINT_FILE_GET_EXTENSION

ABAP Easy Message Log

type-pools: ESP1 .
data:
LT_MESSAGE_TAB type ESP1_MESSAGE_TAB_TYPE ,
LS_MESSAGE_TAB type ESP1_MESSAGE_WA_TYPE.
         LS_MESSAGE_TAB-MSGID = 'AD' .
         LS_MESSAGE_TAB-MSGTY = 'W' .
         LS_MESSAGE_TAB-MSGNO = '010' .
         LS_MESSAGE_TAB-MSGV1 = TEXT-001.
append LS_MESSAGE_TAB to LT_MESSAGE_TAB .
call function 'C14Z_MESSAGES_SHOW_AS_POPUP'
tables
             I_MESSAGE_TAB = LT_MESSAGE_TAB.

Reading URL of GOS

by using Function module              SO_OBJECT_READ



 * Set folder
  l_folder_id-objtp = document_id-foltp.“FOL  
  l_folder_id-objyr = document_id-folyr.“29
  l_folder_id-objno = document_id-folno.“000000000004
* Set Object
  l_object_id-objtp = document_id-doctp.“URL   
  l_object_id-objyr = document_id-docyr.“38
  l_object_id-objno = document_id-docno.“000000001457
*
  CALL FUNCTION 'SO_OBJECT_READ'
    EXPORTING
     folder_id                  = l_folder_id
      object_id                  = l_object_id
    TABLES
      objcont                    = document_content

instid_b can be get from  1)  table: SRGBTBREL 2) cl_binary_relation=>read_links from http://zevolving.com/2009/02/generic-object-services-gos-toolbar-part-5-get-note-attachment-contents/


PARAMETERS: p_ord TYPE afko-aufnr.
*
START-OF-SELECTION.
*
*---------
* Get all the NOTE attached to Business object
*---------
*
* buseinss object key
  DATA: gs_lpor TYPE sibflporb.

  gs_lpor-instid = p_ord. “Prd Order 
  gs_lpor-typeid = 'BUS2005'.
  gs_lpor-catid  = 'BO'.

* attachment type selection
  DATA: lt_relat TYPE obl_t_relt,
        la_relat LIKE LINE OF lt_relat.

  la_relat-sign = 'I'.
  la_relat-option = 'EQ'.
  la_relat-low = 'URL'.
 APPEND la_relat TO lt_relat.

* Read the links
  DATA: t_links TYPE obl_t_link,
        la_links LIKE LINE OF t_links.

  DATA: lo_root TYPE REF TO cx_root.

  TRY.
      CALL METHOD cl_binary_relation=>read_links
        EXPORTING
          is_object           = gs_lpor
          it_relation_options = lt_relat
        IMPORTING
          et_links            = t_links.
    CATCH cx_root INTO lo_root.
  ENDTRY.

*---------
* Read NOTE contents
*---------
  DATA l_folder_id TYPE soodk.
  DATA l_object_id TYPE soodk.
  DATA document_id       TYPE sofmk.
* Get document id
  READ TABLE t_links INTO la_links INDEX 1.
  document_id = la_links-instid_b.

* Set folder
  l_folder_id-objtp = document_id-foltp.
  l_folder_id-objyr = document_id-folyr.
  l_folder_id-objno = document_id-folno.

* Set Object
  l_object_id-objtp = document_id-doctp.
  l_object_id-objyr = document_id-docyr.
  l_object_id-objno = document_id-docno.

* Read the document content
  DATA document_content  TYPE STANDARD TABLE OF soli.

  CALL FUNCTION 'SO_OBJECT_READ'
    EXPORTING
      folder_id                  = l_folder_id
      object_id                  = l_object_id
    TABLES
      objcont                    = document_content.

Get Ole2 object from SOI document object

Method GET_DOCUMENT_HANDLE of  I_OI_DOCUMENT_PROXY
return exporting parameter: HANDLE (structure type CNTL_HANDLE )

CNTL_HANDLE-OBJ has type OBJ_RECORD, same as OLE2_OBJECT in Type group  OLE2.

 OLE2_OBJECT can be used by statement CALL METHOD OF, SET PROPERTY OF, SET PROPERTY OF, Function Module CONTROL_GET_PROPERTY, or Function Module CONTROL_SET_PROPERTY. 

Tuesday, 28 February 2017

PRT for operation

Case 1 :
   AFKO-AUFPL = AFFH-AUFPL

Case 2 : Table
  MAPL , PLPO , PLAS , PLFH

Wednesday, 22 February 2017

VB For Application - Object Browser


1. Open Excel or Word.
2. Hold Alt + F11 for open Microsoft Visual Basic for Applications

3. Click button Object Browser.






ABAP OLE Programming for Excel


DATA: h_excel TYPE ole2_object,        " Excel object
        h_mapl TYPE ole2_object,         " list of workbooks
        h_map TYPE ole2_object,          " workbook
        v_filename TYPE string VALUE 'C:\Users\phoonookan\Desktop\1111.xlsx'.

  CREATE OBJECT h_excel 'EXCEL.APPLICATION'.
  SET PROPERTY OF h_excel  'Visible' = 1.
  CALL METHOD OF h_excel 'Workbooks' = h_mapl.
  CALL METHOD OF h_mapl 'Open' = h_map
    EXPORTING
    #1 = v_filename.

*CALL METHOD OF h_map 'PrintOut'.
  CALL METHOD OF h_map 'PrintPreview'.
  CALL METHOD OF h_mapl 'Close'.

Tuesday, 14 February 2017

MS word editor in Smartforms


Go to se38
Run RSCPSETEDITOR
     Check is SAPscript and Smart Form boxes Active.
     Uncheck is SAPscript and Smart Form boxes Inactive.
And click in Activate button.

Monday, 23 January 2017

Emphasize in ALV

Emphasize is a 4-char field where :
     - 1st char = C (color property)
     - 2nd char = color code (from 0 to 7)
          0 = background color
          1 = blue
          2 = gray
          3 = yellow
          4 = blue/gray
          5 = green
          6 = red
          7 = orange
     - 3rd char = intensified (0=off, 1=on)
     - 4th char = inverse display (0=off, 1=on)