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

Feild Symbol Currency Feild Issue

Former Member
0 Likes
1,387

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???????

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,336

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???????

8 REPLIES 8
Read only

Former Member
0 Likes
1,336

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.

Read only

Former Member
0 Likes
1,336

Hi Vinay,

Thanks for the replay.

The table that I have built is the dynamic internal table.

I cannot do like that .

Read only

0 Likes
1,336

How exacty you defined can you show . you just showed only few lines.

Read only

Former Member
0 Likes
1,336

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.

Read only

0 Likes
1,336

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.

Read only

Former Member
0 Likes
1,337

Hi Vimal,

I had declared it .

CREATE DATA w_structure LIKE LINE OF <final>.

ASSIGN w_structure->* TO <wa_final2>.

Read only

0 Likes
1,336

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.

Read only

Former Member
0 Likes
1,336

Hi Vinay,

what is said is correct. Now the program is working fine.

Thanks for you rsolution.