2008 Sep 14 4:02 PM
Hi Experts,
I am facing some problem with the currency feild. When I try to pass the curreny feild to the feild symbol it it not assignning.
Here is the scenarion.
FIELD-SYMBOLS: <fs>.
LOOP AT it_final1 INTO wa_final1.
ASSIGN COMPONENT 'AMT' OF STRUCTURE <wa_final2> TO <fs>.
IF sy-subrc = 0.
<fs> = wa_final1-wkgbtr.
ENDIF.
endloop.
when i pass wa_final1-wkgbtr to <fs> it is not moving.
can we pass the currency feild to the feild symbols directly???????
2008 Sep 14 5:26 PM
Hi Vimal,
I had declared it .
CREATE DATA w_structure LIKE LINE OF <final>.
ASSIGN w_structure->* TO <wa_final2>.
Hi Experts,
I am facing some problem with the currency feild. When I try to pass the curreny feild to the feild symbol it it not assignning.
Here is the scenarion.
FIELD-SYMBOLS: <fs>.
LOOP AT it_final1 INTO wa_final1.
ASSIGN COMPONENT 'AMT' OF STRUCTURE <wa_final2> TO <fs>.
IF sy-subrc = 0.
<fs> = wa_final1-wkgbtr.
ENDIF.
endloop.
when i pass wa_final1-wkgbtr to <fs> it is not moving.
can we pass the currency feild to the feild symbols directly???????
2008 Sep 14 4:16 PM
I am not sure that is your complete coding. but the code you mentioned is wrong.
Just check this sample code..
REPORT ZTEST_FS_CURRENCY.
data: it_vbap type vbap_t,
wa_vbap type vbap,
wa type vbap.
field-symbols: <fs_vbap> type vbap.
FIELD-SYMBOLS: <fs>.
select * from vbap
into table it_vbap
up to 2 rows.
assign wa to <fs_vbap>. " This you did or not..
LOOP AT it_vbap INTO wa_vbap.
ASSIGN COMPONENT 'NETPR' OF STRUCTURE <fs_vbap> TO <fs>.
IF sy-subrc = 0.
<fs> = wa_vbap-netpr.
write:/ <fs>.
ENDIF.
endloop.
2008 Sep 14 4:57 PM
Hi Vinay,
Thanks for the replay.
The table that I have built is the dynamic internal table.
I cannot do like that .
2008 Sep 14 5:02 PM
How exacty you defined can you show . you just showed only few lines.
2008 Sep 14 5:06 PM
Hi Vinay,
I had created a Dynamic internal Table Using class
cl_alv_table_create=>create_dynamic_table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_lvc_cat
IMPORTING
ep_table = w_dyntable.
ASSIGN w_dyntable->* TO <final>.
and I had Created a work are are using the feild symbol
CREATE DATA w_structure LIKE LINE OF <final>.
ASSIGN w_structure->* TO <wa_final>.
here in this table I have one feild called VALUE1.
Now
LOOP AT it_final1 INTO wa_final1.
ASSIGN COMPONENT 'VALUE1' OF STRUCTURE <wa_final2> TO <fs>.
if sy-subrc eq 0.
<fs> = wa_final1-wkgbtr.
endif.
endloop.
2008 Sep 14 5:22 PM
ASSIGN COMPONENT 'VALUE1' OF STRUCTURE <wa_final2> TO <fs>.
in the above line where you defined <wa_final2> and where you assigned.
if the field-symbol <wa_final2> is not assigned then you get the error.
2008 Sep 14 5:26 PM
Hi Vimal,
I had declared it .
CREATE DATA w_structure LIKE LINE OF <final>.
ASSIGN w_structure->* TO <wa_final2>.
2008 Sep 14 5:46 PM
I can guess why it is not working, it is because of fieldcatalog. if you don't populate the fieldcatalog properly then you will get that problem.
I guess you are doing it manually. when you are populating manually you have to consider the following
*FIELDNAME NETPR *
CFIELDNAME WAERK
DATATYPE CURR
REF_TABLE VBAP
*DD_OUTLEN *
DECIMALS
then only you can assign the value properly.
just check this..
REPORT ztest_dynamic.
DATA: t_fcat TYPE lvc_t_fcat,
itab type ref to data,
wa type ref to data.
data: it_vbap type vbap_t,
wa_vbap type vbap.
field-symbols: <final> type standard table,
<fs_wa> type any,
<fs> type any.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = 'VBAP'
CHANGING
ct_fieldcat = t_fcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fcat
IMPORTING
ep_table = itab.
ASSIGN itab->* TO <final>.
create data wa like line of <final>.
assign wa->* to <fs_wa>.
select * from vbap
into table it_vbap
up to 2 rows.
loop at it_vbap into wa_vbap.
assign component 'NETPR' of structure <fs_wa> to <fs>.
if sy-subrc eq 0.
<fs> = wa_vbap-netpr.
write:/ <fs>.
endif.
endloop.
2008 Sep 14 6:08 PM
Hi Vinay,
what is said is correct. Now the program is working fine.
Thanks for you rsolution.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |