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

Internal table problem

Former Member
0 Likes
393

Hi All,

I am getting all the material classification into to a itab using this FM VC_I_GET_CONFIGURATION

Now my problem is first i have to check for a paticular characteristic name(PPG GROUP) which has the given value (RR PLANNER). If it is there i have to again check for the tools and its values, now here goes a loop and a check stmt for PPG GROUP and again inside that i have to loop again, so to avoid this how do i write the logic.

Char name char value

FIRST_POSITION_TOOL.

PACK_IMPRINT_TOOL

INS_1_TOOL 12356

INS_2_TOOL 54568

INS_3_TOOL

PPG_GROUP RR PLANNER

INS_4_TOOL

INS_5_TOOL

INS_6_TOOL 456546

INS_7_TOOL

INS_8_TOOL

Sample code:

LOOP AT i_conf.

CASE i_conf-atbez.

WHEN 'PPG_PRODUCT_GROUP'.

IF i_conf-atwrt = 'RR_PLANNER'.

LOOP AT i_conf.

CASE i_conf-atbez.

WHEN 'FIRST_POSITION_TOOL'.

IF i_conf-atwrt <> ' ' AND i_conf-atwrt <> '?'.

MOVE i_conf-atwrt TO l_atwrt.

SELECT SINGLE mstae INTO lwa_mara FROM mara

WHERE matnr = l_atwrt.

if sy-subrc = 0.

if lwa_mara = 'TR'.

set = 'X'.

endif.

endif.

endif.

WHEN 'PACK_IMPRINT_TOOL'.

IF i_conf-atwrt <> ' ' AND i_conf-atwrt <> '?'.

MOVE i_conf-atwrt TO l_atwrt.

SELECT SINGLE mstae INTO lwa_mara FROM mara

WHERE matnr = l_atwrt.

if sy-subrc = 0.

if lwa_mara = 'TR'.

set = 'X'.

endif.

endif.

endif.

WHEN 'INS_1_TOOL'.

IF i_conf-atwrt <> ' ' AND i_conf-atwrt <> '?'.

MOVE i_conf-atwrt TO l_atwrt.

it goes on, Can anybody give me a performance way to write this or to avoid loop inside loop.

Regards,

Senthil

2 REPLIES 2
Read only

Former Member
0 Likes
362

Can you not just do a read?

read table i_conf with key atbez = 'PPG_PRODUCT_GROUP'

atwrt = 'RR_PLANNER'.

if sy-subrc = 0.

loop at i_conf.

. . .

endloop.

endif.

Read only

0 Likes
362

AJP,

I have more than one value for the PPG_PRODUCT_GROUP like CALENDERS, DESKPAD and so on, the first loop is for this sake.

Senthil