‎2009 Apr 02 2:31 PM
Hello,
I am writing a piece of code based on the PNP logical database. I have declared a NODE
as:
NODES: payroll TYPE paygb_result.
I can refer to fields in the INTER component i.e. DATA: wa_rt LIKE LINE OF payroll-inter-rt
but when I refer to the part which is country specific
i.e. DATA: wa_pens LIKE LINE OF payroll-nat-pens
the syntax checker is saying that "PAYROLL" does not have a component called "NAT_PENS".
I can double click on paygb_result which shoes a component called NAT. Then clicking on
PAYGB_NATIONAL then displays the component PENS.
Can anyone tell me why this is happening?
Any help much appreciated.
Andy
‎2009 Apr 02 3:21 PM
try this
TYPES : t_rt TYPE LINE OF paygb_result-inter-rt ,
t_pen TYPE LINE OF paygb_result-nat-pens .
DATA: wa_rt TYPE t_rt .
DATA: wa_pens TYPE t_pen .
‎2009 Apr 02 3:21 PM
try this
TYPES : t_rt TYPE LINE OF paygb_result-inter-rt ,
t_pen TYPE LINE OF paygb_result-nat-pens .
DATA: wa_rt TYPE t_rt .
DATA: wa_pens TYPE t_pen .
‎2009 Apr 02 3:28 PM
Thanks very much for replying,but how do I now look at the results?
If I say:
LOOP AT paygb_result-nat-pens INTO wa_pens.
ENDLOOP.
I now get another syntax error.
Many thanks
‎2009 Apr 02 3:30 PM
Managed to solve it.
Many, many thanks mate. You have solved a very big headache!!!!
Cheers
‎2009 Apr 02 3:42 PM
Hi,
I have checked in ECC 6 and no errors came.
Please check the bleow code.
data : payroll type paygb_result.
data: wa_pens like line of payroll-nat-pens, ( or)
wa_pens type PC22P.
LOOP AT payroll-nat-pens INTO wa_pens.
ENDLOOP.
In Loop at you have to specify the declared Node name ( i.e. payroll )but you specified the reference structure ( i.e. paygb_result-nat-pens ) which is wrong.
Please check that.
Regards,
Sunil
‎2009 Apr 02 3:39 PM
Hi,
NODES: payroll TYPE paygb_result.
This statement uses table which is only known to system at runtime.
In order you could address fields of this table (only NAT component which is country specific) you must declare another one of the same paygb_result type.
data: it_pens TYPE paygb_result-nat-pens,
wa_pens LIKE LINE OF it_pens. "using PAYROLL here, system will not recognize it, hence the syntax error
"now you can address WA_PENS fields here
As you noticed you can, however address component payroll-inter-rt , becasue it is non country specific, so is available for all payroll result types ( paygb_result , paynl_result , paypl_result etc ).
Regards
Marcin