Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

GETWA_NOT_ASSIGNED DUMP in a background job

Former Member
0 Kudos

Hi experts,

I am running a program in background (with a job) but it is being canceled after 7000 secs getting this dump:

GETWA_NOT_ASSIGNED - You attempted to access an unassigned field symbol (data segment "-1"). The point is that when I schedule the job with same employees, not altogether but in different job splitted, the jobs work fine. What I mean is that if I run it for a big company get wrong but for small companies work fine.

I am going to copy the program here and I will mark where the error comes out. Could you please help me with that?

Thanks in advance.

METHOD fill_alimony_information.

DATA lv_field_name TYPE char32.
DATA ls_p0736 TYPE p0736.
DATA ls_rgdir TYPE pc261.
DATA ls_grrec TYPE pc2grr.
DATA ls_paybr_result TYPE paybr_result.
DATA ls_group TYPE gty_s_group.
DATA ls_wt_group_period TYPE gty_s_wt_group_period.
DATA lt_rgdir TYPE hrpy_tt_rgdir.
DATA lv_occat TYPE pay_occat.
DATA lv_fire_date TYPE endda.

DATA lt_group_range TYPE RANGE OF char10.
DATA ls_group_range LIKE LINE OF lt_group_range.

DATA ls_alimony TYPE hrpadbr_s_dirf_alimony.
DATA lv_month TYPE c LENGTH 2.

FIELD-SYMBOLS <ls_alimony> TYPE hrpadbr_s_dirf_alimony.
FIELD-SYMBOLS <ls_amount> TYPE hrpaybr_s_dirf_2010_amounts.
FIELD-SYMBOLS <lv_field> TYPE hrpaybr_dirf_amt_07.

* If he has no alimony entry, we already return.
IF mt_p0736 IS INITIAL.
RETURN.
ENDIF.


* If the validity has no value, it means the 'normal' results, including vacation and 13
* If the validity has a value, it means that we must only get the amount relevant to the PLR
* So for this we build a range, to make easier to do the reading of this.
IF iv_validity IS INITIAL.
ls_group_range-sign = 'I'.
ls_group_range-option = 'EQ'.
ls_group_range-low = gc_grp_alimony.

APPEND ls_group_range TO lt_group_range.

ls_group_range-sign = 'I'.
ls_group_range-option = 'EQ'.
ls_group_range-low = gc_grp_alimony_13.

APPEND ls_group_range TO lt_group_range.

ls_group_range-sign = 'I'.
ls_group_range-option = 'EQ'.
ls_group_range-low = gc_grp_alimony_vacation.

APPEND ls_group_range TO lt_group_range.
ELSEIF iv_validity = gc_validity_plr.
ls_group_range-sign = 'I'.
ls_group_range-option = 'EQ'.
ls_group_range-low = gc_grp_alimony_plr.

APPEND ls_group_range TO lt_group_range.
* ELSEIF iv_validity = gc_validity_rra.
* ls_group_range-sign = 'I'.
* ls_group_range-option = 'EQ'.
* ls_group_range-low = gc_grp_alimony_rra.
*
* APPEND ls_group_range TO lt_group_range.
ELSE.
RETURN.
ENDIF.

* Now we process the alimony entries in the infotype
* to start creating the beneficiary information
LOOP AT mt_p0736 INTO ls_p0736
WHERE begda <= mv_endda
AND endda >= mv_begda.

* We check if we already have an entry for this CPF, if not, we add one
* This is because the DIRF is by CPF of the employee, not by PERNR...
READ TABLE ct_alimony TRANSPORTING NO FIELDS
WITH KEY beneficiary-cpf = ls_p0736-cpfnr.
IF sy-subrc <> 0.
ls_alimony-beneficiary-rec_id = 'INFPA'.

ls_alimony-beneficiary-cpf = ls_p0736-cpfnr.

ls_alimony-beneficiary-dbirth = ls_p0736-gbdat.
ls_alimony-beneficiary-name = ls_p0736-emftx.

APPEND ls_alimony TO ct_alimony.
ENDIF.

ENDLOOP.

IF ct_alimony IS NOT INITIAL.

* We read the payroll for the whole year, as we will need to use the GRREC to process the alimony.
mo_read_payroll->get_rgdir_by_pay_date( EXPORTING
iv_begda = mv_begda
iv_endda = mv_endda
iv_srtza = 'A'
iv_reorg_rgdir = abap_true
IMPORTING
et_rgdir = lt_rgdir ).

* Check if the current payroll is the dismissal payroll of the
* employee
lv_fire_date = me->get_fire_date( ).

LOOP AT lt_rgdir INTO ls_rgdir.

* Verify if the RGDIR is relevant for the report
IF ( me->is_rgdir_relevant( ls_rgdir ) = abap_false ).
CONTINUE.
ENDIF.

lv_occat = ls_rgdir-occat.

LOOP AT mt_p0661 TRANSPORTING NO FIELDS
WHERE begda = lv_fire_date
AND begda+4(2) = ls_rgdir-fpbeg+4(2).
lv_occat = pbr99_occat_resc.
ENDLOOP.

* Check if it is possible to count dependents in this off-cycle
IF NOT lv_occat IN mt_dependent_occat AND
NOT lv_occat IS INITIAL.
CONTINUE.
ENDIF.

mo_read_payroll->get_pay_result(
EXPORTING
is_rgdir = ls_rgdir
IMPORTING
es_paybr_result = ls_paybr_result ).

LOOP AT ls_paybr_result-nat-grrec INTO ls_grrec.

* We read the infotype p0736 to get the CPF of the pensionist
LOOP AT mt_p0736 INTO ls_p0736 WHERE begda <= ls_rgdir-fpend AND
endda >= ls_rgdir-fpbeg AND
ionum = ls_grrec-ionum.
ENDLOOP.
IF sy-subrc = 0.

* With this we can read the information already present in the DIRF for
* that CPF, so that we can add it to the value.
* It should have been created above, or even at another execution
READ TABLE ct_alimony ASSIGNING <ls_alimony>
WITH KEY beneficiary-cpf = ls_p0736-cpfnr.
IF sy-subrc <> 0.
CONTINUE.
ENDIF.

ENDIF.

* Check if the wage type of GRREC is selected
LOOP AT mt_groups[] INTO ls_group
WHERE group IN lt_group_range.

LOOP AT mt_wt_group_period[] INTO ls_wt_group_period
WHERE group = ls_group-group
AND begda <= ls_grrec-rcdat
AND endda >= ls_grrec-rcdat.
ENDLOOP.

IF sy-subrc <> 0 OR
NOT ls_grrec-lgart IN ls_wt_group_period-lgart_range[].
CONTINUE.
ENDIF.

* So only for the 13 we have a specific case, so if it's from the group for 13
* we need to add it to the 13 group, in all other cases it goes to the payment month...
IF ls_group-group = gc_grp_alimony_13.
lv_month = '13'.
ELSE.
lv_month = ls_rgdir-paydt+4(2).
ENDIF.

* We check if we already have a entry for the amount, if we don't have, we will create one
READ TABLE <ls_alimony>-amounts ASSIGNING <ls_amount>
WITH KEY rec_id = 'RTPA'. -> HERE THE ERROR COMES OUT

IF sy-subrc <> 0.
APPEND INITIAL LINE TO <ls_alimony>-amounts ASSIGNING <ls_amount>.
<ls_amount>-rec_id = 'RTPA'.
ENDIF.

CONCATENATE 'AMOUNT_' lv_month INTO lv_field_name.

ASSIGN COMPONENT lv_field_name OF STRUCTURE <ls_amount> TO <lv_field>.
IF sy-subrc = 0.
* We multiply it with 100 so we remove the decimal place.
<lv_field> = <lv_field> + ls_grrec-rcamt * 100.

me->check_size_amount(
EXPORTING iv_rec_id = 'RTPA'
iv_amount = <lv_field>
EXCEPTIONS
ex_hrpaybr_amount_too_large = 1 ).

IF ( sy-subrc <> 0 ).
RAISE ex_hrpaybr_amount_too_large.
ENDIF.

ENDIF.

ENDLOOP.

ENDLOOP.

ENDLOOP.

ENDIF.

CALL BADI mr_badi_instance->fill_person_record_infpa
EXPORTING
iv_pernr = mv_pernr
iv_begda = mv_begda
iv_endda = mv_endda
io_read_payroll = mo_read_payroll
iv_ret_code = mv_ret_code
CHANGING
ct_dirf_record = ct_alimony.

DELETE ct_alimony WHERE amounts IS INITIAL.

ENDMETHOD.

1 ACCEPTED SOLUTION

former_member182550
Active Contributor
0 Kudos

LOOP AT mt_p0736 INTO ls_p0736 WHERE begda <= ls_rgdir-fpend AND
endda >= ls_rgdir-fpbeg AND
ionum = ls_grrec-ionum.
ENDLOOP.
IF sy-subrc = 0.

* With this we can read the information already present in the DIRF for
* that CPF, so that we can add it to the value.
* It should have been created above, or even at another execution
READ TABLE ct_alimony ASSIGNING <ls_alimony>
WITH KEY beneficiary-cpf = ls_p0736-cpfnr.
IF sy-subrc <> 0.
CONTINUE.
ENDIF.

ENDIF.

If you don't get your record in mt_p0736, then you don't read your ct_alimony table, assigning your <ls_alimony> field symbol.

I think you need to move the second endif above to just before your end method code......


Rich

3 REPLIES 3

former_member182550
Active Contributor
0 Kudos

LOOP AT mt_p0736 INTO ls_p0736 WHERE begda <= ls_rgdir-fpend AND
endda >= ls_rgdir-fpbeg AND
ionum = ls_grrec-ionum.
ENDLOOP.
IF sy-subrc = 0.

* With this we can read the information already present in the DIRF for
* that CPF, so that we can add it to the value.
* It should have been created above, or even at another execution
READ TABLE ct_alimony ASSIGNING <ls_alimony>
WITH KEY beneficiary-cpf = ls_p0736-cpfnr.
IF sy-subrc <> 0.
CONTINUE.
ENDIF.

ENDIF.

If you don't get your record in mt_p0736, then you don't read your ct_alimony table, assigning your <ls_alimony> field symbol.

I think you need to move the second endif above to just before your end method code......


Rich

0 Kudos

Hi Richard,

Don't think so, because if sy-subrc was not 0 it will leave from the LOOP as the statement below.

IF sy-subrc <> 0.

CONTINUE.

ENDIF.

Anyway, this code is from SAP Standar and it seems that if you run the transaction for less employees it works... so maybe its is a memory problem.

Thanks,

Pablo

0 Kudos

If you're getting a short dump in a standard program then search the SAP notes for a correction and, if none found, contact SAP Support, not SCN.