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

mapping of fields? Dynamic select?

Former Member
0 Likes
883

Hi ALL

i am selecting fixed cost(EL_HF) from table TCKH3 and cost fields from table KEPH (fields are KST001,KST002..........KST040)

i want if EL_HF = 0 then KST000 field should consider

if EL_HF = 1 then KST001.................EL_HF = 40 then KST040.

Can any one tell me how can i achive the same?

Regards,

Oorvi

Hi ALL

i am selecting fixed cost(EL_HF) from table TCKH3 and cost fields from table KEPH (fields are KST001,KST002..........KST040)

i want if EL_HF = 0 then KST000 field should consider

if EL_HF = 1 then KST001.................EL_HF = 40 then KST040.

Can any one tell me how can i achive the same?

Regards,

Oorvi

2 REPLIES 2
Read only

Former Member
0 Likes
692
DATA: v_field   TYPE name_feld,
      v_numb(3) TYPE n.

DATA: v_cost TYPE kstel.

v_numb = tckh3-el_hf.
CONCATENATE 'KST'
            v_numb
       INTO v_field.
CONDENSE v_field NO-GAPS.

SELECT (v_field) INTO v_cost
                 FROM keph 
                WHERE........
Read only

Former Member
0 Likes
692

Hi,

Below code using field symbols should give you an idea.


data: v_el_hf_c(3) type c,
      v_elhf(6) type c.

FIELD-SYMBOLS : <fs_kstval>.
v_el_hf_c = TCKH3-el_hf.
overlay v_el_hf_c with '000'.
concatenate 'KST' v_el_hf_c into v_elhf.
loop at i_keph.
ASSIGN COMPONENT v_elhf of structure I_KEPH to <fs_kstval>.
if sy-subrc = 0.
 "<fs_kstval> has the value
endif.
endloop.

Cheers,

Vikram