Tuesday, November 29, 2016

Maintaining HRP Table Example

  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
FORM F_UPD5  TABLES   PT_0105 "STRUCTURE < GT_0009 #local# >
                        "Insert a correct name for <...>
             USING    G_CP
                      flag.
*TABLES : PPLOG,P1001.
DATA:
      lv_flag TYPE c,
      gv_BUFFER_C TYPE i,
      gv_BUFFO_OB TYPE i,
      gv_PLOG_TAB TYPE i VALUE '2',
      gv_TB_BUFFE TYPE i,
      gv_TB_PLOG_ TYPE i,

      gv_type     TYPE x VALUE '0000000000',
      gv_typec(10)     TYPE c,

      i_BUFFER_TAB       TYPE TABLE OF HRBUFFER        ,
      s_BUFFER_TAB       TYPE HRBUFFER        ,
      i_BUFFO_TAB        TYPE TABLE OF P1000           ,
      s_BUFFO_TAB        TYPE P1000           ,
      i_PLOG_TAB_TAB     TYPE TABLE OF HRDBTAB         ,
      S_PLOG_TAB_TAB     TYPE HRDBTAB         ,
      i_TB_BUFFER_TAB    TYPE TABLE OF HRTBUFFER       ,
      i_TB_PLOG_TAB_TAB  TYPE TABLE OF HRTBUFFER       ,

      S_0105 TYPE PA0105,
      G_CPC(10) TYPE C,
      gv_data(45) type c,
      gv_prozt TYPE prozt VALUE '0.00',
      gv_pc(40) TYPE c,
      gv_tab TYPE char30 VALUE 'P1001',
      lv_tabix TYPE sy-tabix,
      s_hrp5585 TYPE p5585,
      i_hrp5585 TYPE TABLE OF p5585,
      g_pernr type BAPIP0001-PERNR
      .
FIELD-SYMBOLS : <P1001_VDATA> TYPE hrip1001.

FIELD-SYMBOLS : <PPNNN>,<sclas>,<sobid>,
                <wplog_hlp> type any.

      DATA : GV_VTASK       LIKE HRRHAP-VTASK VALUE 'D',
             GV_COMMIT_FLG  LIKE HRRHAP-COMMIT_FLG VALUE 'X'.

READ TABLE PT_0105 INTO S_0105 INDEX 1.

CHECK S_0105 IS NOT INITIAL.
**FOR CENTRAL PERSON

s_BUFFO_TAB-PLVAR = '01'.
s_BUFFO_TAB-OTYPE = 'CP'.
s_BUFFO_TAB-objid = g_cp.
s_BUFFO_TAB-infty = '1000'.
s_BUFFO_TAB-ISTAT = '1'.
s_BUFFO_TAB-begda = sy-datum.
s_BUFFO_TAB-endda = '99991231'.
s_BUFFO_TAB-langu = 'E'.
s_BUFFO_TAB-aedtm = sy-datum.
s_BUFFO_TAB-uname = sy-uname.
APPEND S_BUFFO_TAB to I_BUFFO_TAB.

CLEAR lv_tabix.

  S_PLOG_TAB_TAB-plvar = '01'.
  S_PLOG_TAB_TAB-otype = 'CP'.
  S_PLOG_TAB_TAB-objid = g_cp.
  S_PLOG_TAB_TAB-infty = '5585'.
  S_PLOG_TAB_TAB-istat = '1'.
  S_PLOG_TAB_TAB-begda = sy-datum.
  S_PLOG_TAB_TAB-endda = '99991231'.
  S_PLOG_TAB_TAB-aedtm = sy-datum.
  S_PLOG_TAB_TAB-uname = sy-uname.

S_PLOG_TAB_TAB-opera = 'I'. S_PLOG_TAB_TAB-PRIMARY_WF = 'X'.
APPEND S_PLOG_TAB_TAB to i_PLOG_TAB_TAB .
CLEAR S_PLOG_TAB_TAB .
GV_BUFFO_OB = 1.
GV_plog_tab = 1.
CALL FUNCTION 'RH_SET_BUFFER_PLOG_TAB'
        EXPORTING
          buffer_count_imp       = gv_BUFFER_C
          buffo_object_count_imp = gv_BUFFO_OB
          plog_tab_count_imp     = gv_PLOG_TAB
          tb_buffer_count_imp    = gv_TB_BUFFE
          tb_plog_tab_count_imp  = gv_TB_PLOG_
        TABLES
          buffer_tab             = i_BUFFER_TAB
          buffo_tab              = i_BUFFO_TAB
          plog_tab_tab           = i_PLOG_TAB_TAB
          tb_buffer_tab          = i_TB_BUFFER_TAB
          tb_plog_tab_tab        = i_TB_PLOG_TAB_TAB.


IF SY-SUBRC EQ 0.
*      lv_flag = 'X'.
*      EXPORT lv_flag to MEMORY id sy-uname.
      CALL FUNCTION 'RH_UPDATE_DATABASE'
        EXPORTING
          vtask        = GV_VTASK
          commit_flg   = GV_COMMIT_FLG  "VWMCOMMIT
          clear_buffer = ' '
        EXCEPTIONS
          corr_exit    = 04.


      MOVE-CORRESPONDING S_0105 to s_hrp5585.
      s_hrp5585-plvar = '01'.
      s_hrp5585-otype = 'CP'.
      s_hrp5585-objid = g_cp.
      s_hrp5585-istat = '1'.
      s_hrp5585-begda = sy-datum.
      s_hrp5585-endda = '99991231'.
      s_hrp5585-infty = '5583'.

      s_hrp5585-AEDTM = sy-datum.
      s_hrp5585-UNAME = sy-uname.
      CLEAR s_hrp5585-subty.
      APPEND s_hrp5585 to i_hrp5585.



      CALL FUNCTION 'RH_UPDATE_INFTY'
        EXPORTING
          VTASK                     = 'D'
*         ORDER_FLG                 = 'X'
*         COMMIT_FLG                = 'X'
*         AUTHY                     = 'X'
*         PPPAR_IMP                 =
*         OLD_TABNR_NEW_LANGU       = ' '
         REPID                     = sy-cprog
*         FORM                      = ' '
*         KEEP_LUPD                 =
*         WORKF_ACTV                = 'X'
        TABLES
          INNNN                     = i_hrp5585[]
*         ILFCODE                   =
       EXCEPTIONS
         ERROR_DURING_UPDATE       = 1
         NO_AUTHORIZATION          = 2
         REPID_FORM_INITIAL        = 3
         CORR_EXIT                 = 4
         OTHERS                    = 5
                .
      IF SY-SUBRC <> 0.
* Implement suitable error handling here
      ELSE.
        flag = 'X'.
      ENDIF.




ENDIF.
ENDFORM.

No comments:

Post a Comment