cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function Module time out

dti_gpe
Explorer
0 Likes
3,172
Hello expert

I have faced a problem with my function module that prints an account report for a web service.

When running my function module, it gives me the error Dump timeout, through analysis I realized that it is taking a long time to read a table. however I didn't have this problem before with the same function module it took around 1 to 3 minutes to load the data, but now it does around 10 to 15 minutes.
View Entire Topic
MateuszAdamus
Active Contributor
0 Likes

Hello jose.lopes2

Please use "Comment" when adding additional information to question. "Answer" is for solution proposal only.

You're probably reading the BSAK without using the primary key or any index, that's why it takes so long. But that's just a guess. You need to show your logic.

Kind regards,
Mateusz
dti_gpe
Explorer
0 Likes

Hello mateuszadamus

Do you want me to show the Program or the function ?.

What would be the way to be able to use index.

MateuszAdamus
Active Contributor
0 Likes

Need to see the function's code responsible for reading data from BSAK table to be able to see what might be the issue with it.

The index will be used if you use field from index in your WHERE condition of SELECT statement.

Kind regards,
Mateusz
dti_gpe
Explorer
0 Likes

The code is quite large. so exclude some parts...

IF bsik-budat IN so_budat.
t_bsik-bukrs = bsik-bukrs.
t_bsik-lifnr = bsik-lifnr.
t_bsik-fwaer = bsik-waers.
t_bsik-budat = bsik-budat.
t_bsik-blart = bsik-blart.
t_bsik-belnr = bsik-belnr.
t_bsik-xblnr = bsik-xblnr.
t_bsik-shkzg = bsik-shkzg.
t_bsik-hkont = bsik-hkont.
t_bsik-umskz = bsik-umskz.
t_bsik-wrbtr = bsik-wrbtr.
t_bsik-wrshb = bsega-wrshb.
t_bsik-dmbtr = bsik-dmbtr.
t_bsik-dmshb = bsega-dmshb.
t_bsik-gjahr = bsik-gjahr.

SELECT SINGLE augbl FROM bsakINTO t_bsik-augblWHERE bukrs EQ bsik-bukrsAND lifnr EQ bsik-lifnrAND gjahr EQ bsik-gjahrAND belnr EQ bsik-belnrand SHKZG EQ bsik-SHKZGAND WAERS EQ bsik-WAERS.

APPEND t_bsik.ENDIF..

.

-----

* Tratar primeiro os ABLOOP AT lt_bsik INTO ls_bsik WHERE blart EQ 'AB'.
SELECT *FROM bsak INTO TABLE lt_bsakWHERE augbl EQ ls_bsik-belnr " and ( blart eq 'ES' or blart eq 'RE').AND budat IN so_budat.
IF sy-subrc EQ 0.
CLEAR: lv_re, lv_es, total_re, total_es, lv_total, total_ab_deb, total_ab_cre, ls_bsak_tmp.
* Calcular os totais de todos os items para doc RE e doc ES

LOOP AT lt_bsak INTO ls_bsak_tmp.
IF ls_bsak_tmp-blart EQ 'RE' AND ls_bsak_tmp-shkzg EQ 'S'.
lv_re = ls_bsak_tmp-belnr.
total_re = total_re + ls_bsak_tmp-wrbtr.ELSEIF ls_bsak_tmp-blart EQ 'RE' AND ls_bsak_tmp-shkzg EQ 'H'.
lv_re = ls_bsak_tmp-belnr.
total_re = total_re + ls_bsak_tmp-wrbtr.
total_re = total_re * -1.ELSEIF ls_bsak_tmp-blart EQ 'ES' AND ls_bsak_tmp-shkzg EQ 'H'.
lv_es = ls_bsak_tmp-belnr.
total_es = total_es + ls_bsak_tmp-wrbtr.
total_es = total_es * -1.ELSEIF ls_bsak_tmp-blart EQ 'ES' AND ls_bsak_tmp-shkzg EQ 'S'.
lv_es = ls_bsak_tmp-belnr.
total_es = total_es + ls_bsak_tmp-wrbtr.ELSEIF ls_bsak_tmp-blart EQ 'AB' AND ls_bsak_tmp-shkzg EQ 'S'.
total_ab_deb = total_ab_deb + ls_bsak_tmp-wrbtr.ELSEIF ls_bsak_tmp-blart EQ 'AB' AND ls_bsak_tmp-shkzg EQ 'H'.
total_ab_cre = total_ab_cre + ls_bsak_tmp-wrbtr.
total_ab_cre = total_ab_cre * -1.ENDIF.ENDLOOP.
IF lv_re IS NOT INITIAL AND lv_es IS NOT INITIAL.
lv_total = total_es + total_re + total_ab_cre + total_ab_deb.
IF lv_total EQ 0.CLEAR ls_excluir.
ls_excluir-num_excluir = ls_bsik-belnr.APPEND ls_excluir TO lt_excluir.
CLEAR ls_excluir.
ls_excluir-num_excluir = lv_re.APPEND ls_excluir TO lt_excluir.
CLEAR ls_excluir.
ls_excluir-num_excluir = lv_es.APPEND ls_excluir TO lt_excluir.ENDIF.ENDIF.
ELSE.
CLEAR: lt_bsak[], ls_bsak_tmp, total_blart, total_ab_deb, total_ab_cre.

SELECT * FROM bsak INTO TABLE lt_bsakWHERE augbl EQ ls_bsik-augblAND bukrs EQ ls_bsik-bukrsAND lifnr EQ ls_bsik-lifnrAND gjahr EQ ls_bsik-gjahr.
IF sy-subrc EQ 0.LOOP AT lt_bsak INTO ls_bsak_tmp.IF ls_bsak_tmp-blart NE 'AB' AND ls_bsak_tmp-shkzg EQ 'H'.
lv_blart = ls_bsak_tmp-belnr.
total_blart = total_blart + ls_bsak_tmp-wrbtr.
total_blart = total_blart * -1.ELSEIF ls_bsak_tmp-blart NE 'AB' AND ls_bsak_tmp-shkzg EQ 'S'.
lv_blart = ls_bsak_tmp-belnr.
total_blart = total_blart + ls_bsak_tmp-wrbtr.ELSEIF ls_bsak_tmp-blart EQ 'AB' AND ls_bsak_tmp-shkzg EQ 'S'.
total_ab_deb = total_ab_deb + ls_bsak_tmp-wrbtr.ELSEIF ls_bsak_tmp-blart EQ 'AB' AND ls_bsak_tmp-shkzg EQ 'H'.
total_ab_cre = total_ab_cre + ls_bsak_tmp-wrbtr.
total_ab_cre = total_ab_cre * -1.ENDIF.ENDLOOP.IN so_budat.
IF sy-subrc EQ 0.
CLEAR: lv_re, lv_es, total_re, total_es, lv_total, total_ab_deb, total_ab_cre, ls_bsak_tmp.

MateuszAdamus
Active Contributor

I see you're reading from BSAK based on AUGBL field only.

SELECT * FROM bsak INTO TABLE lt_bsak WHERE augbl EQ ls_bsik-belnr " and ( blart eq 'ES' or blart eq 'RE').AND budat IN so_budat.

You should check in SE11 transaction in BSAK definition what is the primary key and what indices are available and try to modify you SELECT's WHERE clause to meet one of these indices. If that's not possible, your next best option is to create a new index which with the fields you're using in your SELECT, this should speed-up the DB read.

Also, please format your code with the "Code" button of the comment editor.

Kind regards,

Mateusz
dti_gpe
Explorer
0 Likes

mateuszadamus

I'm already using the primary keys, so it may be necessary to create a new index, so I'll proceed with this option. then I say if the problem is solved. Thank you very much