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

Problem with Append

Former Member
0 Likes
696

hi,

Here SP$00011 & SP$00008 are selection screen fields.

l1_dat & l2_dat are Radio buttons.I have to check entered plants with zplants table.

Here two cases,if sy-subrc = 0.

1.if l1_dat = 'X'.I have to add zplants-vplant field to r_plant field.

2.if l2_dat = 'X'.I have to add zplants-vplant field to SP$00011 field.

my problem is when i select l1_dat. r_plant field containing only one

value,i.e zplants-vplant value.Actually r_plant field should be with

two values after appending.how can i write the statement?

Ranges: r_plant for zplants-werks.

FORM CHECK_KUNAG.

loop at SP$00008.

check SP$00008-low+0(1) = 'P'.

r_plant = SP$00008-low+1. "(removes the first P).

endloop.

select * from zplants

where werks = r_plant and

reswk in SP$00011.

if sy-subrc = 0.

if l2_dat = 'X'.

SP$00011-sign = 'I'.

SP$00011-option = 'EQ'.

SP$00011-low = zplants-vplant.

append SP$00011.

<b> elseif l1_dat = 'X'.

r_plant-sign = 'I'.

r_plant-option = 'EQ'.

r_plant-low = zplants-vplant.

append zplants-vplant to r_plant.</b>

endif.

endif.

endselect.

  • Do I need the following statements......what is this means????????

if SP$00008[] is initial.

clear SP$00008.

SP$00008-sign = 'I'.

SP$00008-option = 'EQ'.

SP$00008-low = zplants-vplant.

append SP$00008 to r_plant

endif.

endform.

Thanks in advance,

fractal.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
673

loop at SP$00008.

check SP$00008-low+0(1) = 'P'.

r_plant-sign = 'I'.

r_plant-option = 'EQ'

r_plant-low = SP$00008-low+1. "(removes the first P).

APPEND r_PLANT

endloop.

4 REPLIES 4
Read only

Former Member
0 Likes
673

Replace the following

elseif l1_dat = 'X'.

r_plant-sign = 'I'.

r_plant-option = 'EQ'.

r_plant-low = zplants-vplant.

append zplants-vplant to r_plant.

to

elseif l1_dat = 'X'.

r_plant-sign = 'I'.

r_plant-option = 'EQ'.

r_plant-low = zplants-vplant.

append r_plant.

Cheers

Read only

0 Likes
673

Ranges: r_plant for zplants-werks.

FORM CHECK_KUNAG.

loop at SP$00008.

check SP$00008-low+0(1) = 'P'.

<b>r_plant</b> = SP$00008-low+1. "(removes the first P).

endloop.

Problem now is r_plant has only P235,P476...like that...

Actually I want r_plant field values should be IEQP235, IEQP476.where should i write the following statements.

r_plant-sign = 'I'.

r_plant-option = 'EQ'.

thanks.

Read only

Former Member
0 Likes
673

Also define a new varaibale w_plant to replace R_Plant

in following statements -

loop at SP$00008.

check SP$00008-low+0(1) = 'P'.

<b>r_plant</b> = SP$00008-low+1. "(removes the first P).

endloop.

select * from zplants

where werks = <b>r_plant</b> and

reswk in SP$00011.

Read only

Former Member
0 Likes
674

loop at SP$00008.

check SP$00008-low+0(1) = 'P'.

r_plant-sign = 'I'.

r_plant-option = 'EQ'

r_plant-low = SP$00008-low+1. "(removes the first P).

APPEND r_PLANT

endloop.