cancel
Showing results for 
Search instead for 
Did you mean: 

0fi_gl_4 enhancement

Former Member
0 Kudos

Hi Experts,

I tried to enhance GL extractor. But once done, the FI doc number (BKPF -BELNR) is replaced by RBKP- BELNR. Not really able to figure out whats wrong in the code..

I am attaching the code...Can anyone please help..very urgent..

(Coding done based on suggestions by Olivier Cora in one other threads...Many thanks to him).

WHEN '0FI_GL_4'. " General Ledger

LOOP AT c_t_data INTO ls_figl_4.

lv_idx = sy-tabix.

SELECT SINGLE awkey INTO l_awkey

FROM bkpf

WHERE belnr = ls_figl_4-belnr

AND gjahr = ls_figl_4-gjahr

AND bukrs = ls_figl_4-bukrs.

IF sy-subrc = 0.

l_awkey = l_awkey(10).

SELECT SINGLE rmwwr wmwst1 belnr gjahr

INTO (ls_figl_4-zzgrossamt, ls_figl_4-zztaxamt, ls_figl_4-belnr, ls_figl_4-gjahr)

FROM rbkp

WHERE belnr = l_awkey.

IF sy-subrc EQ 0.

MODIFY c_t_data FROM ls_figl_4 INDEX lv_idx.

  • ENDIF.

*

  • IF sy-subrc = 0.

SELECT SINGLE mwskz wrbtr ebeln

INTO (ls_figl_4-zztaxcode, ls_figl_4-zznetamt, ls_figl_4-zzebeln)

FROM rseg

WHERE gjahr = ls_figl_4-gjahr

AND belnr = ls_figl_4-belnr

AND bukrs = ls_figl_4-bukrs.

IF sy-subrc EQ 0.

MODIFY c_t_data FROM ls_figl_4 INDEX lv_idx.

ENDIF.

ENDIF.

ENDIF.

ENDLOOP.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi,

The reason seems to be this section in your programming:

SELECT SINGLE rmwwr wmwst1 belnr gjahr

INTO (ls_figl_4-zzgrossamt, ls_figl_4-zztaxamt, ls_figl_4-belnr, ls_figl_4-gjahr)

FROM rbkp

WHERE belnr = l_awkey.

IF sy-subrc EQ 0.

MODIFY c_t_data FROM ls_figl_4 INDEX lv_idx.

As far as I can see you are overwriting with rbkp-belnr, since you use ls_figl_4-belnr. Your modify with "modify" c_t_data-belnr (bkpf) with ls-figl_4-belnr. you need to call your new belnr something else, like zbelnr.

Another thing: you dont need to write any coding for selecting field values from BKPF, since the extractor is already selecting from this table (standard). You just need to make an append structure on the extract structure with the fields from BKPF table you need. I don't know about the other tables you are using, but if you make an append stucture you just include the other fields too. Then you run the extractor from tcode RSA3 and check if the new fields are filled with the right values. If so - you don't need to do programming at all.

Performancewise it is furthermore much better to do look-ups on the BW-side instead of using a functional exit on the extractor. So if you already have the other data in BW in e.g. and ODS, then its much faster to make the look up against this -due to the fact that a R/3 system is setup to handle many small transactions (small amount on data in each transaction) where as a BW system is set-up to handle a few big transactions (large amount of data in each transaction).

I hope this answers your question.

Best regards,

Keld

Former Member
0 Kudos

Hi Keld,

Can you please help me with the coding....

Thanks in advance.

0 Kudos

Hi Monica.

You need to do the following:

1) Find the extractor in tcode RSA6 and make an enhancement to the extraction structure with the fields you need: awkey, zzgrossamt, zztaxamt, zbelnr, zgjahr

2) then the cooding should be as follows:

WHEN '0FI_GL_4'. " General Ledger

field-symbols: <ls_figl_4> type any.

LOOP AT c_t_data ASSIGNING <ls_figl_4>.

lv_idx = sy-tabix.

if not <ls_figl_4>-awkey is initial.

SELECT SINGLE rmwwr wmwst1 belnr gjahr

INTO (<ls_figl_4>-zzgrossamt, <ls_figl_4>-zztaxamt, <ls_figl_4>-zbelnr, <ls_figl_4>-zgjahr)

FROM rbkp

WHERE belnr = <ls_figl_4>-awkey(10).

SELECT SINGLE mwskz wrbtr ebeln

INTO (<ls_figl_4>-zztaxcode, <ls_figl_4>-zznetamt, <ls_figl_4>-zzebeln)

FROM rseg

WHERE gjahr = <ls_figl_4>-zgjahr

AND belnr = <ls_figl_4>-zbelnr

AND bukrs = <ls_figl_4>-bukrs.

ENDIF "awkey not initial.

ENDLOOP.

I have reduced your coding a bit. Field-symbols is used to speed up performance (you avoid the modify).

I hope this helps.

Best regards,

Keld

Former Member
0 Kudos

Hi All,

I can see that for same PO number, there are different line items with different net amounts .

For example:

PO number 4500001590 has 3 line items with Net amounts (getting from RSEG - WRBTR) 100, 200, 300. So total net amount I want is 600. But total tax amount(RBKP WMWST1) is 105.

what changes can I make to the code so that all the individual net amounts are added up in the report and tax amount is same.

[When I run the report with the mentioned code, its picking up 100 only and adding 3 times and also tax amount is trebled ].

Can anyone please help...its pretty urgent...

Answers (1)

Answers (1)

Former Member
0 Kudos

Can anyone please suggest solution.

Thanks in advance.

Message was edited by:

Monica