2016 Sep 14 5:19 PM
Currently there is a badi that contains instructions to manipulate data from an HRFORM named zhr_payslip_xxx.
The code is as follows:
FIELD-SYMBOLS: <im_data> TYPE /1pyxxfo/zhr_payslip_xxx.
DATA: l_lines TYPE i,
ls_deductions_y4 LIKE LINE OF <im_data>-star_deductions_y4,
ls_payments_z9 LIKE LINE OF <im_data>-star_payments_z9,
wc_notices LIKE LINE OF <im_data>-star_notices,
wc_inperiod LIKE LINE OF <im_data>-dim_forperiod,
l_begdate TYPE d,
l_enddate TYPE d.
* Assign the infostar!
ASSIGN ch_data->* TO <im_data> CASTING.
*Reject if no data!
DESCRIBE TABLE <im_data>-dim_inperiod_id LINES l_lines.
IF l_lines = 0.
RAISE reject.
ELSE.
* Save current period info
READ TABLE <im_data>-dim_forperiod INDEX 1 INTO wc_inperiod.
l_begdate = wc_inperiod-key-begin_date.
l_enddate = wc_inperiod-key-end_date.
ENDIF.
I need to re use the same code but with a different HRFORM named zhr_payslip_yyy.
Are any of you aware on how can it be possible to declare/assign a different type to <im_data>?
Something like a
if XXX =‘1’.
FIELD-SYMBOLS: <im_data> TYPE /1pyxxfo/zhr_payslip_xxx.
Else
FIELD-SYMBOLS: <im_data> TYPE /1pyxxfo/zhr_payslip_yyy.
Endif.
Could anybody please point me on the correct direction on how to achieve this ?
2016 Sep 14 6:27 PM
Use type ANY.
FIELD-SYMBOLS: <im_data> TYPE ANY.
Regards,
Naveen
Currently there is a badi that contains instructions to manipulate data from an HRFORM named zhr_payslip_xxx.
The code is as follows:
FIELD-SYMBOLS: <im_data> TYPE /1pyxxfo/zhr_payslip_xxx.
DATA: l_lines TYPE i,
ls_deductions_y4 LIKE LINE OF <im_data>-star_deductions_y4,
ls_payments_z9 LIKE LINE OF <im_data>-star_payments_z9,
wc_notices LIKE LINE OF <im_data>-star_notices,
wc_inperiod LIKE LINE OF <im_data>-dim_forperiod,
l_begdate TYPE d,
l_enddate TYPE d.
* Assign the infostar!
ASSIGN ch_data->* TO <im_data> CASTING.
*Reject if no data!
DESCRIBE TABLE <im_data>-dim_inperiod_id LINES l_lines.
IF l_lines = 0.
RAISE reject.
ELSE.
* Save current period info
READ TABLE <im_data>-dim_forperiod INDEX 1 INTO wc_inperiod.
l_begdate = wc_inperiod-key-begin_date.
l_enddate = wc_inperiod-key-end_date.
ENDIF.
I need to re use the same code but with a different HRFORM named zhr_payslip_yyy.
Are any of you aware on how can it be possible to declare/assign a different type to <im_data>?
Something like a
if XXX =‘1’.
FIELD-SYMBOLS: <im_data> TYPE /1pyxxfo/zhr_payslip_xxx.
Else
FIELD-SYMBOLS: <im_data> TYPE /1pyxxfo/zhr_payslip_yyy.
Endif.
Could anybody please point me on the correct direction on how to achieve this ?
2016 Sep 14 6:27 PM
Use type ANY.
FIELD-SYMBOLS: <im_data> TYPE ANY.
Regards,
Naveen
2016 Sep 14 6:48 PM
Do it all dynamic as Naveen said (and you'll also need to use additionally other field symbols and statements like ASSIGN COMPONENT 'DIM_INPERIOD_ID' OF STRUCTURE <im_data> TO <dim_inperiod_id>), but if you have only one other HR form, then maybe it will be more readable to define a separate field symbol:
FIELD-SYMBOLS: <im_data_xxx> TYPE /1pyxxfo/zhr_payslip_xxx.
FIELD-SYMBOLS: <im_data_yyy> TYPE /1pyxxfo/zhr_payslip_yyy.
if XXX =‘1’.
ASSIGN ch_data->* TO <im_data_xxx> CASTING..
" only work with <im_data_xxx>
Else.
ASSIGN ch_data->* TO <im_data_yyy> CASTING..
" only work with <im_data_yyy>
Endif.
2016 Sep 15 10:28 AM
Thank you both.
I have done already something similar to Sandra's code, but I am not entirely happy about it.
I want to use the same Field-symbol name but different type.
I will see if I can learn to do it with the assign component code...
Thank you
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |