Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

how to get Data from B2 Cluster

Former Member
0 Likes
2,991

Hi

I need to write a report which will get data from B2 Cluster.

Please can anyone provide me with the code how to get to the cluster and read from ZL and PT

Thanks in Advance

1 ACCEPTED SOLUTION
Read only

Former Member

Hi

I need to write a report which will get data from B2 Cluster.

Please can anyone provide me with the code how to get to the cluster and read from ZL and PT

Thanks in Advance

7 REPLIES 7
Read only

Former Member
0 Likes
1,887

Hi,

Use direct Select statement to read from the cluster table and then once you get the entries in an internal table, then you can use FOR ALL ENTRIES to fetch data from other tables.

Regards

Subramanian

Read only

0 Likes
1,887

Can you give me some code how to import all data from B2?

I got the following code from another thread

Pass values to

b2-key-pernr,

b2-key-pabrj,

b2-key-pabrp,

b2-key-cltyp.

and then call the macro

rp-imp-c2-b2.

SALDO is of structure pc2b5

After the macro call loop at 'SALDO' get 'ANZHL'

based on 'ZTART'

....

But i am not clear how to do it...

I did similar thing for the for a payroll table

..................

CD-KEY-PERNR = PERNR-PERNR.

RP-IMP-C2-CU. "macro resides in table TRMAC

IF RP-IMP-CD-SUBRC = 0.

LOOP AT RGDIR WHERE .....

UNPACK RGDIR-SEQNR TO RX-KEY-SEQNO.

RX-KEY-PERNR = PERNR-PERNR.

  • retrieve C1 and RT info from PCL2(RU)

RP-IMP-C2-RU. "macro resides in table TRMAC

IF RP-IMP-RU-SUBRC = 0.

'My method

CLEAR: RT, RT[].

ENDIF.

ENDLOOP.

CLEAR: RGDIR,

RGDIR[].

ENDIF.

.................

Can you show me the other code like the above one...

Message was edited by:

Anwarul Kabir

Message was edited by:

Anwarul Kabir

Read only

Former Member
Read only

0 Likes
1,887

Thanks for the link.

So whats the name of the cluster for B2 that I need to declare?

I declared as

Tables: B2. and its giving me error.

Read only

0 Likes
1,887

I'm not sure that you need to declare it.

Rob

Read only

0 Likes
1,887

Ok so far this is what I have done

&----


*& Report ZAKTIME *

*& *

&----


*& *

*& *

&----


REPORT ZAKTIME .

*----


  • Dictionary tables/structures

*----


tables: pernr, pcl2, pcl1.

include rpcxB200.

infotypes: 0001. "Org. Zuordnung

*----


  • main logic

*----


TOP-OF-PAGE.

START-OF-SELECTION.

GET PERNR.

RP-PROVIDE-FROM-LAST P0001 SPACE PNPBEGDA PNPENDDA.

  • process the data according to the payroll area

IF PERNR-WERKS EQ P0001-WERKS AND PERNR-BTRTL EQ P0001-BTRTL

AND PERNR-KOSTL EQ P0001-KOSTL AND PERNR-BUKRS EQ P0001-BUKRS

AND PERNR-ABKRS EQ P0001-ABKRS AND PERNR-KOKRS EQ P0001-KOKRS.

PERFORM RETRIEVE_Time.

ENDIF.

END-OF-SELECTION.

"======================================================================*

  • forms *

"======================================================================*

FORM RETRIEVE_Time.

B2-key-pernr = PERNR-PERNR.

RP-IMP-C2-B2. "macro resides in table TRMAC

IF rp-imp-b2-subrc = 0.

ENDIF.

ENDFORM. " RETRIEVE_PAYROLL

Getting the following errors

1. B2-Key_pernr is unknown

2.Bezug is Unknown

3. KNTAG is Unknown

Notice number 2 and 3 is not even in my program....

Also I was trying to pass the value to the parameter. why is this not working...

Read only

0 Likes
1,887

Try

*-----------------------------------------------------------------------
* Data includes
*-----------------------------------------------------------------------
  INCLUDE rpppxd00.
  DATA BEGIN OF COMMON PART buffer.
  INCLUDE rpppxd10.
  DATA END OF COMMON PART buffer.
  INCLUDE rpc2b200.
  TYPE-POOLS: p06iu.
*-----------------------------------------------------------------------
* Dictionary tables/structures
*-----------------------------------------------------------------------
  TABLES: pernr, pcl2, pcl1.
  INFOTYPES: 0001. "Org. Zuordnung
*-----------------------------------------------------------------------
* main logic
*-----------------------------------------------------------------------
  TOP-OF-PAGE.

  START-OF-SELECTION.

  GET pernr.
    rp-provide-from-last p0001 space pnpbegda pnpendda.

* process the data according to the payroll area
    IF pernr-werks EQ p0001-werks AND pernr-btrtl EQ p0001-btrtl
    AND pernr-kostl EQ p0001-kostl AND pernr-bukrs EQ p0001-bukrs
    AND pernr-abkrs EQ p0001-abkrs AND pernr-kokrs EQ p0001-kokrs.
      PERFORM retrieve_time.
    ENDIF.

  END-OF-SELECTION.
"======================================================================*
* Program includes
"======================================================================*
  INCLUDE rpppxm00.
"======================================================================*
* forms *
"======================================================================*
*---------------------------------------------------------------------*
*       FORM RETRIEVE_Time                                            *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
  FORM retrieve_time.

    b2-key-pernr = pernr-pernr.
    rp-imp-c2-b2.
    IF rp-imp-b2-subrc = 0.
    ENDIF.

Regards