Create New Event Type and Its Relation

Transaction code (Tcode) OOC3 dapat digunakan untuk membuat event type baru under sebuah event group. Berikut ini adalah cara untuk membuat event type object melalui progarm Z.

  1. Buat parameter input.
  2. PARAMETERS: p_stext LIKE hrp1000-stext, "object description
                p_short LIKE hrp1000-short, "objecr abbrivation
                p_begda LIKE sy-datum DEFAULT sy-datum,
                p_endda LIKE sy-datum DEFAULT '99991231',
                p_objid LIKE hrp1000-objid, "even group object
                p_kapz1 LIKE hrp1024-kapz1, "capacity
                p_kapz2 LIKE hrp1024-kapz2, "capacity
                p_kapz3 LIKE hrp1024-kapz3, "capacity
                p_text  LIKE pt1002-tline.  "description or note
    
  3. Cek valid/invalid parameter input event gropu. Cek ke table HRP1000 dengan object type L.
  4. Create event type object. Generate dulu next number untuk event type object. Bila sudah didapatkan number-nya, gunakan FM untuk insert data ke table infotype HRP1000
  5. DATA: lt_hrp1000 LIKE p1000 OCCURS 0 WITH HEADER LINE.
    lt_hrp1000-plvar = '01'.
    lt_hrp1000-otype = 'D'.
    lt_hrp1000-infty = '1000'.
    lt_hrp1000-istat = '1'.
    lt_hrp1000-begda = p_begda.
    lt_hrp1000-endda = p_endda.
    lt_hrp1000-langu = 'E'.
    lt_hrp1000-short = p_short.
    lt_hrp1000-stext = p_stext.
    
    *GENERATE DULU NUMBERNYA
    CALL FUNCTION 'RH_GET_NEXT_NUMBER'
      EXPORTING
        ext_number                 = '00000000'
        otype                      = 'D'
        plvar                      = '01'
      IMPORTING
        number                     = lt_hrp1000-objid
      EXCEPTIONS
        invalid_action             = 1
        number_must_be_zero        = 2
        invalid_object             = 3
        no_external_interval_found = 4
        no_internal_interval_found = 5
        invalid_number             = 6
        no_more_numbers_available  = 7
        OTHERS                     = 8.
    APPEND lt_hrp1000.
    
    *CRAETE EVENT TYPE
    CALL FUNCTION 'RH_INSERT_INFTY'
      EXPORTING
        vtask               = 'D'
      TABLES
        innnn               = lt_hrp1000
      EXCEPTIONS
        no_authorization    = 1
        error_during_insert = 2
        repid_form_initial  = 3
        corr_exit           = 4
        begda_greater_endda = 5
        OTHERS              = 6.
    
  6. Buat relasi antara event type dan event group ke table HRP1001
  7. DATA: lt_hrp1001 LIKE p1001 OCCURS 0 WITH HEADER LINE.
    lt_hrp1001-mandt = sy-mandt.
    lt_hrp1001-otype = 'D'.
    lt_hrp1001-objid = lt_hrp1000-objid.
    lt_hrp1001-plvar = '01'.
    lt_hrp1001-rsign = 'A'.
    lt_hrp1001-relat = '003'.
    lt_hrp1001-istat = '1'.
    lt_hrp1001-begda = p_begda.
    lt_hrp1001-endda = p_endda.
    lt_hrp1001-infty = '1001'.
    lt_hrp1001-sclas = 'L'.
    lt_hrp1001-sobid = p_objid.
    APPEND lt_hrp1001.
    
    CALL FUNCTION 'RH_INSERT_INFTY'
      EXPORTING
        vtask               = 'D'
      TABLES
        innnn               = lt_hrp1001
      EXCEPTIONS
        no_authorization    = 1
        error_during_insert = 2
        repid_form_initial  = 3
        corr_exit           = 4
        begda_greater_endda = 5
        OTHERS              = 6.
    
  8. Buat delivery method
  9. DATA: lt_hrp5007 LIKE p5007 OCCURS 0 WITH HEADER LINE.
    lt_hrp5007-mandt = sy-mandt.
    lt_hrp5007-plvar = '01'.
    lt_hrp5007-otype = 'D'.
    lt_hrp5007-objid = lt_hrp1000-objid.
    lt_hrp5007-istat = '1'.
    lt_hrp5007-begda = p_begda.
    lt_hrp5007-endda = p_endda.
    lt_hrp5007-infty = '5007'.
    lt_hrp5007-tform = '0001'.
    APPEND lt_hrp5007.
    
    CALL FUNCTION 'RH_INSERT_INFTY'
      EXPORTING
        vtask               = 'D'
      TABLES
        innnn               = lt_hrp5007
      EXCEPTIONS
        no_authorization    = 1
        error_during_insert = 2
        repid_form_initial  = 3
        corr_exit           = 4
        begda_greater_endda = 5
        OTHERS              = 6.
    
  10. Tentukan kapasitas training
  11. DATA: lt_hrp1024 LIKE p1024 OCCURS 0 WITH HEADER LINE.
    lt_hrp1024-mandt = sy-mandt.
    lt_hrp1024-plvar = '01'.
    lt_hrp1024-otype = 'D'.
    lt_hrp1024-objid = lt_hrp1000-objid.
    lt_hrp1024-istat = '1'.
    lt_hrp1024-begda = p_begda.
    lt_hrp1024-endda = p_endda.
    lt_hrp1024-infty = '1024'.
    lt_hrp1024-kapz1 = p_kapz1.
    lt_hrp1024-kapz2 = p_kapz2.
    lt_hrp1024-kapz3 = p_kapz3.
    APPEND lt_hrp1024.
    
    CALL FUNCTION 'RH_INSERT_INFTY'
      EXPORTING
        vtask               = 'D'
      TABLES
        innnn               = lt_hrp1024
      EXCEPTIONS
        no_authorization    = 1
        error_during_insert = 2
        repid_form_initial  = 3
        corr_exit           = 4
        begda_greater_endda = 5
        OTHERS              = 6.
    
  12. Buat description business event type content
  13. DATA: lt_txt1002 LIKE pt1002 OCCURS 0 WITH HEADER LINE.
    lt_txt1002-tline = p_text.
    APPEND lt_txt1002.
    
    CALL FUNCTION 'RH_OBJECT_DESCRIPTION_WRITE'
      EXPORTING
        plvar                = '01'
        otype                = 'D'
        objid                = lt_hrp1000-objid
        begda                = p_begda
        endda                = p_endda
        subty                = '0002'
      TABLES
        ptxt1002             = lt_txt1002
      EXCEPTIONS
        object_not_found     = 1
        description_required = 2
        no_authority         = 3
        error_during_insert  = 4
        invalid_date         = 5
        undefined            = 6
        OTHERS               = 7.
    

Hope it helps.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s