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

Dynamic assignment problems!

Former Member
0 Likes
402

Hi gurus!

I´m having some problems with dynamic assignments. The problem is as follows: in my program I have some Parameters and some Select-Options. In some cases, I have to change the value of this variables in a dynamic way. When I run the program, the value that I read from the table and I assign it to the variable is not changed (for example I want to change the value from P_BUKRS).

I include the source code. Any ideas?

Header Line contains the following record:

t_zfii018-var_name = P_BUKRS

t_zfii018-ruta = 3245


*&---------------------------------------------------------------------*
*& Report  Z_TEMPORAL_EW                                               *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  z_temporal_ew                           .



PARAMETERS: p_bukrs LIKE t001-bukrs,
            p_belnr LIKE bkpf-belnr,
            p_budat LIKE bkpf-budat,
            p_xblnr LIKE bkpf-xblnr.
SELECT-OPTIONS:
            s_datum    FOR  sy-datum.

START-OF-SELECTION.

  PERFORM f_change_file_parameters.

*&---------------------------------------------------------------------*
*&      Form  f_check_paramers
*&---------------------------------------------------------------------*
*       Este perform cambia la ruta de los archivos, por la ruta
*       que es leida en la tabla Z.
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_change_file_parameters.

  FIELD-SYMBOLS: <fs_table>.
  DATA: p_it TYPE string,
        t_zfii018 LIKE zfii018 OCCURS 0 WITH HEADER LINE.

* Leo la tabla de customizing con los valores que hay que modificar.
  SELECT *
    INTO TABLE t_zfii018
    FROM zfii018
    WHERE programa = sy-cprog.

* Leo cada registro y lo modifico.
  LOOP AT t_zfii018.
    p_it = t_zfii018-var_name.
    ASSIGN (p_it) TO <fs_table>.
    IF sy-subrc = 0.
      ASSIGN t_zfii018-ruta TO <fs_table>.
    ENDIF.
  ENDLOOP.

write p_bukrs.

ENDFORM.                    " f_check_paramers

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
372

Hi Esteban.

Maybe it is connect to two things i discovered:

1: You should put the field in the second assign statement into brackets.

ASSIGN (t_zfii018-ruta) TO <fs_table>.

Then <fs_table> points to P_BUKRS.

2: You never move a new value to P_BUKRS or <fs_table>.

Regards,

Timo.

1 REPLY 1
Read only

Former Member
0 Likes
373

Hi Esteban.

Maybe it is connect to two things i discovered:

1: You should put the field in the second assign statement into brackets.

ASSIGN (t_zfii018-ruta) TO <fs_table>.

Then <fs_table> points to P_BUKRS.

2: You never move a new value to P_BUKRS or <fs_table>.

Regards,

Timo.