cancel
Showing results for 
Search instead for 
Did you mean: 

Data in PSA getting multiplied compared to RSA3 data in source system

Former Member
0 Kudos

Hi ,

I created a Generic Datasource based on Function Module in SAP source system,

8 records Data is present in RSA3 and FM is also retrieving 8 records ,.  I created infopackge in BW and initilated the full update through infopackage.While data is loading into PSA,i am getting records continuosly(8 records per packet)and it is not getting stopped.I am not able to see any job running  in source system.

The load is happening from last 2 days and till now more than 300,000 lakh records are loaded.But i need only 8 records as this is the original count.

Can you please Help?

Thanks in Advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member186445
Active Contributor
0 Kudos

something will be wrong in your code. can you share it?

M.

Former Member
0 Kudos

Hi ,

Thanks for your reply.

FM was created by  ABAPer.

I just created the generic datasource based on FM and replicated it  in BW .Created the info package and started the load.Load is happening from last 2 days.

You want me share the FM code?

Thanks.

former_member186445
Active Contributor
0 Kudos

you can't just use a regular FM for data extraction. you need to create one within the BW logic. there is a lot of documentation available on the net on how to create a generic extractor based on a function module.

e.g.

M.

Former Member
0 Kudos

Hi,

FM is retrieving all the data as full update but not based on any delta fields.

Data source also should retrieve all the data every time into BW.

Regards,

Hemalatha

former_member186445
Active Contributor
0 Kudos

again, is the function module created for BW extraction???

Former Member
0 Kudos

Hi,

Yes FM is created for BW extraction.FM is retrieving different fields data from multiple tables and storing in extract structure.

Regards,

Hemalatha

former_member186445
Active Contributor
0 Kudos

ok. now it's clear. can you paste the code of your FM?

Former Member
0 Kudos

Hi,

Below is the FM code which we have written.

TYPES: BEGIN OF ty_header,

          zspid  TYPE zint_pod,

          anlage TYPE  anlage,

          ab     TYPE abzeitsch,

          bis    TYPE biszeitsch,

         END OF ty_header,

         BEGIN OF ty_history,

          zspid     TYPE zint_pod,

          zrectype  TYPE zrectype1,

          ab        TYPE abzeitsch ,

          bis       TYPE biszeitsch,

          zretailid TYPE zretailid,

         END OF ty_history,

         BEGIN OF ty_ettifn,

           anlage TYPE anlage,

           operand TYPE e_operand,

           saison TYPE saison,

           ab TYPE abzeitsch,

           ablfdnr TYPE ablfdnr,

           bis TYPE biszeitsch,

           tarifart TYPE tarifart,

         END OF ty_ettifn.

* Internal Table

  DATA : it_header       TYPE STANDARD TABLE OF ty_header,

         it_history      TYPE STANDARD TABLE OF ty_history,

         it_history_temp TYPE STANDARD TABLE OF ty_history,

         it_header_temp  TYPE STANDARD TABLE OF ty_header,

         it_anlage       TYPE zmr_t_anlage,

         it_ettifn       TYPE STANDARD TABLE OF ty_ettifn,

         it_ettifn_t     TYPE STANDARD TABLE OF ty_ettifn.

* Work Area & Variables

  DATA : wa_header  TYPE ty_header ,

         wa_history TYPE ty_history,

         wa_final   TYPE zmr_s_bw_spid,

         wa_ettifn  TYPE ty_ettifn,

         wa_ettifn_t TYPE ty_ettifn,

         v_curdate   TYPE sy-datum,

         v_operand   TYPE e_operand,

         v_cdate     TYPE tvarv_val.

* Constants

  CONSTANTS : c_r         TYPE c VALUE 'R',

              c_o         TYPE c VALUE 'O',

              c_occ(8)    TYPE c VALUE 'OCCUPIED',

              c_void(8)   TYPE c VALUE 'VOID',

              c_x         TYPE c VALUE 'X',

              c_t         TYPE c VALUE 'T',

              c_mpw(10)   TYPE c VALUE 'NHH_MPW',

              c_mnpw(10)  TYPE c VALUE 'NHH_MNPW',

              c_aw(10)    TYPE c VALUE 'NHH_AW',

              c_uw(10)    TYPE c VALUE 'NHH_UW',

              c_ms(10)    TYPE c VALUE 'NHH_MS',

              c_as(10)    TYPE c VALUE 'NHH_AS',

              c_us(10)    TYPE c VALUE 'NHH_US',

              c_sw(10)    TYPE c VALUE 'NHH_SW',

              c_hd(10)    TYPE c VALUE 'NHH_HD',

              c_te(10)    TYPE c VALUE 'NHH_TE',

              c_wca(10)   TYPE c VALUE 'NHH_WCA',

              c_sca(10)   TYPE c VALUE 'NHH_SCA',

              c_tmpw(10)  TYPE c VALUE 'NHH_TMPW',

              c_tmnpw(10) TYPE c VALUE 'NHH_TMNPW',

              c_taw(10)   TYPE c VALUE 'NHH_TAW',

              c_tuw(10)   TYPE c VALUE 'NHH_TUW',

              c_tms(10)   TYPE c VALUE 'NHH_TMS',

              c_tas(10)   TYPE c VALUE 'NHH_TAS',

              c_tus(10)   TYPE c VALUE 'NHH_TUS',

              c_tsw(10)   TYPE c VALUE 'NHH_TSW',

              c_thd(10)   TYPE c VALUE 'NHH_THD',

              c_tte(10)   TYPE c VALUE 'NHH_TTE',

              c_twca(10)  TYPE c VALUE 'NHH_TWCA',

              c_tsca(10)  TYPE c VALUE 'NHH_TSCA',

              c_cdate(8)  TYPE c VALUE 'ZCURDATE'.

REFRESH e_t_data[].

SELECT SINGLE low INTO v_cdate

                    FROM tvarvc

                    WHERE name = c_cdate.

IF v_cdate IS INITIAL.

    v_curdate = sy-datum.

  ELSE.

    v_curdate = v_cdate.

  ENDIF.

* Select SPID History details

  SELECT zspid zrectype ab bis zretailid

                  INTO TABLE it_history

                  FROM zmr_spid_history

                  WHERE erdat = v_curdate

                  OR    aedat = v_curdate.

  IF sy-subrc NE 0.

    ev_msg = text-002.

    EXIT.

  ENDIF.

SORT it_history BY zspid zrectype ab bis.

  it_history_temp[] = it_history[].

DELETE ADJACENT DUPLICATES FROM it_history_temp COMPARING zspid.

* Select SPID Header details

  SELECT zspid anlage ab bis INTO TABLE it_header

            FROM zmr_spid_header

            FOR ALL ENTRIES IN it_history_temp

            WHERE zspid = it_history_temp-zspid.

IF sy-subrc NE 0.

    ev_msg = text-013.

    EXIT.

  ENDIF.

SORT it_header BY zspid.

it_header_temp[] = it_header[].

SORT it_header_temp BY anlage.

DELETE ADJACENT DUPLICATES FROM it_header_temp COMPARING anlage.

LOOP AT it_header_temp INTO wa_header.

  

APPEND wa_header-anlage TO it_anlage.

ENDLOOP.

SELECT anlage operand saison ab ablfdnr bis tarifart

              INTO TABLE it_ettifn

              FROM ettifn

              FOR ALL ENTRIES IN it_anlage

              WHERE anlage = it_anlage-anlage

              AND  operand IN (c_mpw,  c_mnpw,  c_aw,  c_uw,  c_ms,   c_as,

                               c_us,   c_sw,    c_hd,  c_te,  c_wca,  c_sca)

              AND inaktiv = gc_space

              AND string3 = gc_x.

IF sy-subrc EQ 0.

    SORT it_ettifn BY anlage operand saison ab DESCENDING ablfdnr DESCENDING.

    SELECT anlage operand saison ab ablfdnr bis tarifart

              INTO TABLE it_ettifn_t

              FROM ettifn

              FOR ALL ENTRIES IN it_anlage

              WHERE anlage = it_anlage-anlage

              AND  operand IN (c_tmpw, c_tmnpw, c_taw, c_tuw, c_tms,  c_tas,

                               c_tus,  c_tsw,   c_thd, c_tte, c_twca, c_tsca)

              AND inaktiv = gc_space.

  

IF sy-subrc EQ 0.

      SORT it_ettifn_t BY anlage operand saison ab DESCENDING ablfdnr DESCENDING.

    ENDIF.

  ENDIF.

* Read all History details

  LOOP AT it_history INTO wa_history.

    CLEAR wa_final.

    wa_final-zspid = wa_history-zspid.

    wa_final-zsercat  = wa_history-zspid+10(1).

    wa_final-zretailid = wa_history-zretailid.

    IF wa_history-zrectype = c_r.

      wa_final-zregstart = wa_history-ab.

      wa_final-zregend = wa_history-bis.

    ELSEIF wa_history-zrectype = c_o.

      wa_final-zoccstart = wa_history-ab.

      wa_final-zoccend = wa_history-bis.

      IF wa_history-bis >= v_curdate.

        wa_final-zoccstat = c_occ.

      ELSE.

        wa_final-zoccstat = c_void.

      ENDIF.

    ENDIF.

* Read Header details

    READ TABLE it_header INTO wa_header WITH KEY zspid = wa_history-zspid BINARY SEARCH.

    IF sy-subrc EQ 0.

      wa_final-zspidstart = wa_header-ab.

      wa_final-zspidend   = wa_header-bis.

    ENDIF.

* Read all the Operands for the Installation

    LOOP AT it_ettifn INTO wa_ettifn WHERE anlage = wa_header-anlage.

      wa_final-zsercom = wa_ettifn-operand.

      wa_final-zscstart = wa_ettifn-ab.

      wa_final-zscend = wa_ettifn-bis.

    

CONCATENATE wa_ettifn-operand+0(4) c_t wa_ettifn-operand+3 INTO v_operand.

      READ TABLE it_ettifn_t INTO wa_ettifn_t WITH KEY anlage = wa_ettifn-anlage

                                                       operand = v_operand

                                                       saison  = wa_ettifn-saison

                                                       ab = wa_ettifn-ab

                                                       ablfdnr = wa_ettifn-ablfdnr BINARY SEARCH.

      IF sy-subrc EQ 0.

        wa_final-ztariff = wa_ettifn_t-tarifart.

      ENDIF.

      APPEND wa_final TO e_t_data.

    ENDLOOP.

  ENDLOOP.

ENDFUNCTION.

former_member186445
Active Contributor
0 Kudos

check the below FM. this is the setup of a FM that you can use for a datasource...

RSAX_BIW_GET_DATA_SIMPLE

Former Member
0 Kudos

Hi,

Thanks.

FM sample code which you have sent is the BW FM which is created in BW. But the FM which i am referring is created in SAP source system and generic datasource has been created based on that to get data in BW through that datasource. FM is not the standard one.

Regards,

Hemalatha

former_member241863
Active Participant
0 Kudos

Hello ,

Change your FM and DataSource with the help of below link.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8d...

If you follow this link, then I am sure no issue will arrive.

Thanks

Pratyaksh Jeet

former_member186445
Active Contributor
0 Kudos

oh please, this is FM for in source system not in BW.... check properly.

this example fm contains the blue print on how to structure and code a function module that will be used for data extraction. the code you use is very much different. so convert your fm code to the bw code and then we can talk again....

there is no point in continuing this if you insist on using your existing code.

M.

Former Member
0 Kudos

Hi,

Thanks for your information.

I am not that much aware of FM creation and all.This FM was created by someone else.So i dont know what to be followed for BW FM or source system FM.

I will follow the steps given by you and get back to you if have  any issues.

Regards,

Hemalatha

Former Member
0 Kudos

Thanks Pratyaksh for the information.

I will follow the steps given by you and get back to you if have any issues.

Regards,

Hemalatha