Skip to Content
avatar image
Former Member

Feild Symbol Currency Feild Issue

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 14, 2008 at 04:26 PM

    Hi Vimal,

    I had declared it .

    CREATE DATA w_structure LIKE LINE OF <final>.

    ASSIGN w_structure->* TO <wa_final2>.

    Add comment
    10|10000 characters needed characters exceeded

    • 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.

  • Sep 14, 2008 at 03: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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 14, 2008 at 03:57 PM

    Hi Vinay,

    Thanks for the replay.

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

    I cannot do like that .

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 14, 2008 at 04: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.

    Add comment
    10|10000 characters needed characters exceeded

    • 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.

  • avatar image
    Former Member
    Sep 14, 2008 at 05:08 PM

    Hi Vinay,

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

    Thanks for you rsolution.

    Add comment
    10|10000 characters needed characters exceeded