Saturday, September 10, 2011
Friday, September 9, 2011
Reading data from B2 Cluster
1. Retrieving data from B2 cluster using Function module.
Function module name is - HR_FORMS_TIM_GET_B2_RESULTS
Sample Code -
*&---------------------------------------------------------------------*
*& Report YTEST_B2_CLUSTER
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ytest_b2_cluster.
TABLES: pernr.
infotypes: 0000, 0001.
DATA: lv_begda TYPE dats,
lv_endda TYPE dats.
DATA: ls_tim_b2 TYPE hrf_tim_b2.
lv_begda = '20110101'.
lv_endda = '20110830'.
START-OF-SELECTION.
GET pernr.
CALL FUNCTION 'HR_FORMS_TIM_GET_B2_RESULTS'
EXPORTING
pernr = pernr-pernr
begda = lv_begda
endda = lv_endda
IMPORTING
tim_b2 = ls_tim_b2
EXCEPTIONS
wrong_cluster_version = 1
no_read_authority = 2
cluster_archived = 3
technical_error = 4
OTHERS = 5.
END-OF-SELECTION.
2. Retrieving data from B2 cluster using Import statement.
*--->>> INCLUDE rpc2b200 ( RPCnxxy0)
*--->>> n = 1, 2, 3 or 4 (for PCL1, PCL2, PCL3, PCL4)
*--->>> xx = cluster ID
*--->>> y = country grouping (0 for international otherwise country indicator T500L)
INCLUDE rpc2b200. ( so here we are using PCL2, B2 cluster and country key international )
TABLES: pernr, pcl2.
INFOTYPES: 0000, 0001.
DATA: lv_begda TYPE dats,
lv_endda TYPE dats.
DATA: lit_saldo TYPE STANDARD TABLE OF pc2b5.
START-OF-SELECTION.
GET pernr.
b2-key-pernr = pernr-pernr.
b2-key-pabrj = '2011'.
b2-key-pabrp = '05'.
b2-key-cltyp = '1'.
IF pernr-pernr EQ '00010673'.
IMPORT SALDO FROM DATABASE pcl2(b2) ID b2-key.
IF sy-subrc EQ 0.
LOOP AT saldo. " saldo is a table in cluster b2
APPEND saldo TO lit_saldo.
ENDLOOP.
ENDIF.
ENDIF.
END-OF-SELECTION.
3. Retrieving data from B2 cluster using Macro statement.
TABLES: pernr, pcl2, pcl1.* Buffer definition
INCLUDE rpppxd00.
DATA: BEGIN OF COMMON PART.
INCLUDE rpppxd10.
DATA: END OF COMMON PART.
INCLUDE rpc2b200. " Same as explained for Import statement
INCLUDE rpppxm00. " all macro definitions
DATA: lit_saldo TYPE STANDARD TABLE OF pc2b5.
START-OF-SELECTION.
GET pernr.
b2-key-pernr = pernr-pernr.
b2-key-pabrj = '2011'.
b2-key-pabrp = '05'.
b2-key-cltyp = '1'.
IF pernr-pernr EQ '00010673'.
** reset macro
rp-init-buffer.
** import macro
rp-imp-c2-b2.
IF sy-subrc EQ 0.
LOOP AT saldo. " saldo is a table in cluster b2
APPEND saldo TO lit_saldo.
ENDLOOP.
ENDIF.
ENDIF.
END-OF-SELECTION.
Function module name is - HR_FORMS_TIM_GET_B2_RESULTS
Sample Code -
*&---------------------------------------------------------------------*
*& Report YTEST_B2_CLUSTER
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ytest_b2_cluster.
TABLES: pernr.
infotypes: 0000, 0001.
DATA: lv_begda TYPE dats,
lv_endda TYPE dats.
DATA: ls_tim_b2 TYPE hrf_tim_b2.
lv_begda = '20110101'.
lv_endda = '20110830'.
START-OF-SELECTION.
GET pernr.
CALL FUNCTION 'HR_FORMS_TIM_GET_B2_RESULTS'
EXPORTING
pernr = pernr-pernr
begda = lv_begda
endda = lv_endda
IMPORTING
tim_b2 = ls_tim_b2
EXCEPTIONS
wrong_cluster_version = 1
no_read_authority = 2
cluster_archived = 3
technical_error = 4
OTHERS = 5.
END-OF-SELECTION.
2. Retrieving data from B2 cluster using Import statement.
*--->>> INCLUDE rpc2b200 ( RPCnxxy0)
*--->>> n = 1, 2, 3 or 4 (for PCL1, PCL2, PCL3, PCL4)
*--->>> xx = cluster ID
*--->>> y = country grouping (0 for international otherwise country indicator T500L)
INCLUDE rpc2b200. ( so here we are using PCL2, B2 cluster and country key international )
TABLES: pernr, pcl2.
INFOTYPES: 0000, 0001.
DATA: lv_begda TYPE dats,
lv_endda TYPE dats.
DATA: lit_saldo TYPE STANDARD TABLE OF pc2b5.
START-OF-SELECTION.
GET pernr.
b2-key-pernr = pernr-pernr.
b2-key-pabrj = '2011'.
b2-key-pabrp = '05'.
b2-key-cltyp = '1'.
IF pernr-pernr EQ '00010673'.
IMPORT SALDO FROM DATABASE pcl2(b2) ID b2-key.
IF sy-subrc EQ 0.
LOOP AT saldo. " saldo is a table in cluster b2
APPEND saldo TO lit_saldo.
ENDLOOP.
ENDIF.
ENDIF.
END-OF-SELECTION.
3. Retrieving data from B2 cluster using Macro statement.
TABLES: pernr, pcl2, pcl1.* Buffer definition
INCLUDE rpppxd00.
DATA: BEGIN OF COMMON PART.
INCLUDE rpppxd10.
DATA: END OF COMMON PART.
INCLUDE rpc2b200. " Same as explained for Import statement
INCLUDE rpppxm00. " all macro definitions
DATA: lit_saldo TYPE STANDARD TABLE OF pc2b5.
START-OF-SELECTION.
GET pernr.
b2-key-pernr = pernr-pernr.
b2-key-pabrj = '2011'.
b2-key-pabrp = '05'.
b2-key-cltyp = '1'.
IF pernr-pernr EQ '00010673'.
** reset macro
rp-init-buffer.
** import macro
rp-imp-c2-b2.
IF sy-subrc EQ 0.
LOOP AT saldo. " saldo is a table in cluster b2
APPEND saldo TO lit_saldo.
ENDLOOP.
ENDIF.
ENDIF.
END-OF-SELECTION.
Subscribe to:
Posts (Atom)