Application Development 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: 

Iam struc with logic on ---ON CHANGE Of

Former Member
0 Kudos

Dear freinds

i have the scenario as follows

JobNo. OrgId ORG DESC

101 1001 SMT1

102 1002 ENF

101 1003 SMT2

They have told me while displaying ORG DESC as the first two characters only

so i have to consider instead of SMT1 i have to take SM only.

Now the requirement is if i have the first two letters as SM (for ex ) of the above

example i have to consider only once the job No. and display against it in output

as 2

so my output should come as ( i have to take only orgdesc instead of orgid in output)

job no orgdesc count

101 SM 2

102 EN 1

iam using the code as below ...but iam not able to increment the count can

please correct my code below

loop at fp_i_temp_job_org into l_wa_temp_job_org.

ON CHANGE Of l_wa_temp_job_org-orgabv .

v_index = v_index + 1.

l_wa_temp_new-jobid = l_wa_temp_job_org-jobid.

l_wa_temp_new-orgid = l_wa_temp_job_org-orgid.

l_wa_temp_new-orgabv = l_wa_temp_job_org-orgabv. (orgabv is short text

for orgdesc)

l_wa_temp_pos_new-Actualt = v_index. -


i want to give count

append l_wa_temp_new to l_i_temp_final.

ENDON.

endloop.

The l_i_temp_final is my final internal table which iam going to display on the screen

which has the fields a) jobNo b) orgid c) orgabv d) Acutal

The Actual is not thing but the count whether the orgabv is 1 or 2 or 3 ....on the screen.

however i will not display orgid as iam displaying orgabv(orgdesc).

so could you please let me know how can i achieve increment in the count field (Actual)

and display on the screen.

Kinda Regards

latha.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi..

add the <b>BOLD</b> marked changes..

<b>data:

w_index type i.</b>

loop at fp_i_temp_job_org into l_wa_temp_job_org.

<b>add 1 to w_index.</b>

ON CHANGE Of l_wa_temp_job_org-orgabv .

l_wa_temp_new-jobid = l_wa_temp_job_org-jobid.

l_wa_temp_new-orgid = l_wa_temp_job_org-orgid.

l_wa_temp_new-orgabv = l_wa_temp_job_org-orgabv. (orgabv is short text

for orgdesc)

l_wa_temp_pos_new-Actualt = <b>w_index</b>. -


i want to give count

append l_wa_temp_new to l_i_temp_final.

<b>w_index = 0.</b>

ENDON.

endloop.

7 REPLIES 7

Former Member
0 Kudos

Hi..

add the <b>BOLD</b> marked changes..

<b>data:

w_index type i.</b>

loop at fp_i_temp_job_org into l_wa_temp_job_org.

<b>add 1 to w_index.</b>

ON CHANGE Of l_wa_temp_job_org-orgabv .

l_wa_temp_new-jobid = l_wa_temp_job_org-jobid.

l_wa_temp_new-orgid = l_wa_temp_job_org-orgid.

l_wa_temp_new-orgabv = l_wa_temp_job_org-orgabv. (orgabv is short text

for orgdesc)

l_wa_temp_pos_new-Actualt = <b>w_index</b>. -


i want to give count

append l_wa_temp_new to l_i_temp_final.

<b>w_index = 0.</b>

ENDON.

endloop.

0 Kudos

I guess you'll have to sort first....

0 Kudos

Dear Ram mohan

Thank you for answering to my question , but iam not getting the output which i requested from the code i have used modified code of yours still iam not getting the desired , iam giving again my output , please help me.

data: w_index type i.

data which iam having in the internal table fp_i_temp_job_org has is as follows

JobNo. OrgId ORG DESC

101 1001 SMT1

102 1002 ENF

101 1003 SMT2

now when we are looping i should get two records with count for 101 as 2 and

for 102 as one , but it is coming as two records

101 SM 1 and -


> ishould get as 2.

102 EN 1

i have used the below changed logic only

loop at fp_i_temp_job_org into l_wa_temp_job_org.

add 1 to w_index.

ON CHANGE Of l_wa_temp_job_org-orgabv .

l_wa_temp_new-jobid = l_wa_temp_job_org-jobid.

l_wa_temp_new-orgid = l_wa_temp_job_org-orgid.

l_wa_temp_new-orgabv = l_wa_temp_job_org-orgabv. (orgabv is short text

for orgdesc)

l_wa_temp_pos_new-Actualt = w_index. -


i want to give count increment

append l_wa_temp_new to l_i_temp_final.

w_index = 0.

ENDON.

endloop.

the output iam getting is as follows

jobno job desc actual

101 SM 1

102 EN 1

but i want is

jobno job desc actual

101 SM 2

102 EN 1

Regards

latha

0 Kudos

Dear Ramohan

Please give me idea , i have to complete the object today ... please little urgent , give me idea .

regards

latha

0 Kudos

Dear Bas Jansen

i have tried by sorting the internal table , it hasnt make difference and iam getting the output .could you pls give any idea.

regards

latha

0 Kudos

Dear Rammohan

please can you let me know , i couldnt get and i have deliver theobject .

please can you help me out.

regards

latha.

0 Kudos

Try using this !


data:
w_index type i.

loop at fp_i_temp_job_org into l_wa_temp_job_org.
wa_temp_job_org_2 = l_wa_temp_job_org.
add 1 to w_index.
Delete
AT NEW fp_i_temp_job_org-orgabv .
l_wa_temp_new-jobid = wa_temp_job_org_2-jobid.
l_wa_temp_new-orgid = wa_temp_job_org_2-orgid. 
l_wa_temp_new-orgabv = wa_temp_job_org_2-orgabv. (orgabv is short text 
for orgdesc)
l_wa_temp_new-Actualt = w_index. ------------i want to give count 
append l_wa_temp_new to l_i_temp_final.
w_index = 0.
ENDAT.
endloop. 

I guess this will work

Regards

Nishant