Search help untuk memilih organizational unit

berikut ini adalah pemograman sederhana yang bisa digunakan untuk kebutuhan menampilkan search help untuk memilih organizational unit.

INCLUDE rhxmacro.

TABLES: pchdy.
DATA  : subrc LIKE sy-subrc.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS:     p_plvar LIKE pchdy-plvar NO-DISPLAY DEFAULT '01',
p_otype LIKE pchdy-otype NO-DISPLAY DEFAULT 'O'.
SELECT-OPTIONS: s_objid FOR pchdy-objid_seq NO INTERVALS.
SELECTION-SCREEN END OF BLOCK b1.

INITIALIZATION.
%_s_objid_%_app_%-text = 'Organizational unit'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_objid-low.
rhx-f4-objid-data.
rhx-f4-objid-low p_plvar p_otype s_objid '' ''.

atau bisa juga dengan langsung menggunakan function module seperti coding berikut ini.

TABLES: hrp1000.
DATA: sel_object TYPE objec,
      sel_hrobject_tab LIKE hrobject OCCURS 0 WITH HEADER LINE.
SELECT-OPTIONS: s_objid FOR hrp1000-objid NO INTERVALS.

INITIALIZATION.
  %_s_objid_%_app_%-text = 'Organizational unit'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_objid-low.
  CALL FUNCTION 'RH_OBJID_REQUEST'
    EXPORTING
      plvar            = '01'
      otype            = 'O'
      seark_begda      = sy-datum
      seark_endda      = sy-datum
      set_mode         = 'X'
      orgbeg           = sy-datum
      orgend           = sy-datum
    IMPORTING
      sel_object       = sel_object
    TABLES
      sel_hrobject_tab = sel_hrobject_tab
    EXCEPTIONS
      cancelled        = 1
      wrong_condition  = 2
      nothing_found    = 3
      internal_error   = 4
      illegal_mode     = 5
      OTHERS           = 6.
  IF sy-subrc EQ 0.
    LOOP AT sel_hrobject_tab.
      s_objid-low = sel_hrobject_tab-objid.
      APPEND s_objid.
    ENDLOOP.
  ENDIF.
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