2011 Jul 07 12:29 PM
Hi All,
I need a little help if possible, I have searched for the solution but no luck, what I have found out though is I probably need to use field symbols...
Basically I need to use a string as a column name to access an internal table.
I think maybe an example would be good.
DATA: lw_field(30) TYPE c,
lw_cname(30) TYPE c,
lw_tab_ref(60) TYPE c,
lwa_cust_x LIKE LINE OF i_cust_x.
FIELD-SYMBOLS: <fs> LIKE LINE OF i_cust_x.
IF w_exit_exec IS INITIAL.
" No missing madatory so far
LOOP AT i_cust_x INTO lwa_cust_x.
IF lwa_cust_x-ekorg = space.
" Check for blank Purch Ord
IF lwa_cust_x-zesokz = fuwa_data-zesokz.
IF lwa_cust_x-xman = 'X'.
" Mandatory import item
lw_cname = lwa_cust_x-field.
TRANSLATE lw_cname TO LOWER CASE.
CONCATENATE 'fuwa_data-' lw_cname INTO lw_tab_ref.
ASSIGN lw_tab_ref TO <fs>.
IF <fs> = space.
lw_field = lwa_cust_x-field.
w_exit_exec = 'X'. "DON'T PERFORM UPDATE
MESSAGE i045 WITH lw_field INTO fcw_message.
EXIT.
ENDIF.
ENDIF. " Mandatory import item
ENDIF.
ENDIF. " Check for blank Purch Ord
ENDLOOP.
ENDIF. " No missing madatory so far
I was hoping that after the assignment <fs> would be a reference to the fuwa_data with the column of what has been from lwa_cist_x_field....
but it seems that <fs> is a reference to a string in fact lw_tab_ref
so lets say that
lwa_cust_x-field = 'EKORG'
lw_cname='ekorg' after the translate
fuwa_data has a column called ekorg
<fs> = fuwa_data-ekorg (but is a sting)
I would like to say something like...
IF <fs> = 1000 THEN " as in accessing the column in fuwa_data and not a string...
......
I hope I have explained this ok, but I am having trouble finding the best example.
Cheers
Ian
2011 Jul 07 12:34 PM
Hi,
please use brackets for the assign command.
ASSIGN (lw_tab_ref) TO <fs>.
Kind Regards,
Dirk
Hi,
please use brackets for the assign command.
ASSIGN (lw_tab_ref) TO <fs>.
Kind Regards,
Dirk
2011 Jul 07 12:34 PM
Hi,
please use brackets for the assign command.
ASSIGN (lw_tab_ref) TO <fs>.
Kind Regards,
Dirk
2011 Jul 07 1:19 PM
Hi,
I think what you need is
ASSIGN COMPONENT lw_cname OF STRUCTURE fuwa_data TO <fs>.Best regards,
Oliver
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |