Skip to Content
avatar image
Former Member

Intenal table logic

Hi Friends,

I need a logic for the below mentioned thing,

for all entries in i_tab i need to check makt table with makt-matnr = i_tab-matnr.

if subrc = 0.

  • need to determine eknam

Join tables marc and t024 . fill the i_tab-eknam field with the value T024-eknam where MARC-MATNR = I_TAB-MATNR and MARC-WERKS = '0001' and MARC-EKGRP = TO24-EKGRP

endif.

Thanks in advance

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • avatar image
    Former Member
    Apr 24, 2006 at 10:27 AM

    Hi,

    Use <b>inner joins</b>..It nay work out.

    Regards,

    Srikanth.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 24, 2006 at 10:28 AM

    Hi,

    select count(*)

    from makt

    for all entries in i_tab

    where matnr = i_tab-matnr.

    loop at i_tab.

    select aeknam into i_tab-eknam from T024 as a inner join MARC as b where bmatnr = I_TAB-MATNR and bWERKS = '0001' and b-EKGRP = aEKGRP.

    endloop.

    However there is a performance issue of using select inside loop.

    Regards,

    Tanveer.

    Please mark helpful answers

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 24, 2006 at 10:35 AM

    if noti_tab[] is initial.

    select *

    from makt

    into i_makt

    for all entries in i_tab

    where matnr = i_tab-matnr.

    endif.

    select *

    from marc

    into i_marc

    for all entries in i_makt

    where matnr = i_makt-matnr

    and werks = '0001'.

    select *

    from t024

    into i_t024.

    loop at i_tab.

    lv_tabix = sy-tabix.

    read table i_marc with key matnr = i_tab-matnr.

    if sy-subrc.

    read table i_t024 with key ekgrp = i_marc-ekgrp.

    if sy-subrc = 0.

    i_tab-eknam = i_t024-eknam.

    modify i_tab index lv_index.

    endif.

    endif.

    endif.

    endloop.

    Regards,

    Ravi

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 24, 2006 at 10:37 AM

    data: records type i.

    records = lines( i_tab ).

    Check records GT 0.

    Select matnr from makt into i_makt for all entries in i_tab where matnr = i_tab-matnr.

    Check sy-subrc EQ 0.

    Select amatnr beknam into i_t024

    from marc as A inner join t024 as B ON aekgrp = bekgrp

    for all entries in i_makt

    where a~matnr = i_makt-matnr

    and a~werks = 0001.

    Check sy-subrc EQ 0.

    field-symbols: <fs_tab> type any.

    Loop at i_tab assigninig <fs_tab>.

    Read table i_t024 with key matnr = <fs_tab>-matnr binary search.

    if sy-subrc eq 0.

    <fs-tab>-eknam = i_t024-eknam.

    endif.

    Endloop.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 24, 2006 at 10:42 AM

    Hi,

    select count(*)

    from makt

    for all entries in i_tab

    where matnr = i_tab-matnr.

    loop at i_tab.

    select aeknam into i_tab-eknam from T024 as a inner join MARC as b where bmatnr = I_TAB-MATNR and bWERKS = '0001' and b-EKGRP = aEKGRP.

    endloop.

    However there is a performance issue of using select inside loop.

    Regards,

    Tanveer.

    Duplicate relpy added.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 24, 2006 at 10:43 AM

    select *

    from makt

    into table i_makt

    for all entries in i_tab

    where i_tab-matnr = makt-matnr.

    if sy-subrc = 0.

    select matnr werks

    into table i_marc

    from marc

    for all entries in i_tab

    where matnr = i_tab-matnr

    and werks = '0001'.

    select *

    from t024

    for all entries in i_marc

    where ekgrp = i_marc-ekgrp.

    endif.

    here, while selecting the entries from marc, you can get the relevant fields. Similarly you can get the relevant fields from T024.

    Later you'll have to Loop on i_t024 table and in the loop read the corresponding entry from i_marc table and use the field values and append to a custom structure containing the relevant fields.

    Let me know in case of any clarifications and do acknowledge the solution.

    Regards,

    Ameya

    Add comment
    10|10000 characters needed characters exceeded