‎2009 Jun 25 5:00 PM
Hi,
i try to do assign component like that and i get this dump ,any idea why?
after i doing the assign component commend in the line
<date> = sy-datum.
i get the dump :
field symbols: <date> type sy-datum.
ASSIGN is_bound_object TO <ls_object>.
ASSIGN COMPONENT 'DATE' OF STRUCTURE <ls_obt> TO <date>.
<date> = sy-datum.the error:
The following are protected from change:
- Character literals or numerical literals.
- CONSTANTS.
- Parameters of the category IMPORTING REFERENCE in functions and
methods.
- untyped field symbols, that have not been assigned a field using
ASSIGN.
- TABLES parameters, if the actual parameter is protected against
changes.
- USING reference parameters and CHANGING parameters in FORMs,
if the actual parameter is protected against changes.
- Access using field symbols if the field assigned using ASSIGN is
partly or completely protected (for example key components of in
table of the type SORTED or HASHED TABLE).
Br
Nina
‎2009 Jun 25 8:22 PM
Can you change it from an IMPORTING parameter to CHANGING?
Rob
‎2009 Jun 25 5:12 PM
Hi,
Are you trying to change some importing parameters?
Is the type of field 'DATE' OF STRUCTURE <ls_obt> same as sy-datum?
Regards,
Ankur Parab
‎2009 Jun 25 5:14 PM
HI ,
Yes sure i checked it ,it's the same type.
Best Regards
Nina
‎2009 Jun 25 5:16 PM
Hi Nina ,
Are you tried to change field symbols: <date> type sy-datum to type any ?
Because, <date> may receive any value and not just datum.
OR
Try..
WRITE sy-datum TO <date>.
Regards,
Bruno
Edited by: BrunoLima on Jun 25, 2009 6:16 PM
Edited by: BrunoLima on Jun 25, 2009 6:19 PM
‎2009 Jun 25 5:23 PM
The dump is very informative. Are you trying to change some parameter? What is is_bound_object? have you checked date is being assigned to the field symbol?
‎2009 Jun 25 5:29 PM
HI
when i do :
ASSIGN sy-datum TO <date>.
<date> = sy-datum .
i dont have dump but the structure not updated.
can i do it different ?
Br
Nina
Edited by: Nina C on Jun 25, 2009 6:32 PM
‎2009 Jun 25 5:34 PM
It is working because sy-datum can be changed, so there is no problem with the assign.
Your code can present several problems.
First, what is is_bound_object? The dump says it clear, if it is an importing parameter, you can't change it. If you want to change the value of the variable in the calling program, then that's a different story.
Second, the second assign returns sy-subrc = 0? If it doesn't the structure has no 'DATE' component and you are getting the dump because of that
‎2009 Jun 25 5:39 PM
HI ,
is_bnd_obj it's parameters that i get in the import ,
and i want to update it why i can to that ?
the Sy-subrc returen 0.
i have mistake when i copy it ,it should be:
ASSIGN is_bnd_obj TO <ls_obt>.
ASSIGN COMPONENT 'DATE' OF STRUCTURE <ls_obt> TO <date>.
<date> = sy-datum.
Best Regards
Nina
‎2009 Jun 25 5:47 PM
HI,
If it is an importing parameter it cannot be changed.
Regards,
Ankur Parab
‎2009 Jun 25 7:39 PM
HI Ankur ,
There is no way to overcome/Bypass this issue, the thing is in that the import parameter is type any ,i.e. can get any type of structure and i need to modify it.
Best regards
Nina
Edited by: Nina C on Jun 25, 2009 9:15 PM
‎2009 Jun 25 8:22 PM
Can you change it from an IMPORTING parameter to CHANGING?
Rob
‎2009 Jun 25 8:39 PM
HI Rob,
I change it and it working,
U think that this is the only way,to change from import to changing?
Best regards
nina
‎2009 Jun 25 8:45 PM
No, you can also define a local variable and copy the IMPORTING parameter to it (so long as you only need this value in this form or FM).
Rob