Skip to Content
0
Jul 23, 2019 at 12:40 PM

Field Symbol Has not yet been assigned

1435 Views

I am trying to use table from another report program as in the following:

REPORT  ZSAM3.

 TYPES: BEGIN OF ty_report,
          rec_acc TYPE skont,
          vendor TYPE LFA1-LIFNR,
          jan_deb TYPE BSEG-WRBTR,
          jan_cred TYPE BSEG-WRBTR,
          feb_deb TYPE BSEG-WRBTR,
          feb_cred TYPE BSEG-WRBTR,
          mar_deb TYPE BSEG-WRBTR,
          mar_cred TYPE BSEG-WRBTR,
          apr_deb TYPE BSEG-WRBTR,
          apr_cred TYPE BSEG-WRBTR,
          may_deb TYPE BSEG-WRBTR,
          may_cred TYPE BSEG-WRBTR,
          jun_deb TYPE BSEG-WRBTR,
          jun_cred TYPE BSEG-WRBTR,
          jul_deb TYPE BSEG-WRBTR,
          jul_cred TYPE BSEG-WRBTR,
          aug_deb TYPE BSEG-WRBTR,
          aug_cred TYPE BSEG-WRBTR,
          sep_deb TYPE BSEG-WRBTR,
          sep_cred TYPE BSEG-WRBTR,
          oct_deb TYPE BSEG-WRBTR,
          oct_cred TYPE BSEG-WRBTR,
          nov_deb TYPE BSEG-WRBTR,
          nov_cred TYPE BSEG-WRBTR,
          dec_deb TYPE BSEG-WRBTR,
          dec_cred TYPE BSEG-WRBTR,
          acc_bal_deb TYPE BSEG-WRBTR,
          acc_bal_cred TYPE BSEG-WRBTR,
        END OF ty_report,
        tt_report TYPE TABLE OF ty_report.

DATA:  lt_report TYPE tt_report,
       lv_ukurs type tcurr-ukurs,
       Tcurr1 type tcurr,
       fieldname(4) type c,
       fnamedebit(20) type c,
       fnamecredit(20) type c.

FIELD-SYMBOLS: <fs_rep> LIKE LINE OF lt_report.
 select single ukurs from tcurr
        into lv_ukurs
        where fcurr = 'EUR'
        and   tcurr = 'AUD'. "<- your  local currency

DATA lr_pay_data              TYPE REF TO data.

FIELD-SYMBOLS: <lt_pay_data>   TYPE ANY TABLE,
               <pos_data> type any.

  cl_salv_bs_runtime_info=>set(
    EXPORTING display  = abap_false
              metadata = abap_false
              structure = ''
              data     = abap_true ).

SUBMIT RFKSLD00 via SELECTION-SCREEN and return.
TRY.
    ASSIGN lr_pay_data->* TO <lt_pay_data>.
>>> cl_salv_bs_runtime_info=>get_data(
      IMPORTING t_data = <lt_pay_data> ).
  CATCH cx_salv_bs_sc_runtime_info.
    MESSAGE `Unable to retrieve ALV data` TYPE 'E'.
ENDTRY.

LOOP AT <lt_pay_data> ASSIGNING <pos_data>.

 APPEND INITIAL LINE to lt_report ASSIGNING <fs_rep>.
 MOVE-CORRESPONDING <pos_data> TO <fs_rep>.

WRITE: / <pos_data>.

ENDLOOP.

Write: 'Program End!'.

I am getting the following runtime error:

you attenpted to access an anassigned field symbol (data segment 12)

Maybe (as suggested by arrows in the code) that <'lt_pay_data'> has not been initialized or assigned but I do not know how assign any table type variable.