Tuesday, November 29, 2016

Example Upload Infotypes

 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
FORM F_UPLOAD_INFOTYPE_0015  USING    VALUE(P_0272)
                                      P_LI_HR   STRUCTURE ZTA_HR_ADDPAYMNT
                             CHANGING P_LI_HR_LOG
                                      P_LI_HR_STATUS.

DATA :
      px_infty                TYPE   PRELP-INFTY,
      px_number               TYPE   P0001-PERNR           ,
      px_subtype              TYPE   P0001-SUBTY           ,
      px_OBJECTID             TYPE   P0001-OBJPS           ,
      px_LOCKINDICATOR        TYPE   P0001-SPRPS           ,
      px_VALIDITYEND          TYPE   P0001-ENDDA           ,
      px_validitybegin        TYPE   P0001-BEGDA           ,
      px_RECORDNUMBER         TYPE   P0001-SEQNR           ,
      px_record               TYPE   p0015,c               ,
      px_operation            TYPE   PSPAR-ACTIO           ,
      px_TCLAS                TYPE   PSPAR-TCLAS           ,
      px_DIALOG_MODE          TYPE   C VALUE '0'           , "DEFAULT 'A'
      px_nocommit             TYPE   c                     ,
*     px_VIEW_IDENTIFIER      TYPE   BAPI_STAND-NO_COMMIT  ,
*     px_SECONDARY_RECORD     TYPE   P0003-VIEKN           ,
      px_return               TYPE   BAPIRETURN1           , "STRUCTURE  BAPIRETURN1 "OPTIONAL
      px_key                  TYPE   BAPIPAKEY             ,
      px3_number              TYPE   bapip0001-pernr       ,
      px3_return              TYPE   bapireturn1           ,
      lx4_wait                TYPE   bapita-wait           ,
      lx4_retn                TYPE   bapiret2              .
      .

px_infty = '0015'.
px3_number = px_number = P_LI_HR-pernr.
px_subtype = P_LI_HR-SUBTY.
px_validitybegin = P_LI_HR-BEGDA.

P_LI_HR-BETRG = P_LI_HR-BETRG / 100.
MOVE-CORRESPONDING P_LI_HR to px_record.
px_operation = 'INS'.
px_nocommit = 'X'.

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
  EXPORTING
    NUMBER        = px3_number
  IMPORTING
    RETURN        = px3_return
          .

if px3_return-TYPE ne 'E'.
 CALL FUNCTION 'HR_INFOTYPE_OPERATION'
      EXPORTING
        infty                  = px_infty
        number                 = px_number
        subtype                = px_subtype
*       OBJECTID               = px_OBJECTID
*       LOCKINDICATOR          = px_LOCKINDICATOR
*       VALIDITYEND            = px_VALIDITYEND
        validitybegin          = px_validitybegin
*       RECORDNUMBER           = px_RECORDNUMBER
        record                 = px_record
        operation              = px_operation
*       TCLAS                  = px_TCLAS
*       DIALOG_MODE            = px_DIALOG_MODE
        nocommit               = px_nocommit
*       VIEW_IDENTIFIER        = px_VIEW_IDENTIFIER
*       SECONDARY_RECORD       = px_SECONDARY_RECORD
      IMPORTING
        return                 = px_return
        key                    = px_key.
 IF px_return-type IS INITIAL.


      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait   = lx4_wait
        IMPORTING
          return = lx4_retn.

*    ENDIF.

    p_li_hr_status     = '@08@'.
    p_li_hr_log       = 'Success updated Additional Payment'.
  ELSE.
*    p_li_hr_log    = 'Additional Payment Failed'.
    p_li_hr_log    = px_return-MESSAGE.
    p_li_hr_status = '@0A@'.
  ENDIF.

*px3_number =
  CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
    EXPORTING
      number = px3_number
    IMPORTING
      return = px3_return.

  ELSE.
    p_li_hr_log    = 'Pernr is being used.'.
    p_li_hr_status = '@0A@'.
  ENDIF.

No comments:

Post a Comment