Monday, March 11, 2019

⇨⇨⇨ZHR_LIBRARY⇦⇦⇦ HR Library Function Modules

because my work always depends on fast tack on our project so i decided to make a few helpful function module. and grouping em inside ZHR_LIBRARY


  • ZFM_FUNC9004


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
FUNCTION zfm_func9004.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(STATUS) TYPE  ZDE_DEVSTS OPTIONAL
*"     VALUE(READ_ONLY) TYPE  CHAR1 OPTIONAL
*"     VALUE(PERNR) TYPE  PERNR_D
*"     VALUE(NOTE) TYPE  STRING OPTIONAL
*"     VALUE(ZSTRUC) TYPE  ZTB_GUIDMAP_9004 OPTIONAL
*"  EXPORTING
*"     VALUE(RETURN) TYPE  CHAR255
*"     VALUE(RT_TYPE) TYPE  CHAR1
*"     VALUE(GUID) TYPE  GUID_32
*"  TABLES
*"      DATA STRUCTURE  ZTB_GUIDMAP_9004
*"----------------------------------------------------------------------
  DATA : lt_table TYPE TABLE OF ztb_guidmap_9004,
         struc TYPE ztb_guidmap_9004,
         lx_table TYPE ztb_guidmap_9004,
         error TYPE char1,
         ename TYPE emnam,
         lx_note TYPE ztb_guidmap_note.

      DATA tabix TYPE sy-tabix.

*  CALL FUNCTION 'GUID_CREATE'
*       IMPORTING
*       ev_guid_32 = zstruc-guid.

  SELECT * FROM ztb_guidmap_9004 INTO CORRESPONDING FIELDS OF TABLE lt_table WHERE pernr = pernr.

  IF read_only IS NOT INITIAL.


    SORT lt_table DESCENDING BY guid status_item.
    DELETE ADJACENT DUPLICATES FROM lt_table COMPARING guid.
*    READ TABLE lt_table INTO lx_table WITH KEY zjadwal = zstruc-zjadwal zlokasi = zstruc-zlokasi ztraining = zstruc-ztraining.
**  IF sy-subrc eq 0.
*    IF lx_table-status_item NE '6' AND sy-subrc EQ 0.
*      return = 'This data is already exist. duplicate data is prohibitied.'.
*      rt_type = 'E'.
*
*      IF lx_table-status_item EQ '0'.
*        CLEAR : return, rt_type.
*
**        lx_table-guid = zstruc-guid.
**        lx_table-status_item = '1'.
**        INSERT ztb_guidmap_9004  FROM lx_table.
**        COMMIT WORK.
**        return = 'Data Has been saved.'.
**        rt_type = 'S'.
**        GUID = lx_table-guid.
*      ENDIF.
*    endif.
**    ELSE.

      DELETE lt_table WHERE status_item EQ '6'.
      DELETE lt_table WHERE zyear NE sy-datum(4).
*   IF sy-subrc eq 0.
      DESCRIBE TABLE lt_table LINES tabix.
      IF tabix GE '2'.
      RETURN = 'Plan Quota is Full. Only 2 Training a year.'.
      RT_TYPE = 'E'.
      ENDIF.
*   ENDIF.
  ELSE.

    SORT lt_table DESCENDING BY guid status_item.
    DELETE ADJACENT DUPLICATES FROM lt_table COMPARING guid.
    READ TABLE lt_table INTO lx_table WITH KEY zjadwal = zstruc-zjadwal zlokasi = zstruc-zlokasi ztraining = zstruc-ztraining.
*  IF sy-subrc eq 0.
    IF lx_table-status_item NE '6' AND sy-subrc EQ 0.
      return = 'This data is already exist. duplicate data is prohibitied.'.
      rt_type = 'E'.

      IF lx_table-status_item EQ '0'.
        CLEAR : return, rt_type.

*        lx_table-guid = zstruc-guid.
        lx_table-status_item = '1'.
        INSERT ztb_guidmap_9004  FROM lx_table.
        COMMIT WORK.
        return = 'Data Has been saved.'.
        rt_type = 'S'.
        GUID = lx_table-guid.
      ENDIF.
*    endif.
    ELSE.

      DELETE lt_table WHERE status_item EQ '6'.
      DELETE lt_table WHERE zyear NE sy-datum(4).
*   IF sy-subrc eq 0.
      DESCRIBE TABLE lt_table LINES tabix.
      IF tabix GE '2'.
      RETURN = 'Plan Quota is Full. Only 2 Training a year.'.
      RT_TYPE = 'E'.
      ENDIF.
*   ENDIF.

      CHECK rt_type IS INITIAL.
      CALL FUNCTION 'GUID_CREATE'
        IMPORTING
          ev_guid_32 = zstruc-guid.

      guid = zstruc-guid.
      INSERT ztb_guidmap_9004 FROM zstruc.
      COMMIT WORK.
      IF sy-subrc EQ 0.

        return = 'Data Has been saved.'.
        rt_type = 'S'.
      ELSE.

        return = 'Data Has not been saved.'.
        rt_type = 'E'.
      ENDIF.
      CHECK note IS NOT INITIAL.

      CALL FUNCTION 'ZHR_GET_UID'
        EXPORTING
          user      = sy-uname
*         IMP_PERNR =
        IMPORTING
*         PERNR     =
*         SUBRC     =
          ename     = ename.


      lx_note-guid    = zstruc-guid   .
*    lx_note-SEQNR   = ZSTRUC-SEQNR  .
      lx_note-usnt    = sy-uname   .
      lx_note-udat    = sy-datum   .
      lx_note-uzet    = sy-uzeit   .
      lx_note-cnam    = ename   .
      lx_note-wiid    = ''   .
      lx_note-note    = note      .

      IF zstruc-status_item EQ '1'.
        lx_note-seqnr = '1'.
      ENDIF.

      INSERT ztb_guidmap_note FROM lx_note.

      return = 'Data Has been saved.'.
      rt_type = 'S'.
    ENDIF.

*commencing Workflow
*CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'" IN BACKGROUND TASK AS SEPARATE UNIT
*    EXPORTING
*      object_type     = 'ZBORLVRQST'
**     object_type     = 'ZPERINFO'
*      object_key      = objkey
*      event           = 'Action'
*      commit_work     = ' '
*      event_language  = sy-langu
*      language        = sy-langu
*      user            = sy-uname
*    TABLES
*      input_container = lt_cont
*      message_lines   = lt_msglines
*      message_struct  = lt_msgstruc.

  ENDIF.


  data[] = lt_table[].
ENDFUNCTION.

  • ZHR_ACTIO_INFTY


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
FUNCTION ZHR_ACTIO_INFTY.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(INFTY) TYPE  CHAR4
*"     REFERENCE(OPERATION) TYPE  PSPAR-ACTIO
*"     VALUE(RECORD)
*"     REFERENCE(PERNR) TYPE  PERNR_D
*"     REFERENCE(BEGDA) TYPE  DATUM
*"     REFERENCE(ENDDA) TYPE  DATUM
*"  EXPORTING
*"     REFERENCE(SUBRC) TYPE  C
*"----------------------------------------------------------------------
FIELD-SYMBOLS <GUID>.
FIELD-SYMBOLS <seqnr>.
DATA :
seqnr     TYPE p9004-seqnr,
INFTp     type  PRELP-INFTY    ,
NUMBER    type  P0001-PERNR    ,
*RECORD                         ,
OPERA   type  PSPAR-ACTIO    ,
RETURN    type  BAPIRETURN1    ,
KEY       type  BAPIPAKEY      .

INFTp = INFTy.
NUMBER = PERNR.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
  EXPORTING
    number        = NUMBER
 IMPORTING
   RETURN        = RETURN
          .
OPERA = OPERATION.

IF opera eq 'DEL'.
  DATA : lt_x9004 TYPE TABLE OF p9004.
  DATA : lx_x9004 TYPE p9004.
  CALL FUNCTION 'RH_READ_INFTY_NNNN'
    EXPORTING
*     AUTHORITY                   = 'DISP'
*     WITH_STRU_AUTH              = 'X'
      PLVAR                       = '01'
      OTYPE                       = 'P'
      OBJID                       = PERNR
      infty                       = '9004'
*     ISTAT                       = ' '
*     EXTEND                      = 'X'
*     SUBTY                       = ' '
*     BEGDA                       = '19000101'
*     ENDDA                       = '99991231'
*     CONDITION                   = '00000'
*     INFTB                       = '1'
*     SORT                        = 'X'
    tables
      innnn                       = lt_x9004
*     OBJECTS                     =
    EXCEPTIONS
      NOTHING_FOUND               = 1
      WRONG_CONDITION             = 2
      INFOTYP_NOT_SUPPORTED       = 3
      WRONG_PARAMETERS            = 4
      OTHERS                      = 5
            .
  IF sy-subrc <> 0.
* Implement suitable error handling here
    ELSE.
      SORT lt_x9004 DESCENDING by zguid zstatus .
      ASSIGN COMPONENT 'ZGUID' OF STRUCTURE RECORD to <GUID>.
      IF <GUID> IS ASSIGNED.
         READ TABLE lt_x9004 INTO lx_x9004 WITH KEY ZGUID = <GUID>.
      IF sy-subrc eq 0.
        MOVE-CORRESPONDING lx_x9004 to RECORD.
        ASSIGN COMPONENT 'SEQNR' OF STRUCTURE record to <seqnr>.
        IF <seqnr> IS ASSIGNED.
          seqnr = <seqnr>.
        ENDIF.
      ENDIF.
      ENDIF.

  ENDIF.

ENDIF.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'
  EXPORTING
    infty                  = INFTp
    number                 = NUMBER
*   SUBTYPE                =
*   OBJECTID               =
*   LOCKINDICATOR          =
    VALIDITYEND            =  endda
    VALIDITYBEGIN          =  begda
   RECORDNUMBER            = seqnr
    record                 =  RECORD
    operation              = OPERA
    TCLAS                  = 'A'
    DIALOG_MODE            = '0'
    NOCOMMIT               = space
*   VIEW_IDENTIFIER        =
*   SECONDARY_RECORD       =
 IMPORTING
   RETURN                 = RETURN
   KEY                    = KEY
          .

IF return-id IS INITIAL.
  commit WORK.
  SUBRC = 'S'.
ELSE.
  subrc = return-id.
ENDIF.

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
  EXPORTING
    number        = NUMBER
 IMPORTING
   RETURN        = RETURN
          .



ENDFUNCTION.

  • ZHR_GET_1000


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
FUNCTION ZHR_GET_1000.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(PERNR) TYPE  PERNR_D
*"     REFERENCE(OBJID) TYPE  SOBID
*"     REFERENCE(TEXT) TYPE  CHAR1 OPTIONAL
*"     REFERENCE(OTYPE) TYPE  OTYPE OPTIONAL
*"     REFERENCE(JADWAL) TYPE  CHAR1 OPTIONAL
*"  EXPORTING
*"     REFERENCE(NAME) TYPE  CHAR50
*"     REFERENCE(CHARACTERISTIC) TYPE  CHAR1
*"  CHANGING
*"     REFERENCE(BEGDA) TYPE  DATUM OPTIONAL
*"     REFERENCE(ENDDA) TYPE  DATUM OPTIONAL
*"----------------------------------------------------------------------
DATA : p1000 TYPE TABLE OF p1000,
       x1000 TYPE p1000,
       xOBJID TYPE  OBJEC-OBJID,
       xQUALIFID type  HRWPC_S_QUALIFICATION-QUALIFID,
       qual_tab TYPE   HRWPC_T_QUALIFICATION,
       xqual_tab TYPE HRWPC_S_QUALIFICATIOn,
       iobjid TYPE PLOG-OBJID.

IF BEGDA IS INITIAL.
   begda = '19000101'.
ENDIF.

IF ENDDA IS INITIAL.
   endda = '99991231'.
ENDIF.

if text IS INITIAL.
iobjid = OBJID.

CALL FUNCTION 'RH_READ_INFTY_1000'
 EXPORTING
   AUTHORITY              = 'DISP'
   WITH_STRU_AUTH         = 'X'
   PLVAR                  = '01'
   OTYPE                  = 'Q'
   OBJID                  = iobjid
   ISTAT                  = ' '
   EXTEND                 = 'X'
   BEGDA                  = BEGDA
   ENDDA                  = ENDDA
   CONDITION              = '00000'
   SORT                   = 'X'
  TABLES
    i1000                  = p1000
*   OBJECTS                =
  EXCEPTIONS
    NOTHING_FOUND          = 1
    WRONG_CONDITION        = 2
    WRONG_PARAMETERS       = 3
    OTHERS                 = 4
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

xobjid    = PERNR.
xqualifid = OBJID(8).
CALL FUNCTION 'HRWPC_RFC_QUALIFICATION_STAFF'
  EXPORTING
    PLVAR                    = '01'
    otype                    = 'P'
    objid                    = xobjid
    qualifid                 = xqualifid
 IMPORTING
   STAFF_QUALIFIC_TAB       = qual_tab
 EXCEPTIONS
   NOTHING_FOUND            = 1
   OTHERS                   = 2
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

READ TABLE p1000 INTO x1000 WITH KEY  endda = '99991231'.
IF sy-subrc eq 0.
NAME = x1000-stext.
ENDIF.

READ TABLE qual_tab INTO xqual_tab INDEX 1.
characteristic =  xqual_tab-characteristic.

ELSE.

iobjid = OBJID.
CALL FUNCTION 'RH_READ_INFTY_1000'
 EXPORTING
   AUTHORITY              = 'DISP'
   WITH_STRU_AUTH         = 'X'
   PLVAR                  = '01'
   OTYPE                  = OTYPE
   OBJID                  = iobjid
*   ISTAT                  = '1'
   EXTEND                 = 'X'
   BEGDA                  = BEGDA
   ENDDA                  = ENDDA
   CONDITION              = '00000'
   SORT                   = 'X'
  TABLES
    i1000                  = p1000
*   OBJECTS                =
  EXCEPTIONS
    NOTHING_FOUND          = 1
    WRONG_CONDITION        = 2
    WRONG_PARAMETERS       = 3
    OTHERS                 = 4
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

*BEGDA
*ENDDA
READ TABLE p1000 INTO x1000 WITH KEY otype = OTYPE endda = ENDDA.
IF sy-subrc eq 0.
  NAME = x1000-stext.
ENDIF.

IF jadwal IS NOT INITIAL.
  sort p1000 DESCENDING by endda.

  READ TABLE p1000 INTO x1000 INDEX 1.
  IF sy-subrc eq 0.
DATA : LV_BEGDA TYPE C LENGTH 10.
DATA : LV_ENDDA TYPE C LENGTH 10.
DATA : TEXT2 TYPE C LENGTH 40.
        CONCATENATE x1000-begda+6(2) '.' x1000-begda+4(2) '.'
         x1000-BEGDA(4) INTO LV_BEGDA.
        CONCATENATE x1000-ENDDA+6(2) '.' x1000-ENDDA+4(2) '.'
         x1000-ENDDA(4) INTO LV_ENDDA.
         CONCATENATE LV_BEGDA '-' LV_ENDDA INTO TEXT2 SEPARATED BY SPACE.
         name = TEXT2.
  ENDIF.
ENDIF.

ENDIF.
ENDFUNCTION.

  • ZHR_GET_APPUID


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
FUNCTION ZHR_GET_APPUID.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(PERNR) TYPE  PERNR_D
*"  EXPORTING
*"     REFERENCE(APP_PERNR) TYPE  PERNR_D
*"     REFERENCE(APP_MAIL) TYPE  COMM_ID_LONG
*"     REFERENCE(APP_NAME) TYPE  EMNAM
*"----------------------------------------------------------------------

DATA :  lv_PERNR TYPE  PERNR_D         ,
        lv_SUBRC TYPE  SUBRC           ,
        lv_ENAME TYPE  EMNAM           ,
        lv_MAIL  TYPE  COMM_ID_LONG    ,
        lx_pa0001 TYPE pa0001,
        lxa_1001 TYPE hrp1001,
        lxb_1001 TYPE hrp1001,
        objid    TYPE hrobjid.

SELECT SINGLE * FROM pa0001 into CORRESPONDING FIELDS OF lx_pa0001
  WHERE endda = '99991231' AND pernr = pernr.
  CHECK lx_pa0001 IS NOT INITIAL.
  objid = lx_pa0001-plans.

  SELECT SINGLE * FROM hrp1001 INTO CORRESPONDING FIELDS OF lxa_1001
    WHERE endda = '99991231' AND objid = objid AND otype = 'S'
    AND relat = '002' AND rsign = 'A' .
    CHECK lxa_1001 IS NOT INITIAL.

objid = lxa_1001-sobid(8).
SELECT SINGLE * FROM hrp1001 INTO CORRESPONDING FIELDS OF lxb_1001
  WHERE endda = '99991231' AND objid = objid AND sclas = 'P'.
  CHECK lxb_1001 IS NOT INITIAL.

  APP_PERNR = lv_pernr = lxb_1001-sobid(8).

  CALL FUNCTION 'ZHR_GET_UID'
    EXPORTING
      user            = sy-uname
      IMP_PERNR       = lv_pernr
    IMPORTING
      PERNR           = lv_PERNR
      SUBRC           = lv_SUBRC
      ENAME           = lv_ENAME
      MAIL            = lv_MAIL
            .

*APP_PERNR = lv_PERNR   .
APP_MAIL  = lv_MAIL    .
APP_NAME  = lv_ENAME   .


ENDFUNCTION.

  • ZHR_GET_MEM


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
FUNCTION ZHR_GET_MEM.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(IMPORT) TYPE  CHAR1 OPTIONAL
*"     VALUE(MEM) TYPE  CHAR30 OPTIONAL
*"     VALUE(ID) TYPE  CHAR7 OPTIONAL
*"  EXPORTING
*"     VALUE(RESULT) TYPE  CHAR30
*"----------------------------------------------------------------------

   DATA : memid TYPE char10.
*    DATA : mem  TYPE string.
if id IS INITIAL.
    CONCATENATE 'ZWD_' sy-datum INTO memid.
*    import  mem to mem  FROM  MEMORY ID memid.
ELSE.
*    ID = 'DEVPLAN'.
    CONCATENATE 'ZWD_' ID sy-datum INTO memid.
ENDIF.


IF import IS NOT INITIAL.
  DELETE FROM MEMORY ID memid.
  export mem to MEMORY id memid.

ELSE.
  import mem to mem FROM MEMORY id memid.
  result = mem.

*  DELETE FROM MEMORY ID memid.
ENDIF.




ENDFUNCTION.

  • ZHR_GET_QUALI


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
FUNCTION zhr_get_quali.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(PERNR) TYPE  PERNR_D
*"     VALUE(POSITION) TYPE  HROBJID OPTIONAL
*"     VALUE(JOB) TYPE  HROBJID OPTIONAL
*"  EXPORTING
*"     REFERENCE(RESULT) TYPE  ZHR_TT_QUALIFICATION
*"     REFERENCE(SUBRC) TYPE  SUBRC
*"----------------------------------------------------------------------
DATA : new_data TYPE c.
DATA :
      OBJECTS TYPE TABLE OF HRSOBID,
      xOBJECTS TYPE   HRSOBID,
*      ERR_OBJECTS STRUCTURE  HRSOBID OPTIONAL
      PROFILE type table of HRPE_PROFQ,
      xPROFILE type   HRPE_PROFQ.
  DATA : lt_qual TYPE TABLE OF zhr_st_qualification,
         lx_qual TYPE zhr_st_qualification,
         lx_1000 TYPE hrp1000,
         lt_1000 TYPE TABLE OF hrp1000,
         lx_1001 TYPE p1001,
         qx_1001 TYPE p1001,
         qk_1001 TYPE TABLE OF p1001,
*       lt_1001 TYPE STANDARD TABLE OF string,
         lt_1001 TYPE STANDARD TABLE OF p1001,
         ex_pernr TYPE plog-objid,
         name           TYPE char50,
         characteristic TYPE char1.
  ex_pernr = pernr.

  CALL FUNCTION 'RH_READ_INFTY_1001'
    EXPORTING
      authority        = 'DISP'
      with_stru_auth   = 'X'
      plvar            = '01'
      otype            = 'P'
      objid            = ex_pernr
*     ISTAT            = ' '
*     EXTEND           = 'X'
*     SUBTY            = ' '
      begda            = '19000101'
      endda            = '99991231'
*     CONDITION        = '00000'
*     SORT             = 'X'
*     WITH_EV          = ' '
*     ADATA            = 'X'
*     AUTH_SOBID       = ' '
    TABLES
      i1001            = lt_1001[]
*     OBJECTS          =
    EXCEPTIONS
      nothing_found    = 1
      wrong_condition  = 2
      wrong_parameters = 3
      OTHERS           = 4.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.

  CHECK lt_1001[] IS NOT INITIAL.
*  READ TABLE lt_1001 INTO qk_1001 WITH KEY sclas = 'QK'.
  DELETE lt_1001 WHERE sclas NE 'Q'.
  DELETE lt_1001 WHERE endda ne '99991231'.
  LOOP AT lt_1001 INTO lx_1001.
*    objid = lx_1001-sobid(8).
    CALL FUNCTION 'ZHR_GET_1000'
      EXPORTING
        pernr          = pernr
        objid          = lx_1001-sobid
      IMPORTING
        name           = name
        characteristic = characteristic.


    lx_qual-ttype         = lx_1001-sclas.
    lx_qual-tbjid         = lx_1001-sobid.
    lx_qual-vbegd         = lx_1001-begda.
    lx_qual-vendd         = lx_1001-endda.
    lx_qual-ttext        = name           .
    lx_qual-profcy       = characteristic .

    lx_qual-profc_text    = characteristic.

    CLEAR name.
   ex_pernr =  lx_1001-sobid.
  CALL FUNCTION 'RH_READ_INFTY_1001'
    EXPORTING
      authority        = 'DISP'
      with_stru_auth   = 'X'
      plvar            = '01'
      otype            = 'Q'
      objid            = ex_pernr
*     ISTAT            = ' '
*     EXTEND           = 'X'
*     SUBTY            = ' '
      begda            = '19000101'
      endda            = '99991231'
*     CONDITION        = '00000'
*     SORT             = 'X'
*     WITH_EV          = ' '
*     ADATA            = 'X'
*     AUTH_SOBID       = ' '
    TABLES
      i1001            = qk_1001[]
*     OBJECTS          =
    EXCEPTIONS
      nothing_found    = 1
      wrong_condition  = 2
      wrong_parameters = 3
      OTHERS           = 4.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.
  READ TABLE qk_1001 INTO qx_1001 WITH KEY sclas = 'QK'.

   lx_qual-QUAL_GR =  qx_1001-sobid.
    CALL FUNCTION 'ZHR_GET_1000'
      EXPORTING
        pernr                = '00000000'
        objid                = qx_1001-sobid
        TEXT                 = 'X'
        OTYPE                = 'QK'
      IMPORTING
        NAME                 = name
        CHARACTERISTIC       = characteristic
              .

    lx_qual-class_text    = name.

    APPEND lx_qual TO lt_qual.

  ENDLOOP.

  RESULT[] = lt_qual[].

  IF Job IS NOT INITIAL.
* get Job

xOBJECTS-otype = 'C'.
xOBJECTS-plvar = '01'.
xOBJECTS-sobid = Job.
append xobjects to objects.

CALL FUNCTION 'RHPP_R_PROFILE_READ'
 EXPORTING
   BEGDA                  = SY-DATUM
   ENDDA                  = SY-DATUM
   WITH_STEXT             = 'X'
   WITH_QK_INFO           = 'X'
*   CHECK_NOTE             = ' '
  TABLES
    objects                = OBJECTS
*   ERR_OBJECTS            =
    profile                = PROFILE
 EXCEPTIONS
   NO_AUTHORITY           = 1
   WRONG_OTYPE            = 2
   OBJECT_NOT_FOUND       = 3
   UNDEFINED              = 4
   OTHERS                 = 5
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

  LOOP AT profile INTO xprofile.
    READ TABLE result INTO lx_qual WITH KEY tbjid = xprofile-tbjid.
    IF sy-subrc eq 0.
      lx_qual-req_score = xprofile-profcy.
      lx_qual-diff_score = lx_qual-profcy - xprofile-profcy.
      lx_qual-otype = 'C'.
      lx_qual-hrobjid = Job.
      MODIFY result FROM lx_qual TRANSPORTING req_score diff_score otype hrobjid WHERE tbjid = xprofile-tbjid.

    ELSE.
      CLEAR lx_qual.
      lx_qual-req_score = xprofile-profcy.

      lx_qual-diff_score = lx_qual-profcy - xprofile-profcy.

      lx_qual-otype = 'S'.
      lx_qual-hrobjid = POSITION.

       lx_qual-ttype       =  'Q'.
       lx_qual-tbjid      =  xprofile-tbjid.
       lx_qual-vbegd           = xprofile-vbegd.
       lx_qual-vendd           =  xprofile-vendd.
       lx_qual-ttext           =  xprofile-ttext.
       lx_qual-profcy               = '-'.
       lx_qual-class_text           =  xprofile-class_text.
       lx_qual-profc_text           =  'Does Not Exist.'.
       lx_qual-qual_gr           =  xprofile-class_id.


      append lx_qual to result.
    ENDIF.
  ENDLOOP.

  ENDIF.

  IF position IS NOT INITIAL.

* get position
REFRESH objects.
REFRESH PROFILE.

xOBJECTS-otype = 'S'.
xOBJECTS-plvar = '01'.
xOBJECTS-sobid = position.
append xobjects to objects.

CALL FUNCTION 'RHPP_R_PROFILE_READ'
 EXPORTING
   BEGDA                  = SY-DATUM
   ENDDA                  = SY-DATUM
   WITH_STEXT             = 'X'
   WITH_QK_INFO           = 'X'
*   CHECK_NOTE             = ' '
  TABLES
    objects                = OBJECTS
*   ERR_OBJECTS            =
    profile                = PROFILE
 EXCEPTIONS
   NO_AUTHORITY           = 1
   WRONG_OTYPE            = 2
   OBJECT_NOT_FOUND       = 3
   UNDEFINED              = 4
   OTHERS                 = 5
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

  LOOP AT profile INTO xprofile.
    READ TABLE result INTO lx_qual WITH KEY tbjid = xprofile-tbjid.
    IF sy-subrc eq 0.
      lx_qual-req_score = xprofile-profcy.
      lx_qual-diff_score = lx_qual-profcy - xprofile-profcy.
      CLEAR new_data.
      IF lx_qual-otype IS NOT INITIAL.
        new_data = 'X'.
      ENDIF.
      lx_qual-otype = 'S'.
      lx_qual-hrobjid = POSITION.

      if new_data IS NOT INITIAL.
      append lx_qual to result.
      ELSE.
      MODIFY result FROM lx_qual TRANSPORTING req_score diff_score otype hrobjid WHERE tbjid = xprofile-tbjid.
      endif.
     ELSE.
      CLEAR lx_qual.
      lx_qual-req_score = xprofile-profcy.

      lx_qual-diff_score = lx_qual-profcy - xprofile-profcy.

      lx_qual-otype = 'S'.
      lx_qual-hrobjid = POSITION.

       lx_qual-ttype       =  'Q'.
       lx_qual-tbjid      =  xprofile-tbjid.
       lx_qual-vbegd           = xprofile-vbegd.
       lx_qual-vendd           =  xprofile-vendd.
       lx_qual-ttext           =  xprofile-ttext.
       lx_qual-profcy               = '-'.
       lx_qual-class_text           =  xprofile-class_text.
       lx_qual-profc_text           =  'Does Not Exist.'.
       lx_qual-qual_gr           =  xprofile-class_id.


      append lx_qual to result.
    ENDIF.
  ENDLOOP.

  ENDIF.


  SORT result ASCENDING by class_text ttext.
ENDFUNCTION.

  • ZHR_GET_SUBORDINATE


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
FUNCTION ZHR_GET_SUBORDINATE.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(UNAME) TYPE  UNAME
*"     REFERENCE(RELAT) TYPE  CHAR4 DEFAULT 'B002'
*"  TABLES
*"      EMPLOYEE STRUCTURE  P0001
*"----------------------------------------------------------------------
DATA :
      xPERNR  TYPE  PERNR_D ,
      xSUBRC  TYPE  SUBRC   ,
      xENAME  TYPE  EMNAM   ,
      st_1001 TYPE TABLE OF p1001,
      ct_1001 TYPE TABLE OF p1001,
      tt_1001 TYPE TABLE OF p1001,
      pt_1001 TYPE TABLE OF p1001,
      lx_1001 TYPE p1001,
      px_1001 TYPE p1001,
      cx_1001 TYPE p1001,
      x_1001 TYPE p0001,
      xa0001 TYPE  pa0001,
      pa0001 TYPE TABLE OF  pa0001,
      p0001 TYPE TABLE OF p0001,
      x0001 TYPE p0001.





CALL FUNCTION 'ZHR_GET_UID'
  EXPORTING
    user          = UNAME
 IMPORTING
   PERNR         = xPERNR
   SUBRC         = xSUBRC
   ENAME         = xENAME
          .
DATA : objid TYPE hrobjid.
objid = xpernr.
  CALL FUNCTION 'RH_READ_INFTY_1001'
   EXPORTING
*     AUTHORITY              = 'DISP'
*     WITH_STRU_AUTH         = 'X'
      PLVAR                  = '01'
      OTYPE                  = 'P'
      OBJID                  = objid
*     ISTAT                  = ' '
*     EXTEND                 = 'X'
*     SUBTY                  = ' '
     BEGDA                  = '19000101'
     ENDDA                  = '99991231'
*     CONDITION              = '00000'
*     SORT                   = 'X'
*     WITH_EV                = ' '
*     ADATA                  = 'X'
*     AUTH_SOBID             = ' '
    TABLES
      i1001                  = st_1001
*     OBJECTS                =
    EXCEPTIONS
      NOTHING_FOUND          = 1
      WRONG_CONDITION        = 2
      WRONG_PARAMETERS       = 3
      OTHERS                 = 4
            .
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.
  sort st_1001 DESCENDING by endda.
  READ TABLE st_1001 INTO lx_1001 WITH KEY sclas = 'S' endda = '99991231'.
  CHECK lx_1001 IS NOT INITIAL.
  objid = lx_1001-sobid(8).


CASE relat.
  WHEN 'B002'.


  CALL FUNCTION 'RH_READ_INFTY_1001'
   EXPORTING
*     AUTHORITY              = 'DISP'
*     WITH_STRU_AUTH         = 'X'
      PLVAR                  = '01'
      OTYPE                  = 'S'
      OBJID                  = objid
*     ISTAT                  = ' '
*     EXTEND                 = 'X'
*     SUBTY                  = ' '
     BEGDA                  = '19000101'
     ENDDA                  = '99991231'
*     CONDITION              = '00000'
*     SORT                   = 'X'
*     WITH_EV                = ' '
*     ADATA                  = 'X'
*     AUTH_SOBID             = ' '
    TABLES
      i1001                  = ct_1001
*     OBJECTS                =
    EXCEPTIONS
      NOTHING_FOUND          = 1
      WRONG_CONDITION        = 2
      WRONG_PARAMETERS       = 3
      OTHERS                 = 4
            .
*  READ TABLE ct_1001 INTO cx_1001 WITH KEY rsign = 'B' relat = '002'.
*  CHECK cx_1001 IS NOT INITIAL.
    LOOP AT ct_1001 INTO cx_1001 WHERE rsign = 'B' AND relat = '002' AND endda = '99991231'.
      objid = cx_1001-sobid(8).
  REFRESH tt_1001.
  CALL FUNCTION 'RH_READ_INFTY_1001'
   EXPORTING
*     AUTHORITY              = 'DISP'
*     WITH_STRU_AUTH         = 'X'
      PLVAR                  = '01'
      OTYPE                  = 'S'
      OBJID                  = objid
*     ISTAT                  = ' '
*     EXTEND                 = 'X'
*     SUBTY                  = ' '
     BEGDA                  = '19000101'
     ENDDA                  = '99991231'
*     CONDITION              = '00000'
*     SORT                   = 'X'
*     WITH_EV                = ' '
*     ADATA                  = 'X'
*     AUTH_SOBID             = ' '
    TABLES
      i1001                  = tt_1001
*     OBJECTS                =
    EXCEPTIONS
      NOTHING_FOUND          = 1
      WRONG_CONDITION        = 2
      WRONG_PARAMETERS       = 3
      OTHERS                 = 4
            .
   APPEND LINES OF tt_1001[] TO pt_1001[].
  endloop.

  WHEN 'Z900'.
DATA :
      I1001 type table of   p1001 ,
      x1001 type     p1001 ,
      RESULT_TAB   type table of   SWHACTOR ,
      xRES_TAB     type            SWHACTOR ,
      RESULT_OBJEC type table of   OBJEC    ,
      RESULT_STRUC type table of   STRUC    .

    CALL FUNCTION 'RH_STRUC_GET'
      EXPORTING
        act_otype              = 'S'
        act_objid              = objid
        act_wegid              = 'B002'
*       ACT_INT_FLAG           =
*       ACT_PLVAR              = ' '
*       ACT_BEGDA              = SY-DATUM
*       ACT_ENDDA              = SY-DATUM
       ACT_TDEPTH             = 5
*       ACT_TFLAG              = 'X'
*       ACT_VFLAG              = 'X'
*       AUTHORITY_CHECK        = 'X'
*       TEXT_BUFFER_FILL       =
*       BUFFER_MODE            =
*     IMPORTING
*       ACT_PLVAR              =
     TABLES
       RESULT_TAB             = RESULT_TAB
       RESULT_OBJEC           = RESULT_OBJEC
       RESULT_STRUC           = RESULT_STRUC
     EXCEPTIONS
       NO_PLVAR_FOUND         = 1
       NO_ENTRY_FOUND         = 2
       OTHERS                 = 3
              .
    IF sy-subrc <> 0.
* Implement suitable error handling here
    else.
      LOOP AT RESULT_TAB INTO xRES_TAB.
        objid = xRES_TAB-objid.
      CALL FUNCTION 'RH_READ_INFTY_1001'
       EXPORTING
         AUTHORITY              = 'DISP'
         WITH_STRU_AUTH         = 'X'
         PLVAR                  = '01'
         OTYPE                  = 'S'
         OBJID                  = objid
*         ISTAT                  = ' '
*         EXTEND                 = 'X'
*         SUBTY                  = ' '
         BEGDA                  = '19000101'
         ENDDA                  = '99991231'
*         CONDITION              = '00000'
*         SORT                   = 'X'
*         WITH_EV                = ' '
*         ADATA                  = 'X'
*         AUTH_SOBID             = ' '
        TABLES
          i1001                  = I1001
*         OBJECTS                =
       EXCEPTIONS
         NOTHING_FOUND          = 1
         WRONG_CONDITION        = 2
         WRONG_PARAMETERS       = 3
         OTHERS                 = 4
                .
      IF sy-subrc <> 0.
* Implement suitable error handling here
      ENDIF.
*      pt_1001 =   I1001.
      APPEND LINES OF i1001  TO pt_1001.
      ENDLOOP.
    ENDIF.


  WHEN OTHERS.
ENDCASE.


  LOOP AT pt_1001 INTO px_1001 WHERE sclas = 'P' AND endda = '99991231'.
    CLEAR x_1001.
    x_1001-pernr = px_1001-sobid(8).
    REFRESH p0001.
    CALL FUNCTION 'RH_READ_INFTY'
     EXPORTING
*       AUTHORITY                  = 'DISP'
*       WITH_STRU_AUTH             = 'X'
       PLVAR                      = '01'
       OTYPE                      = 'P'
       OBJID                      = x_1001-pernr
       INFTY                      = '0001'
*       ISTAT                      = ' '
*       EXTEND                     = 'X'
*       SUBTY                      = ' '
*       BEGDA                      = '19000101'
*       ENDDA                      = '99991231'
*       CONDITION                  = '00000'
*       INFTB                      = '1'
*       SORT                       = 'X'
*       VIA_T777D                  = ' '
      TABLES
        innnn                      = p0001
*       OBJECTS                    =
     EXCEPTIONS
       ALL_INFTY_WITH_SUBTY       = 1
       NOTHING_FOUND              = 2
       NO_OBJECTS                 = 3
       WRONG_CONDITION            = 4
       WRONG_PARAMETERS           = 5
       OTHERS                     = 6
              .
    IF sy-subrc <> 0.
* Implement suitable error handling here
    ENDIF.
    LOOP AT p0001 INTO x0001 WHERE endda = '99991231'.
      x_1001-ename = x0001-ename.
      MOVE-CORRESPONDING x_1001 to xa0001.
      append xa0001 to pa0001.
      append x_1001 to EMPLOYEE.
    ENDLOOP.
    CLEAR x_1001.
  ENDLOOP.
    CLEAR x_1001.
*    ENDLOOP.

*EMPLOYEE = pa0001.

ENDFUNCTION.

  • ZHR_GET_UID


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
FUNCTION ZHR_GET_UID.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(USER) TYPE  UNAME
*"     VALUE(IMP_PERNR) TYPE  PERNR_D OPTIONAL
*"  EXPORTING
*"     REFERENCE(PERNR) TYPE  PERNR_D
*"     REFERENCE(SUBRC) TYPE  SUBRC
*"     VALUE(ENAME) TYPE  EMNAM
*"     REFERENCE(MAIL) TYPE  COMM_ID_LONG
*"----------------------------------------------------------------------
DATA: lx_pa105 TYPE pa0105.
DATA: lx_pa0001 TYPE pa0001.
DATA: lt_pa105 TYPE TABLE OF  pa0105.
if user IS NOT INITIAL.
SELECT   * FROM pa0105 INTO CORRESPONDING FIELDS OF TABLE lt_pa105
  WHERE endda eq '99991231' AND
        usrid eq  user AND usrty eq '0001'.
  IF sy-subrc eq 0.
    sort lt_pa105 DESCENDING by aedtm begda.
    READ TABLE lt_pa105 INTO lx_pa105 INDEX 1.
     pernr = lx_pa105-pernr.

  ELSE.
    subrc = 4.
  ENDIF.
  ENDIF.


    IF imp_pernr IS not INITIAL.
     pernr = imp_pernr .
    ELSE.
      imp_pernr = pernr.
    ENDIF.

    SELECT SINGLE * FROM pa0001 INTO CORRESPONDING FIELDS OF lx_pa0001
      WHERE endda eq '99991231' AND pernr = imp_pernr.
    ename = lx_pa0001-ename.

   DATA Lx_pa0105 TYPE pa0105.
   SELECT SINGLE * FROM pa0105 INTO CORRESPONDING FIELDS OF lx_pa0105
     WHERE endda = '99991231' AND usrty = '0010' AND pernr = imp_pernr.
     MAIL = lx_pa0105-usrid_long.



ENDFUNCTION.

  • ZHR_GET_WF


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
FUNCTION ZHR_GET_WF.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(TOP_LEVEL_WF) TYPE  SWW_WIID
*"  EXPORTING
*"     REFERENCE(WI_ID) TYPE  SWW_WIID
*"----------------------------------------------------------------------

DATA :
        "TOP_LEVEL_WF TYPE  SWWWIHEAD-WI_ID,
        WF_LOG type table of SWP_LOGTAB,
        xF_LOG type   SWP_LOGTAB.
CALL FUNCTION 'SWP_WORKFLOW_LOG_READ'
  EXPORTING
    top_level_wf                  = TOP_LEVEL_WF
*   WF_ID                         =
*   LANGUAGE                      = SY-LANGU
*   NESTING_LEVEL                 = '1'
*   WITH_NODES                    = 'X'
*   WITH_MESSAGES                 = 'X'
*   EXPAND_SUBFLOWS               = ' '
*   ARCHIVE_MODE                  = ' '
*   ARCHIVE_DATA                  =
*   WITH_BLOCKENDS                =
* IMPORTING
*   FLOWITEM                      =
  tables
    wf_log                        = WF_LOG
 EXCEPTIONS
   WORKFLOW_DOES_NOT_EXIST       = 1
   OTHERS                        = 2
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
  ELSE.
    READ TABLE wf_log INTO xf_log WITH KEY wi_rh_task = 'TS00008267'.
    IF sy-subrc eq 0.
       WI_ID = xf_log-WI_ID.
    ENDIF.
ENDIF.



ENDFUNCTION.

  • ZHR_SENT_MAIL


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
FUNCTION ZHR_SENT_MAIL.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(TOSENT) TYPE  COMM_ID_LONG
*"     REFERENCE(OBJ_NAME) TYPE  SO_OBJ_NAM
*"     REFERENCE(OBJ_DESCR) TYPE  SO_OBJ_DES
*"  EXPORTING
*"     REFERENCE(STATUS) TYPE  CHAR1
*"     REFERENCE(MESSAGE) TYPE  CHAR255
*"  TABLES
*"      CONTENT STRUCTURE  SOLISTI1
*"----------------------------------------------------------------------

DATA:
     document_data  LIKE  sodocchgi1                ,
     document_type  LIKE  soodk-objtp VALUE 'HTM'   ,
     put_in_outbox  LIKE  sonv-flag                 ,
     commit_work    LIKE  sonv-flag  ,"VALUE 'X'                ,
     ip_encrypt     TYPE  bcsd_encr                 ,
     ip_sign        TYPE  bcsd_sign                 ,
     sent_to_all    TYPE  sonv-flag                 ,
     new_object_id  TYPE  sofolenti1-object_id      ,
     object_header  TYPE TABLE OF  solisti1         ,
     object_content TYPE TABLE OF  solisti1         ,
     xobject_content TYPE    solisti1         ,
     contents_hex   TYPE TABLE OF  solix            ,
     object_para    TYPE TABLE OF  soparai1         ,
     object_parb    TYPE TABLE OF  soparbi1         ,
     xreceivers      TYPE    somlreci1 ,
     receivers      TYPE TABLE OF  somlreci1 ,
              lt_sww TYPE TABLE OF sww_wi2obj,
         lx_sww TYPE sww_wi2obj.

DATA : sender TYPE soextreci1-receiver.
DATA : senderty TYPE soextreci1-adr_typ VALUE 'SMTP'.

DATA : t_objhead  TYPE STANDARD TABLE OF solisti1.

document_data-obj_name           =  OBJ_NAME  .
document_data-obj_descr          =  OBJ_DESCR  .
*document_data-obj_descr          =  'Permohonan Pengajuan Izin'  .
document_data-obj_langu          =   sy-langu   .

xobject_content-line = 'Send Mail'.
DATA : usrid1 TYPE c LENGTH 241.

  usrid1 = TOSENT.
object_content[] = CONTENT[].
MOVE  usrid1 TO xreceivers.
xreceivers-rec_type = 'U'.
xreceivers-com_type = 'INT'.
APPEND xreceivers TO receivers.



*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"  IMPORTING
*"     VALUE(DOCUMENT_DATA)     LIKE  SODOCCHGI1 STRUCTURE  SODOCCHGI1
*"     VALUE(DOCUMENT_TYPE)     LIKE  SOODK-OBJTP DEFAULT 'RAW'
*"     VALUE(PUT_IN_OUTBOX)     LIKE  SONV-FLAG DEFAULT SPACE
*"     VALUE(COMMIT_WORK)       LIKE  SONV-FLAG DEFAULT SPACE
*"     VALUE(IP_ENCRYPT)        TYPE  BCSD_ENCR OPTIONAL
*"     VALUE(IP_SIGN)           TYPE  BCSD_SIGN OPTIONAL
*"  EXPORTING
*"     VALUE(SENT_TO_ALL)       LIKE  SONV-FLAG
*"     VALUE(NEW_OBJECT_ID)     LIKE  SOFOLENTI1-OBJECT_ID
*"  TABLES
*"      OBJECT_HEADER           STRUCTURE  SOLISTI1 OPTIONAL
*"      OBJECT_CONTENT          STRUCTURE  SOLISTI1 OPTIONAL
*"      CONTENTS_HEX            STRUCTURE  SOLIX OPTIONAL
*"      OBJECT_PARA             STRUCTURE  SOPARAI1 OPTIONAL
*"      OBJECT_PARB             STRUCTURE  SOPARBI1 OPTIONAL
*"      RECEIVERS               STRUCTURE  SOMLRECI1
*"  EXCEPTIONS
*"      TOO_MANY_RECEIVERS
*"      DOCUMENT_NOT_SENT
*"      DOCUMENT_TYPE_NOT_EXIST
*"      OPERATION_NO_AUTHORIZATION
*"      PARAMETER_ERROR
*"      X_ERROR
*"      ENQUEUE_ERROR
*"----------------------------------------------------------------------


*Training Administrator
DATA : PACKING_LIST TYPE TABLE OF SOPCKLSTI1.
DATA : xPACKING_LIST TYPE   SOPCKLSTI1.
CONSTANTS: lc_0 VALUE '0',
           lc_1 VALUE '1',
           lc_raw(3) TYPE c VALUE 'RAW'.
  DATA:  l_l1 TYPE i.
  DESCRIBE TABLE object_content LINES l_l1.
  xPACKING_LIST-head_start  = lc_1.
  xPACKING_LIST-head_num    = lc_0.
  xPACKING_LIST-body_start  = lc_1.
  xPACKING_LIST-body_num    = l_l1.
  xPACKING_LIST-doc_type    = 'HTML'."lc_raw'.
  APPEND xPACKING_LIST TO PACKING_LIST.

DATA debug TYPE c.
*while debug IS INITIAL.
*ENDWHILE.

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'  IN BACKGROUND TASK AS SEPARATE UNIT
  EXPORTING
    document_data                    = document_data
*    PUT_IN_OUTBOX                    = 'X'
    SENDER_ADDRESS                   = 'SYSBATCH' "'Training Administrator'
   SENDER_ADDRESS_TYPE               = 'B'
   COMMIT_WORK                       = 'X'
*   IP_ENCRYPT                       =
*   IP_SIGN                          =
*   IV_VSI_PROFILE                   =
* IMPORTING
*   SENT_TO_ALL                      =
*   NEW_OBJECT_ID                    =
*   SENDER_ID                        =
  tables
    packing_list                     = PACKING_LIST
   OBJECT_HEADER                     = t_objhead
*   CONTENTS_BIN                     =
   CONTENTS_TXT                      = object_content
*   CONTENTS_HEX                     =
*   OBJECT_PARA                      =
*   OBJECT_PARB                      =
    receivers                        = receivers
*   ET_VSI_ERROR                     =
  EXCEPTIONS
    TOO_MANY_RECEIVERS               = 1
    DOCUMENT_NOT_SENT                = 2
    DOCUMENT_TYPE_NOT_EXIST          = 3
    OPERATION_NO_AUTHORIZATION       = 4
    PARAMETER_ERROR                  = 5
    X_ERROR                          = 6
    ENQUEUE_ERROR                    = 7
    OTHERS                           = 8
          .
*IF sy-subrc <> 0.
** Implement suitable error handling here
*ENDIF.



*CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1' IN BACKGROUND TASK AS SEPARATE UNIT
*  EXPORTING
*    sender_address_type        = senderty
*    sender_address             = sender
*    document_data              = document_data
*    document_type              = document_type
*    put_in_outbox              = put_in_outbox
*    commit_work                = commit_work
*    ip_encrypt                 = ip_encrypt
*    ip_sign                    = ip_sign
*  IMPORTING
*    sent_to_all                = sent_to_all
*    new_object_id              = new_object_id
*  TABLES
**   OBJECT_HEADER              = OBJECT_HEADER
*    object_content             = object_content
**   CONTENTS_HEX               = CONTENTS_HEX
**   OBJECT_PARA                = OBJECT_PARA
**   OBJECT_PARB                = OBJECT_PARB
*    receivers                  = receivers
*  EXCEPTIONS
*    too_many_receivers         = 1
*    document_not_sent          = 2
*    document_type_not_exist    = 3
*    operation_no_authorization = 4
*    parameter_error            = 5
*    x_error                    = 6
*    enqueue_error              = 7
*    OTHERS                     = 8.

IF sy-subrc <> 0.
* Implement suitable error handling here
  STATUS  = sy-subrc.
  MESSAGE = 'Failed to sent email'.

ENDIF.



ENDFUNCTION.

  • ZHR_SENT_MAIL_APP


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
FUNCTION ZHR_SENT_MAIL_APP.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(NAME) TYPE  EMNAM
*"     REFERENCE(GUID) TYPE  GUID_32 OPTIONAL
*"  TABLES
*"      CONTENT STRUCTURE  SOLISTI1
*"----------------------------------------------------------------------

DATA : xcontent TYPE SO_TEXT255.

  DATA char TYPE c LENGTH 255.
define mail.
CONCATENATE &1 space INTO char.
append char to content.
end-OF-DEFINITION.

DATA : lt_table TYPE TABLE OF ztb_guidmap_9004.
DATA : lx_table TYPE ztb_guidmap_9004.

SELECT * FROM ztb_guidmap_9004 INTO CORRESPONDING FIELDS OF TABLE lt_table
  WHERE   guid = guid.

SORT lt_table DESCENDING by status_item.
READ TABLE lt_table INTO lx_table INDEX 1.

DATA :
      PERNR           TYPE  PERNR_D ,
      OBJID           TYPE  SOBID   ,
      TEXT            TYPE  CHAR1 VALUE 'X'  ,
      OTYPE           TYPE  OTYPE   ,
      JADWAL          TYPE  CHAR1   ,
      xNAME            TYPE  CHAR50  ,
      training        TYPE  CHAR50  ,
      tanggal         TYPE  CHAR50  ,
      CHARACTERISTIC  TYPE  CHAR1   ,
      BEGDA           TYPE  DATUM   ,
      ENDDA           TYPE  DATUM   .


OTYPE = 'D'.
objid = lx_table-ztraining.

CALL FUNCTION 'ZHR_GET_1000'
  EXPORTING
    pernr                = '00000000'
    objid                = OBJID
    TEXT                 = TEXT
    OTYPE                = OTYPE
    JADWAL               = JADWAL
  IMPORTING
    NAME                 = xNAME
    CHARACTERISTIC       = CHARACTERISTIC
  CHANGING
    BEGDA                = BEGDA
    ENDDA                = ENDDA
          .
 training = xNAME.
*CONCATENATE OBJID '-' training INTO training SEPARATED BY space.
 CLEAR xname.
OTYPE  = 'E'.
objid  = lx_table-zjadwal.
JADWAL = 'X'.

CALL FUNCTION 'ZHR_GET_1000'
  EXPORTING
    pernr                = '00000000'
    objid                = OBJID
    TEXT                 = TEXT
    OTYPE                = OTYPE
    JADWAL               = JADWAL
  IMPORTING
    NAME                 = xNAME
    CHARACTERISTIC       = CHARACTERISTIC
  CHANGING
    BEGDA                = BEGDA
    ENDDA                = ENDDA
          .
 tanggal = xNAME.


mail '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'.
mail '<html xmlns="http://www.w3.org/1999/xhtml">'.
mail '<head>'.
mail '<!-- HTML Codes by Quackit.com -->'.
mail '<title>'.
mail 'Title appears in the browser title bar...</title>'.
mail '<meta name="keywords" content="Separate keywords or phrases with a comma (example: html code generator, generate html, ...)">'.
mail '<meta name="description" content="Make it nice and short, but descriptive. The description may appear in search engines  search results pages...">'.
mail '</head>'.
mail '<body>'.
mail '<div style="width:100%;height:100%;background-color:#ffffff;background-repeat:no-repeat;background-position:top left;background-attachment:fixed;">'.
mail '<h4 style="font-family:Arial;color:#000000;">Kepada Yth.</h4> '.
*mail '<h4 style="font-family:Arial;color:#000000;">EMP_NAME</h4>'.

CONCATENATE '<h4 style="font-family:Arial;color:#000000;">' NAME '</h4>' INTO char.
append char to content.
*mail '<p>&nbsp;</p><p>Sesuai dengan hasil <em>review</em> atasan Bapak/Ibu yang telah dilakukan, dapat kami sampaikan bahwa usulan program pelatihan yang telah disusun melalui Rencana Pembelajaran Individu (RPI) untuk saat ini <strong>TELAH DILAKUKAN '.
*mail '<em>REVIEW</em> DAN TELAH DISETUJUINYA USULAN DIMAKSUD. </strong>&nbsp;</p>'.
*mail '<p>Salam,</p>'.
*mail '<p>Divisi Sumber Daya Manusia</p>'.
*mail '</div>'.
*mail '</body>'.
*mail '</html>'.

* mail '<p>&nbsp;</p>'.
* mail '<p>Berdasarkan hasil <em>review</em> yang telah dilakukan oleh atasan Bapak/Ibu terkait usulan Rencana Pembeljaaran Individu (RPI) yang telah disusun sebelumnya maka informasi lebih lanjut dapat Bapak/Ibu akses melalui tautan sbb :&nbsp; .</p>'.
* mail '<a href="http://portaldev.bpmigas.com"><p><strong>http://portaldev.bpmigas.com</strong></p></a>'.
* mail '<p>Apabila terdapat usulan program yang perlu dilakukan perbaikan maka batas waktu penyampaian usulan Rencana Pembelajaran Individu (RPI) pegawai '.
* mail 'adalah tanggal <strong>15 Maret 2019</strong> untuk selanjutnya dilakukan review oleh Divisi SDM SKK Migas guna mendapatkan persetujuan Manajemen SKK Migas lebih lanjut.</p>'.
* mail '<p>Demikian disampaikan, atas perhatiannya kami ucapkan terima kasih.</p>'.
* mail '<p>Salam,</p>'.
* mail '<p>Divisi Sumber Daya Manusia</p>'.


mail '<p>Sesuai dengan hasil <em>review</em> atasan Bapak/Ibu yang telah dilakukan, dapat kami sampaikan bahwa usulan program pelatihan yang telah disusun melalui Rencana Pembelajaran Individu (RPI) sbb :</p>'.
mail '<table border="1">'.
mail '<tbody>'.
mail '<tr>'.
mail '<td style="text-align: center;" width="310">'.
mail '<p><strong>Judul Pembelajaran</strong></p>'.
mail '</td>'.
mail '<td style="text-align: center;" width="310">'.
mail '<p><strong>Tanggal Pelaksanaan</strong></p>'.
mail '</td>'.
mail '</tr>'.
mail '<tr>'.
mail '<td style="text-align: center;" width="310">'.
*mail '<p>&lt;JUDUL&gt;</p>'.
CONCATENATE '<p>' training '</p>' INTO char.
append char to content.

mail '</td>'.
mail '<td style="text-align: center;" width="310">'.
*mail '<p>&lt;TANGGAL&gt;</p>'.

CONCATENATE '<p>' tanggal '</p>' INTO char.
append char to content.

mail '</td>'.
mail '</tr>'.
mail '</tbody>'.
mail '</table>'.
mail '<p>&nbsp;</p>'.
mail '<p>&nbsp;<strong>TELAH DILAKUKAN <em>REVIEW</em> DAN TELAH DISETUJUINYA USULAN DIMAKSUD </strong>oleh atasan Bapak/Ibu. '.
mail '&nbsp;selanjutnya dilakukan evaluasi oleh Divisi SDM SKK Migas guna mendapatkan persetujuan Manajemen SKK Migas lebih lanjut.</p>'.
mail '<p>Demikian disampaikan, atas perhatiannya kami ucapkan terima kasih.</p>'.
mail '<p>Salam,</p>'.
mail '<p>Divisi Sumber Daya Manusia</p>'.


ENDFUNCTION.

  • ZHR_SENT_MAIL_REJ


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
FUNCTION ZHR_SENT_MAIL_REJ.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(NAME) TYPE  EMNAM
*"     REFERENCE(GUID) TYPE  GUID_32 OPTIONAL
*"  TABLES
*"      CONTENT STRUCTURE  SOLISTI1
*"----------------------------------------------------------------------

DATA : xcontent TYPE SO_TEXT255.

  DATA char TYPE c LENGTH 255.
define mail.
CONCATENATE &1 space INTO char.
append char to content.
end-OF-DEFINITION.

DATA : lt_table TYPE TABLE OF ztb_guidmap_9004.
DATA : lx_table TYPE ztb_guidmap_9004.

SELECT * FROM ztb_guidmap_9004 INTO CORRESPONDING FIELDS OF TABLE lt_table
  WHERE   guid = guid.

SORT lt_table DESCENDING by status_item.
READ TABLE lt_table INTO lx_table INDEX 1.

DATA :
      PERNR           TYPE  PERNR_D ,
      OBJID           TYPE  SOBID   ,
      TEXT            TYPE  CHAR1 VALUE 'X'  ,
      OTYPE           TYPE  OTYPE   ,
      JADWAL          TYPE  CHAR1   ,
      xNAME            TYPE  CHAR50  ,
      training        TYPE  CHAR50  ,
      tanggal         TYPE  CHAR50  ,
      CHARACTERISTIC  TYPE  CHAR1   ,
      BEGDA           TYPE  DATUM   ,
      ENDDA           TYPE  DATUM   .


OTYPE = 'D'.
objid = lx_table-ztraining.

CALL FUNCTION 'ZHR_GET_1000'
  EXPORTING
    pernr                = '00000000'
    objid                = OBJID
    TEXT                 = TEXT
    OTYPE                = OTYPE
    JADWAL               = JADWAL
  IMPORTING
    NAME                 = xNAME
    CHARACTERISTIC       = CHARACTERISTIC
  CHANGING
    BEGDA                = BEGDA
    ENDDA                = ENDDA
          .
 training = xNAME.
*CONCATENATE OBJID '-' training INTO training SEPARATED BY space.

OTYPE  = 'E'.
objid  = lx_table-zjadwal.
JADWAL = 'X'.

CALL FUNCTION 'ZHR_GET_1000'
  EXPORTING
    pernr                = '00000000'
    objid                = OBJID
    TEXT                 = TEXT
    OTYPE                = OTYPE
    JADWAL               = JADWAL
  IMPORTING
    NAME                 = xNAME
    CHARACTERISTIC       = CHARACTERISTIC
  CHANGING
    BEGDA                = BEGDA
    ENDDA                = ENDDA
          .
 tanggal = xNAME.


mail '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'.
mail '<html xmlns="http://www.w3.org/1999/xhtml">'.
mail '<head>'.
mail '<!-- HTML Codes by Quackit.com -->'.
mail '<title>'.
mail 'Title appears in the browsers title bar...</title>'.
mail '<meta name="keywords" content="Separate keywords or phrases with a comma (example: html code generator, generate html, ...)">'.
mail '<meta name="description" content="Make it nice and short, but descriptive. The description may appear in search engines search results pages...">'.
mail '</head>'.
mail '<body>'.
mail '<div style="width:100%;height:100%;background-color:#ffffff;background-repeat:no-repeat;background-position:top left;background-attachment:fixed;">'.
mail '<h4 style="font-family:Arial;color:#000000;">Kepada Yth.</h4> '.
*mail '<h4 style="font-family:Arial;color:#000000;">EMP_NAME</h4>'.
CONCATENATE '<h4 style="font-family:Arial;color:#000000;">' NAME '</h4>' INTO char.
append char to content.
*mail '<p>&nbsp;</p>'.
*mail '<p>Sesuai dengan hasil <em>review</em> atasan Bapak/Ibu yang telah dilakukan, dapat kami sampaikan bahwa usulan program pelatihan yang telah disusun melalui Rencana Pembelajaran Individu (RPI) untuk saat ini <strong>PERLU DILAKUKAN PERBAIKAN'.
*mail ' </strong>lebih lanjut. Adapun <em>review</em> terkait pelatihan dimaksud dapat dilihat pada tautan sbb :</p>'.
*mail '<a href="http://portaldev.bpmigas.com"><p><strong>http://portaldev.bpmigas.com/irj/portal</strong></p></a>'.
*mail '<p>Batas waktu penyampaian usulan Rencana Pembelajaran Individu (RPI) pegawai adalah tanggal <strong>28 Februari 2019</strong> untuk selanjutnya dilakukan review oleh Divisi SDM SKK Migas guna mendapatkan persetujuan Manajemen '.
*mail 'SKK Migas lebih lanjut.</p>'.
*mail '<p>Demikian disampaikan, atas perhatiannya kami ucapkan terima kasih.</p>'.
*mail '<p>Salam,</p>'.
*mail '<p>Divisi Sumber Daya Manusia</p>'.
*mail '</div>'.
*mail '</body>'.
*mail '</html>'.

* mail '<p>&nbsp;</p>'.
* mail '<p>Berdasarkan hasil <em>review</em> yang telah dilakukan oleh atasan Bapak/Ibu terkait usulan Rencana Pembeljaaran Individu (RPI) yang telah disusun sebelumnya maka informasi lebih lanjut dapat Bapak/Ibu akses melalui tautan sbb :&nbsp; .</p>'.
* mail '<a href="http://portaldev.bpmigas.com"><p><strong>http://portaldev.bpmigas.com</strong></p></a>'.
* mail '<p>Apabila terdapat usulan program yang perlu dilakukan perbaikan maka batas waktu penyampaian usulan Rencana Pembelajaran Individu (RPI) pegawai '.
* mail 'adalah tanggal <strong>15 Maret 2019</strong> untuk selanjutnya dilakukan review oleh Divisi SDM SKK Migas guna mendapatkan persetujuan Manajemen SKK Migas lebih lanjut.</p>'.
* mail '<p>Demikian disampaikan, atas perhatiannya kami ucapkan terima kasih.</p>'.
* mail '<p>Salam,</p>'.
* mail '<p>Divisi Sumber Daya Manusia</p>'.

mail '<p>Sesuai dengan hasil <em>review</em> atasan Bapak/Ibu yang telah dilakukan, dapat kami sampaikan bahwa usulan program pelatihan yang telah disusun melalui Rencana Pembelajaran Individu (RPI) sbb :</p>'.
mail '<table border = "1">'.
mail '<tbody>'.
mail '<tr>'.
mail '<td width="310">'.
mail '<p><strong>Judul Pembelajaran</strong></p>'.
mail '</td>'.
mail '<td width="310">'.
mail '<p><strong>Tanggal Pelaksanaan</strong></p>'.
mail '</td>'.
mail '</tr>'.
mail '<tr>'.
mail '<td width="310">'.
*mail '<p>&hellip;&hellip;.</p>'.
CONCATENATE '<p>' training '</p>' INTO char.
append char to content.
mail '</td>'.
mail '<td width="310">'.
*mail '<p>&hellip;&hellip;</p>'.
CONCATENATE '<p>' tanggal '</p>' INTO char.
append char to content.
mail '</td>'.
mail '</tr>'.
mail '</tbody>'.
mail '</table>'.
mail '<p><br /> <strong>PERLU DILAKUKAN PERBAIKAN </strong>lebih lanjut. Adapun <em>review</em> terkait pelatihan dimaksud dapat dilihat pada tautan sbb :</p>'.
mail '<table border="1">'.
mail '<tbody>'.
mail '<tr>'.
mail '<td width="623">'.
mail '<a href="http://portaldev.bpmigas.com"><p><strong>http://portaldev.bpmigas.com</strong></p></a>'.
*mail '<p><strong>http://......................................................</strong></p>'.
mail '</td>'.
mail '</tr>'.
mail '</tbody>'.
mail '</table>'.
mail '<p>&nbsp;</p>'.
mail '<p>Batas waktu penyampaian usulan Rencana Pembelajaran Individu (RPI) pegawai adalah tanggal <strong>15 Maret 2019</strong> '.
mail 'untuk selanjutnya dilakukan evaluasi oleh Divisi SDM SKK Migas guna mendapatkan persetujuan Manajemen SKK Migas lebih lanjut.</p>'.
mail '<p>&nbsp;</p>'.
mail '<p>Demikian disampaikan, atas perhatiannya kami ucapkan terima kasih.</p>'.
mail '<p>Salam,</p>'.
mail '<p>Divisi Sumber Daya Manusia</p>'.



ENDFUNCTION.

  • ZHR_SENT_MAIL_WAIT


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
FUNCTION ZHR_SENT_MAIL_WAIT.
*"--------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(NAME) TYPE  EMNAM
*"     REFERENCE(GUID) TYPE  GUID_32 OPTIONAL
*"  TABLES
*"      CONTENT STRUCTURE  SOLISTI1
*"--------------------------------------------------------------------
DATA : xcontent TYPE SO_TEXT255.

  DATA char TYPE c LENGTH 255.
define mail.
CONCATENATE &1 space INTO char.
append char to content.
end-OF-DEFINITION.
DATA :
      lt_9004 TYPE TABLE OF ztb_Guidmap_9004,
      lx_9004 TYPE ztb_Guidmap_9004.
SELECT * FROM  ztb_guidmap_9004 INTO CORRESPONDING FIELDS OF TABLE lt_9004
  WHERE guid = guid.
  sort   lt_9004 DESCENDING by STATUS_ITEM.
  READ TABLE lt_9004 INTO lx_9004 INDEX 1.

  DATA : p0001   TYPE TABLE OF p0001.
  DATA : x0001   TYPE p0001.
  DATA : pernr   TYPE PLOG-OBJID.
  DATA : nama    TYPE char40.
  DATA : jabatan TYPE char40.
  DATA : divisi  TYPE char40.
  pernr = lx_9004-pernr.
CALL FUNCTION 'RH_READ_INFTY'
 EXPORTING
*   AUTHORITY                  = 'DISP'
*   WITH_STRU_AUTH             = 'X'
   PLVAR                      = '01'
   OTYPE                      = 'P'
   OBJID                      = pernr
   INFTY                      = '0001'
*   ISTAT                      = ' '
*   EXTEND                     = 'X'
*   SUBTY                      = ' '
   BEGDA                      = '19000101'
   ENDDA                      = '99991231'
*   CONDITION                  = '00000'
*   INFTB                      = '1'
*   SORT                       = 'X'
*   VIA_T777D                  = ' '
  TABLES
    innnn                      = p0001
*   OBJECTS                    =
  EXCEPTIONS
    ALL_INFTY_WITH_SUBTY       = 1
    NOTHING_FOUND              = 2
    NO_OBJECTS                 = 3
    WRONG_CONDITION            = 4
    WRONG_PARAMETERS           = 5
    OTHERS                     = 6
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ELSE.
  READ TABLE p0001 INTO x0001 WITH KEY endda = '99991231'.
  IF sy-subrc eq 0.
    nama = x0001-sname.


    data:
           v_OBJID  TYPE  SOBID   ,
           v_TEXT   TYPE  CHAR1   ,
           v_OTYPE  TYPE  OTYPE   ,
           v_NAME   TYPE  CHAR50  .

    v_OBJID  = x0001-plans.
    v_TEXT  = 'X'.
    v_OTYPE  = 'S'.
    CALL FUNCTION 'ZHR_GET_1000'
      EXPORTING
        pernr                = '00000000'
        objid                = v_OBJID
        TEXT                 = v_TEXT
        OTYPE                = v_OTYPE
*       JADWAL               =
     IMPORTING
       NAME                  = v_NAME
*       CHARACTERISTIC       =
*     CHANGING
*       BEGDA                =
*       ENDDA                =
              .
    jabatan = v_name.
    CLEAR v_name.
    v_OBJID  = x0001-orgeh.
    v_TEXT  = 'X'.
    v_OTYPE  = 'O'.
    CALL FUNCTION 'ZHR_GET_1000'
      EXPORTING
        pernr                = '00000000'
        objid                = v_OBJID
        TEXT                 = v_TEXT
        OTYPE                = v_OTYPE
*       JADWAL               =
     IMPORTING
       NAME                  = v_NAME
*       CHARACTERISTIC       =
*     CHANGING
*       BEGDA                =
*       ENDDA                =
              .
    divisi = v_name.
  ENDIF.
ENDIF.




mail '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/ xhtml1-transitional.dtd">'   .

*mail '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
mail '<html xmlns="http://www.w3.org/1999/xhtml">'.
mail '<head>'.
mail '<!-- HTML Codes by Quackit.com -->'.
mail '<title>'.
mail 'Title appears in the browser title bar...</title>'.
mail '<meta name="keywords" content="Separate keywords or phrases with a comma (example: html code generator, generate html, ...)">'.
mail '<meta name="description" content="Make it nice and short, but descriptive. search results pages...">'.
mail '</head>'.
mail '<body>'.
mail '<div style="width:100%;height:100%;background-color:#ffffff;background-repeat:no-repeat;background-position:top left;background-attachment:fixed;">'.
mail '<h4 style="font-family:Arial;color:#000000;">Kepada Yth.</h4>'.

CONCATENATE '<h4 style="font-family:Arial;color:#000000;">' NAME '</h4>' INTO char.
append char to content.

mail '<p>Sesuai dengan usulan program pembelajaran dan pengembangan yang telah disusun oleh pegawai yang yang berada dibawah fungsi Bapak dengan detil sbb :</p>'.
mail '<table border="1">'.
mail '<tbody>'.
mail '<tr>'.
mail '<td width="310">'.
mail '<p><strong>Nama Pegawai</strong></p>'.
mail '</td>'.
mail '</tr>'.
mail '<tr>'.
mail '<td width="310">'.
*mail '<p>&hellip;&hellip;.</p>'.
CONCATENATE '<p>' nama '</p>' INTO char.
APPEND char to content.

mail '</td>'.
mail '</tr>'.
mail '</tbody>'.
mail '</table>'.
mail '<p>&nbsp;</p>'.
mail '<p>Kami mohon bantuan Bapak/Ibu untuk dapat melakukan <em>review </em>atas usulan dimaksud dengan membuka tautan berikut :</p>'.
mail '<table border="1">'.
mail '<tbody>'.
mail '<tr>'.
*mail '<td width="623">'.
*mail '<p><strong>http ://&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;..</strong></p>'.

mail '<td width="623"><a href="http://portaldev.bpmigas.com"><p><strong>http://portaldev.bpmigas.com</strong></p></a></td>'.
*mail '</td>'.
mail '</tr>'.
mail '</tbody>'.
mail '</table>'.
mail '<p>&nbsp;</p>'.
mail '<p>Batas waktu penyampaian usulan Rencana Pembelajaran Individu (RPI) pegawai adalah tanggal <strong>15 Maret &nbsp;2019</strong> untuk '.
mail 'selanjutnya dilakukan review oleh Divisi SDM SKK Migas guna mendapatkan persetujuan Manajemen SKK Migas lebih lanjut.</p>'.
mail '<p>&nbsp;</p>'.
mail '<p>Demikian disampaikan, atas perhatiannya kami ucapkan terima kasih.</p>'.
mail '<p>Salam,</p>'.
mail '<p>Divisi Sumber Daya Manusia</p>'.

**mail '<h4 style="font-family:Arial;color:#000000;">app1</h4>
*mail '<p>&nbsp;</p>'.
*mail '<p>Sehubungan dengan program penyusunan Rencana Pembelajaran Individu (RPI) pegawai SKK Migas tahun 2019 yang saat ini tengah dilakukan. Kami mohon Bapak/Ibu untuk dapat melakukan <strong><em>review</em> dan persetujuan </strong>atas program yang'.
*mail 'diusulkan oleh staf yang berada pada fungsi Bapak/Ibu. Adapun <em>review</em> dan persetujuan atas program yang diusulkan oleh pegawai yang berada pada fungsi Bapak/Ibu sbb :</p>'.
**mail 'diusulkan oleh staf yang berada pada fungsi Bapak/Ibu. Adapun <em>review</em> dan persetujuan terkait pelatihan dimaksud dapat dilihat pada tautan sbb :</p>'.
**mail '<a href="http://portaldev.bpmigas.com"><p><strong>http://portaldev.bpmigas.com</strong></p></a>'.
*
*                                                                 .
*mail'<table style="height: 73px; width: 490px;" border="1"> '    .
*mail'<tbody>                                                '    .
*mail'<tr>                                                   '    .
*mail'<td style="width: 84px;">Nama</td>                     '    .
*mail'<td style="width: 17px;">:</td>                        '    .
**mail'<td style="width: 373px;">&nbsp;</td>                  '   .
*CONCATENATE '<td style="width: 373px;">' nama '</td>'  INTO char .
*append char to content.
*
*mail'</tr>                                                  '    .
*mail'<tr>                                                   '    .
*mail'<td style="width: 84px;">Jabatan</td>                  '    .
*mail'<td style="width: 17px;">:</td>                        '    .
**mail'<td style="width: 373px;">&nbsp;</td>                  '   .
*
*CONCATENATE '<td style="width: 373px;">' jabatan '</td>'  INTO char .
*append char to content.
*
*mail'</tr>                                                  '    .
*mail'<tr>                                                   '    .
*mail'<td style="width: 84px;">Divisi</td>                   '    .
*mail'<td style="width: 17px;">:</td>                        '    .
**mail'<td style="width: 373px;">&nbsp;</td>                  '   .
*
*
*CONCATENATE '<td style="width: 373px;">' divisi '</td>'  INTO char .
*append char to content.
*
*mail'</tr>                                                  '    .
*mail'</tbody>                                               '    .
*mail'</table>                                               '    .
*
*mail 'Adapun review dan persetujuan terkait pelatihan dimaksud dapat dilihat pada tautan sbb :'.
*mail '<table style="height: 28px;" border="1" width="211">'.
*mail '<tbody>'.
*mail '<tr>'.
*mail '<td><a href="http://portaldev.bpmigas.com"><p><strong>http://portaldev.bpmigas.com</strong></p></a></td>'.
*mail '</tr>'.
*mail '</tbody>'.
*mail '</table>'.
*
*
*mail '<p>Batas waktu penyampaian usulan Rencana Pembelajaran Individu (RPI) pegawai adalah tanggal <strong>15 Maret 2019</strong> untuk selanjutnya dilakukan review'.
*mail 'oleh Divisi SDM SKK Migas guna mendapatkan persetujuan Manajemen SKK Migas lebih lanjut.</p>'.
*mail '<p>&nbsp;</p>'.
*mail '<p>Demikian disampaikan, atas perhatiannya kami ucapkan terima kasih.</p>'.
*mail '<p>Salam,</p>'.
*mail '<p>Divisi Sumber Daya Manusia</p>'.
*mail '</div>'.
*mail '</body>'.
*mail '</html>'.



ENDFUNCTION.

  • ZHR_SENT_MAIL_REQ


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
FUNCTION ZHR_SENT_MAIL_REQ.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(NAME) TYPE  EMNAM
*"     REFERENCE(GUID) TYPE  GUID_32 OPTIONAL
*"  TABLES
*"      CONTENT STRUCTURE  SOLISTI1
*"----------------------------------------------------------------------
DATA : xcontent TYPE SO_TEXT255.

  DATA char TYPE c LENGTH 255.
define mail.
CONCATENATE &1 space INTO char.
append char to content.
end-OF-DEFINITION.
DATA :
      lt_9004 TYPE TABLE OF ztb_Guidmap_9004,
      lx_9004 TYPE ztb_Guidmap_9004.
SELECT * FROM  ztb_guidmap_9004 INTO CORRESPONDING FIELDS OF TABLE lt_9004
  WHERE guid = guid.
  sort   lt_9004 DESCENDING by STATUS_ITEM.
  READ TABLE lt_9004 INTO lx_9004 INDEX 1.

  DATA : p0001   TYPE TABLE OF p0001.
  DATA : x0001   TYPE p0001.
  DATA : pernr   TYPE PLOG-OBJID.
  DATA : nama    TYPE char40.
  DATA : jabatan TYPE char40.
  DATA : divisi  TYPE char40.
  pernr = lx_9004-pernr.
CALL FUNCTION 'RH_READ_INFTY'
 EXPORTING
*   AUTHORITY                  = 'DISP'
*   WITH_STRU_AUTH             = 'X'
   PLVAR                      = '01'
   OTYPE                      = 'P'
   OBJID                      = pernr
   INFTY                      = '0001'
*   ISTAT                      = ' '
*   EXTEND                     = 'X'
*   SUBTY                      = ' '
   BEGDA                      = '19000101'
   ENDDA                      = '99991231'
*   CONDITION                  = '00000'
*   INFTB                      = '1'
*   SORT                       = 'X'
*   VIA_T777D                  = ' '
  TABLES
    innnn                      = p0001
*   OBJECTS                    =
  EXCEPTIONS
    ALL_INFTY_WITH_SUBTY       = 1
    NOTHING_FOUND              = 2
    NO_OBJECTS                 = 3
    WRONG_CONDITION            = 4
    WRONG_PARAMETERS           = 5
    OTHERS                     = 6
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ELSE.
  READ TABLE p0001 INTO x0001 WITH KEY endda = '99991231'.
  IF sy-subrc eq 0.
    nama = x0001-sname.


    data:
           v_OBJID  TYPE  SOBID   ,
           v_TEXT   TYPE  CHAR1   ,
           v_OTYPE  TYPE  OTYPE   ,
           v_NAME   TYPE  CHAR50  .

    v_OBJID  = x0001-plans.
    v_TEXT  = 'X'.
    v_OTYPE  = 'S'.
    CALL FUNCTION 'ZHR_GET_1000'
      EXPORTING
        pernr                = '00000000'
        objid                = v_OBJID
        TEXT                 = v_TEXT
        OTYPE                = v_OTYPE
*       JADWAL               =
     IMPORTING
       NAME                  = v_NAME
*       CHARACTERISTIC       =
*     CHANGING
*       BEGDA                =
*       ENDDA                =
              .
    jabatan = v_name.
    CLEAR v_name.
    v_OBJID  = x0001-orgeh.
    v_TEXT  = 'X'.
    v_OTYPE  = 'O'.
    CALL FUNCTION 'ZHR_GET_1000'
      EXPORTING
        pernr                = '00000000'
        objid                = v_OBJID
        TEXT                 = v_TEXT
        OTYPE                = v_OTYPE
*       JADWAL               =
     IMPORTING
       NAME                  = v_NAME
*       CHARACTERISTIC       =
*     CHANGING
*       BEGDA                =
*       ENDDA                =
              .
    divisi = v_name.
  ENDIF.
ENDIF.




mail '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/ xhtml1-transitional.dtd">'   .

*mail '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
mail '<html xmlns="http://www.w3.org/1999/xhtml">'.
mail '<head>'.
mail '<!-- HTML Codes by Quackit.com -->'.
mail '<title>'.
mail 'Title appears in the browser title bar...</title>'.
mail '<meta name="keywords" content="Separate keywords or phrases with a comma (example: html code generator, generate html, ...)">'.
mail '<meta name="description" content="Make it nice and short, but descriptive. search results pages...">'.
mail '</head>'.
mail '<body>'.
mail '<div style="width:100%;height:100%;background-color:#ffffff;background-repeat:no-repeat;background-position:top left;background-attachment:fixed;">'.
mail '<h4 style="font-family:Arial;color:#000000;">Kepada Yth.</h4>'.

CONCATENATE '<h4 style="font-family:Arial;color:#000000;">' NAME '</h4>' INTO char.
append char to content.

*mail '<h4 style="font-family:Arial;color:#000000;">app1</h4>
mail '<p>&nbsp;</p>'.
mail '<p>Sehubungan dengan program penyusunan Rencana Pembelajaran Individu (RPI) pegawai SKK Migas tahun 2019 yang saat ini tengah dilakukan. Kami mohon Bapak/Ibu untuk dapat melakukan <strong><em>review</em> dan persetujuan </strong>atas program yang'.
mail 'diusulkan oleh staf yang berada pada fungsi Bapak/Ibu. Adapun <em>review</em> dan persetujuan atas program yang diusulkan oleh pegawai yang berada pada fungsi Bapak/Ibu sbb :</p>'.
*mail 'diusulkan oleh staf yang berada pada fungsi Bapak/Ibu. Adapun <em>review</em> dan persetujuan terkait pelatihan dimaksud dapat dilihat pada tautan sbb :</p>'.
*mail '<a href="http://portaldev.bpmigas.com"><p><strong>http://portaldev.bpmigas.com</strong></p></a>'.

                                                                 .
mail'<table style="height: 73px; width: 490px;" border="1"> '    .
mail'<tbody>                                                '    .
mail'<tr>                                                   '    .
mail'<td style="width: 84px;">Nama</td>                     '    .
mail'<td style="width: 17px;">:</td>                        '    .
*mail'<td style="width: 373px;">&nbsp;</td>                  '   .
CONCATENATE '<td style="width: 373px;">' nama '</td>'  INTO char .
append char to content.

mail'</tr>                                                  '    .
mail'<tr>                                                   '    .
mail'<td style="width: 84px;">Jabatan</td>                  '    .
mail'<td style="width: 17px;">:</td>                        '    .
*mail'<td style="width: 373px;">&nbsp;</td>                  '   .

CONCATENATE '<td style="width: 373px;">' jabatan '</td>'  INTO char .
append char to content.

mail'</tr>                                                  '    .
mail'<tr>                                                   '    .
mail'<td style="width: 84px;">Divisi</td>                   '    .
mail'<td style="width: 17px;">:</td>                        '    .
*mail'<td style="width: 373px;">&nbsp;</td>                  '   .


CONCATENATE '<td style="width: 373px;">' divisi '</td>'  INTO char .
append char to content.

mail'</tr>                                                  '    .
mail'</tbody>                                               '    .
mail'</table>                                               '    .

mail 'Adapun review dan persetujuan terkait pelatihan dimaksud dapat dilihat pada tautan sbb :'.
mail '<table style="height: 28px;" border="1" width="211">'.
mail '<tbody>'.
mail '<tr>'.
mail '<td><a href="http://portaldev.bpmigas.com"><p><strong>http://portaldev.bpmigas.com</strong></p></a></td>'.
mail '</tr>'.
mail '</tbody>'.
mail '</table>'.


mail '<p>Batas waktu penyampaian usulan Rencana Pembelajaran Individu (RPI) pegawai adalah tanggal <strong>15 Maret 2019</strong> untuk selanjutnya dilakukan review'.
mail 'oleh Divisi SDM SKK Migas guna mendapatkan persetujuan Manajemen SKK Migas lebih lanjut.</p>'.
mail '<p>&nbsp;</p>'.
mail '<p>Demikian disampaikan, atas perhatiannya kami ucapkan terima kasih.</p>'.
mail '<p>Salam,</p>'.
mail '<p>Divisi Sumber Daya Manusia</p>'.
mail '</div>'.
mail '</body>'.
mail '</html>'.



ENDFUNCTION.

Well that's it for today folks.. bye..

No comments:

Post a Comment