Application Development and Automation 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: 
Read only

Function Module question

Former Member
0 Likes
650

Hello,

When i execute this code, I am getting a run-time short dump. The error says: 'Overwritten protection field'. The error says that we cannot modify the field-symbols. The error points to the highlighted portion of the code. How to overcome the error?

FIELD-SYMBOLS: <xth_data> TYPE HASHED TABLE,

<ls_data> TYPE /1SEM/_YS_DATA_150ZBPSMA03,

<ls_chas> TYPE /1SEM/_YS_CHAS_150ZBPSMA03,

<ls_kyfs> TYPE /1SEM/_YS_KYFS_150ZBPSMA03.

DATA: tmpamount TYPE F,

tmpvtype TYPE /BI0/OIVTYPE.

tmpvtype = '020'.

LOOP AT xth_data ASSIGNING <ls_data>.

ASSIGN COMPONENT 'S_CHAS' OF STRUCTURE <ls_data_new> TO <ls_nchas>.

ASSIGN COMPONENT 'S_KYFS' OF STRUCTURE <ls_data_new> TO <ls_nkyfs>.

IF ( <ls_chas>-0fiscper >= '012' ) AND ( <ls_chas>-0vtype = '10' ).

tmpamount = <ls_kyfs>-0amount * 100.

<b> <ls_kyfs>-0amount = tmpamount.

<ls_chas>-0vtype = tmpvtype.</b>

ENDIF.

ENDLOOP.

Thanks

null

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
0 Likes
617

I think you need to put ASSIGN statement.

Try to do like:

ASSIGN TMPAMOUNT TO <ls_kyfs>-0amount.
ASSIGN TMPVTYPE TO <ls_chas>-0vtype.

Regards,

Naimesh Patel

4 REPLIES 4
Read only

naimesh_patel
Active Contributor
0 Likes
618

I think you need to put ASSIGN statement.

Try to do like:

ASSIGN TMPAMOUNT TO <ls_kyfs>-0amount.
ASSIGN TMPVTYPE TO <ls_chas>-0vtype.

Regards,

Naimesh Patel

Read only

0 Likes
617

Hello Naimesh,

It didn't help.

I tried as you suggested. The error i get is:

<ls_kyfs>-amount is not defined as a field symbol.

Thanks.

Read only

Former Member
0 Likes
617

hi,

try this.

LOOP AT <b><xth_data></b> <b>into</b> <ls_data>.

ASSIGN COMPONENT 'S_CHAS' OF STRUCTURE <ls_data_new> TO <ls_nchas>.

ASSIGN COMPONENT 'S_KYFS' OF STRUCTURE <ls_data_new> TO <ls_nkyfs>.

IF ( <ls_chas>-0fiscper >= '012' ) AND ( <ls_chas>-0vtype = '10' ).

tmpamount = <ls_kyfs>-0amount * 100.

<ls_kyfs>-0amount = tmpamount.

<ls_chas>-0vtype = tmpvtype.

ENDIF.

ENDLOOP.

Read only

0 Likes
617

Hello Kamini,

It didn't help either. I get an error - Field-Symbol <ls_data> has not yet been assigned.

Thanks