2014 Jul 21 8:18 PM
Hi Experts,
I am trying to improve performance program that has a standard abap function module inside a loop. I am some what lost on what to do here. Here below is what the code looks like as of now. I have read that i need to try and not use the function module at all be it is a very complicated function module. Any suggestions will be appreciated.
DATA: tl_retorno TYPE bapireturn1 OCCURS 0 WITH HEADER LINE. "Retorno
DATA: wl_bukrs LIKE acct_det_bf-comp_code, "Empresa
wl_process LIKE acct_det_bf-process, "Chave
wl_symko LIKE hrpp_acct_det-symb_acct, "Conta Simbólica
wl_momag LIKE hrpp_acct_det-eg_acct_det, "Agrupamento
wl_razao LIKE acct_det_bf-gl_account. "Conta Razão
*--> <--*
SORT tg_rubcr BY bukrs lgart.
LOOP AT tg_rubcr.
CLEAR: wl_bukrs, wl_process, wl_symko, wl_momag, wl_razao.
wl_bukrs = tg_rubcr-bukrs.
wl_process = tg_rubcr-process.
wl_symko = tg_rubcr-symko.
CLEAR tg_aux.
IF tg_rubcr-u_momag IS INITIAL. "A rubrica necessita de agrupamento?
CLEAR wl_momag.
* Busca Contas Razão sem Agrupamento de Empregados
CALL FUNCTION 'HRPP_FI_ACCT_DET_HR'
EXPORTING
companycode = wl_bukrs
process = wl_process
symb_acct = wl_symko
eg_acct_det = wl_momag
add_modif = ' '
IMPORTING
gl_account_debit = wl_razao
* GL_ACCOUNT_CREDIT =
* POSTING_KEY_DEBIT =
* POSTING_KEY_CREDIT =
* ACCOUNT_TYPE =
TABLES
return_tab = tl_retorno.
tg_rubcr-razao = wl_razao.
tg_aux = tg_rubcr.
APPEND tg_aux.
ELSE. "Não necessita de agrupamento de empregado?
LOOP AT tg_t52em. "Para todos os agrupamentos
CLEAR tg_aux.
CLEAR tl_retorno.
REFRESH tl_retorno.
CLEAR wl_momag.
wl_momag = tg_t52em-momag.
* Busca Contas Razão com Agrupamento de Empregados
CALL FUNCTION 'HRPP_FI_ACCT_DET_HR'
EXPORTING
companycode = wl_bukrs
process = wl_process
symb_acct = wl_symko
eg_acct_det = wl_momag
add_modif = ' '
IMPORTING
gl_account_debit = wl_razao
* GL_ACCOUNT_CREDIT =
* POSTING_KEY_DEBIT =
* POSTING_KEY_CREDIT =
* ACCOUNT_TYPE =
TABLES
return_tab = tl_retorno.
tg_rubcr-razao = wl_razao.
tg_aux = tg_rubcr.
tg_aux-momag = tg_t52em-momag.
APPEND tg_aux.
ENDLOOP.
ENDIF.
ENDLOOP.
* Limpa tabela com rubricas e move todo o conteúdo da auxiliar
REFRESH tg_rubcr.
CLEAR tg_rubcr.
tg_rubcr[] = tg_aux[].
ENDFORM. " busca_conta_razao
2014 Jul 21 8:46 PM
Hi Patrick,
If you do not want to use the function module then the other option that you can use is do selects from the tables that the FM 'HRPP_FI_ACCT_DET_HR' is using to get the importing "parameter gl_account_debit = wl_razao" outside the loop.
So steps will be:
Please let me know if you need more details.
2014 Jul 21 8:46 PM
Hi Patrick,
If you do not want to use the function module then the other option that you can use is do selects from the tables that the FM 'HRPP_FI_ACCT_DET_HR' is using to get the importing "parameter gl_account_debit = wl_razao" outside the loop.
So steps will be:
Please let me know if you need more details.
2014 Jul 21 9:32 PM
Hi Sandip,
Thank you for replying, it was helpful, but could you please detail the three points for me a little more.
Thanks
2014 Jul 21 9:42 PM
Put a break point in FM 'HRPP_FI_ACCT_DET_HR' to find the exporting parameters.
Then open a new SE37 session give your inputs and start debugging.
Properly check all the selects and internal tables that are populated inside the FM to get to the point where the importing parameter gl_account_debit = wl_razao is filled in.
Idea here is to write the pseudo code of the FM outside the loop before the loop is called and fill an internal table with fields and values that you are passing to this FM and there should be a field that will contain the impoting parameter value also.
Once inside the loop do a read table for the internal table with key from table fields of looping table and match them from the value in the internal table prepared.
Regards,
Sandip
2014 Jul 22 6:27 AM
Hi Patrick,
CALL FUNCTION - STARTING NEW TASK
Check this concept of PARALLEL PROCESSING.
thanks,
Anil