Skip to Content
0
Former Member
Nov 07, 2007 at 08:18 AM

Issue when using FM DataSource extracting data

32 Views

Dears,

I'm facing a issue on extracting data via Function Module DataSource. The issue is that the DataSource test ok in SAP R/3 in TC: RSA3, however, when I execute the InfoPackage according this DataSource in BW, the Data can arrive PSA, however, can't be updated in data target.No error message, the extraction job is cancelled in R/3.

Following is my source code of the according FM:

IF s_counter_datapakid = 0.

  • Fill range tables BW will only pass down simple selection criteria

  • of the type SIGN = 'I' and OPTION = 'EQ' or OPTION = 'BT'.

LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'perio'.

MOVE-CORRESPONDING l_s_select TO l_r_perio.

APPEND l_r_perio.

ENDLOOP.

LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'werks'.

MOVE-CORRESPONDING l_s_select TO l_r_werks.

APPEND l_r_werks.

ENDLOOP.

SELECT vbrkwaerk AS waerk vbrkfkdat AS fkdat

vbrpwerks AS werks vbrpmatnr AS matnr

vbrpfklmg AS fklmg vbrpnetwr AS netwr

INTO CORRESPONDING FIELDS OF f_vbr1_sel

FROM vbrk INNER JOIN vbrp

ON vbrkvbeln = vbrpvbeln

ORDER BY fkdat werks matnr.

CONCATENATE f_vbr1_sel-fkdat(4) '0'

f_vbr1_sel-fkdat+4(2) INTO f_vbr1_sel-perio.

IF s_counter_loop IS INITIAL.

MOVE f_vbr1_sel TO f_vbr2_sel.

s_counter_loop = s_counter_loop + 1.

ELSE.

s_counter_loop = s_counter_loop + 1.

IF f_vbr1_sel-perio EQ f_vbr3_sel-perio AND

f_vbr1_sel-werks EQ f_vbr3_sel-werks AND

f_vbr1_sel-matnr EQ f_vbr3_sel-matnr.

f_vbr2_sel-fklmg = f_vbr2_sel-fklmg + f_vbr1_sel-fklmg.

f_vbr2_sel-netwr = f_vbr2_sel-netwr + f_vbr1_sel-netwr.

CLEAR f_vbr3_sel.

MOVE f_vbr1_sel TO f_vbr3_sel.

ELSE.

IF f_vbr2_sel-fklmg NE 0.

e_t_data-perio = f_vbr2_sel-perio.

e_t_data-waers = f_vbr2_sel-waerk.

e_t_data-werks = f_vbr2_sel-werks.

e_t_data-matnr = f_vbr2_sel-matnr.

e_t_data-periv = c_periv_k4.

e_t_data-stprs = f_vbr2_sel-netwr / f_vbr2_sel-fklmg * 1000.

APPEND e_t_data.

CLEAR e_t_data.

CLEAR f_vbr2_sel.

MOVE f_vbr1_sel TO f_vbr2_sel.

CLEAR f_vbr3_sel.

MOVE f_vbr1_sel TO f_vbr3_sel.

ENDIF.

ENDIF.

ENDIF.

ENDSELECT.

ENDIF. "First data package ?

IF sy-subrc <> 0.

RAISE no_more_data.

ENDIF.

s_counter_datapakid = s_counter_datapakid + 1.

Any suggestions are welcome.

B.R

Gerald