2013 May 13 7:40 AM
hi frnds
we need to develop a report on PO release time lines.
Internal table: t_cdpos(OBJECTID FNAME CHANGENR VALUE_NEW VALUE_OLD).
After select stmt, get these values.
| Row | OBJECTID | FNAME | CHANGENR | VALUE_NEW | VALUE_OLD |
| 1 | 1000003 | FRGZU | 637324 | XX | X |
| 2 | 1000003 | FRGZU | 637323 | X | |
| 3 | 1000003 | FRGZU | 637322 | XX | |
| 4 | 1000003 | FRGZU | 637302 | XX | X |
| 5 | 1000003 | FRGZU | 637301 | X | |
| 6 | 1000003 | FRGZU | 637300 | XX | |
| 7 | 1000003 | FRGZU | 637299 | XX | X |
| 8 | 1000003 | FRGZU | 637298 | X | XX |
| 9 | 1000003 | FRGZU | 637224 | XX | |
| 10 | 1000004 | FRGZU | 637223 | X | |
| 11 | 1000004 | FRGZU | 637225 | X | |
| 12 | 1000004 | FRGZU | 637226 | X | |
| 13 | 1000004 | FRGZU | 637227 | XX | X |
| 14 | 1000007 | FRGZU | 637236 | X | |
| 15 | 1000007 | FRGZU | 637237 | XX | X |
| 16 | 1000007 | FRGZU | 637238 | XXX | XX |
| 17 | 1000007 | FRGZU | 637239 | XX | XXX |
| 18 | 1000007 | FRGZU | 637240 | XXX | XX |
| 19 | 1000007 | FRGZU | 637241 | XXXX | XXX |
The no. of ‘X’ denotes the release against the levels of approvers found earlier. From this, the highest change doc num against each value of ‘X’, ‘XX’, ‘XXX’
i want to only for this below values.
| Row | OBJECTID | FNAME | CHANGENR | VALUE_NEW | VALUE_OLD |
| 1 | 1000003 | FRGZU | 637324 | XX | X |
| 2 | 1000003 | FRGZU | 637323 | X | |
| 12 | 1000004 | FRGZU | 637226 | X | |
| 13 | 1000004 | FRGZU | 637227 | XX | X |
| 14 | 1000007 | FRGZU | 637236 | X | |
| 15 | 1000007 | FRGZU | 637237 | XX | X |
| 18 | 1000007 | FRGZU | 637240 | XXX | XX |
| 19 | 1000007 | FRGZU | 637241 | XXXX | XXX |
frnds how i can get the our requirement. any one plz help me that.
2013 May 13 8:12 AM
hi frnds
we need to develop a report on PO release time lines.
Internal table: t_cdpos(OBJECTID FNAME CHANGENR VALUE_NEW VALUE_OLD).
After select stmt, get these values.
| Row | OBJECTID | FNAME | CHANGENR | VALUE_NEW | VALUE_OLD |
| 1 | 1000003 | FRGZU | 637324 | XX | X |
| 2 | 1000003 | FRGZU | 637323 | X | |
| 3 | 1000003 | FRGZU | 637322 | XX | |
| 4 | 1000003 | FRGZU | 637302 | XX | X |
| 5 | 1000003 | FRGZU | 637301 | X | |
| 6 | 1000003 | FRGZU | 637300 | XX | |
| 7 | 1000003 | FRGZU | 637299 | XX | X |
| 8 | 1000003 | FRGZU | 637298 | X | XX |
| 9 | 1000003 | FRGZU | 637224 | XX | |
| 10 | 1000004 | FRGZU | 637223 | X | |
| 11 | 1000004 | FRGZU | 637225 | X | |
| 12 | 1000004 | FRGZU | 637226 | X | |
| 13 | 1000004 | FRGZU | 637227 | XX | X |
| 14 | 1000007 | FRGZU | 637236 | X | |
| 15 | 1000007 | FRGZU | 637237 | XX | X |
| 16 | 1000007 | FRGZU | 637238 | XXX | XX |
| 17 | 1000007 | FRGZU | 637239 | XX | XXX |
| 18 | 1000007 | FRGZU | 637240 | XXX | XX |
| 19 | 1000007 | FRGZU | 637241 | XXXX | XXX |
The no. of ‘X’ denotes the release against the levels of approvers found earlier. From this, the highest change doc num against each value of ‘X’, ‘XX’, ‘XXX’
i want to only for this below values.
| Row | OBJECTID | FNAME | CHANGENR | VALUE_NEW | VALUE_OLD |
| 1 | 1000003 | FRGZU | 637324 | XX | X |
| 2 | 1000003 | FRGZU | 637323 | X | |
| 12 | 1000004 | FRGZU | 637226 | X | |
| 13 | 1000004 | FRGZU | 637227 | XX | X |
| 14 | 1000007 | FRGZU | 637236 | X | |
| 15 | 1000007 | FRGZU | 637237 | XX | X |
| 18 | 1000007 | FRGZU | 637240 | XXX | XX |
| 19 | 1000007 | FRGZU | 637241 | XXXX | XXX |
frnds how i can get the our requirement. any one plz help me that.
2013 May 13 8:12 AM
2013 May 13 10:18 AM
Just to be sure, does this give the correct output?
For eg for objID 1000007, this logic would give both 637238 and 637240 as for both, new value is greater than old value. But the requirement is to get only the higher change number 637240 right?
2013 May 13 10:30 AM
I agree with Susmitha Thomas, my answer was only a hint to remove "rollback" records, a SORT BY OBJECTID VALUE_NEW CHANGENR DESCENDING followed by a DELETE ADJACENT DUPLICATES is required to remove duplicates keeping only last value change.
Regards,
Raymond
2013 May 13 11:04 AM
2013 May 13 1:21 PM
yes,
example:
objID = 1000007
if new_value = 'X" and old_value = ' '.
suppose get multiple values, will be taken higher change value and delete low change value in table.
elseif new_value = 'XX" and old_value = 'X'.
get multiple values, will be taken highest change value and delete low change value in table.
elseif new value = 'XXX' and old_value = "XX'.
get multiple values, will be taken highest change value and delete low change value in table.
.
.
.
Same procedure as follow for all object ids.
objectid = 1000003.
same as above procedure.
2013 May 13 1:48 PM
2013 May 13 8:20 AM
Hi Kumar,
Please check the output set that you require, all you need to do is loop at the internal table and check if the VALUE_NEW GT VALUE_OLD. If this condition satisfy, append this record in final internal table.
Revert if you need more details.
Regards,
DN.
2013 May 13 8:30 AM
Hi Kumar,
Please try the below code for your requirement.
" loop for your internal table
loop at t_cdpos into wa_cdpos.
length_new = strlen( wa_cdpos-value_new ).
length_old = strlen( wa_cdpos-value_old ).
if length_new le lenght_old.
delete t_cdpos index sy-tabix.
endif.
endloop.
Thanks
Vivek
2013 May 13 8:30 AM
2013 May 13 8:40 AM
The requirement you specified is not clear can you tell if you are displaying record no 2 then why 5 and 10 is not considered . I hope you can count the length and do like this.
Delete itab where deduct is LE 0.
regards,
Rahul
2013 May 13 9:17 AM
This code will do your work.
Declare another internal table with same structure of t_cdpos,
let it be t_cdpos_fin.
data : wa_cdpos like line of t_cdpos,
wa_cdpos1 like line of t_cdpos
* Current Results
loop at t_cdpos into wa_cdpos.
write : / wa_cdpos.
endloop.
sort t_cdpos by objectid ASCENDING value DESCENDING changenr descending.
loop at t_cdpos into wa_cdpos.
if wa_cdpos1-value NE wa_cdpos-value and wa_cdpos-value NE ' '.
APPEND wa_cdpos to t_cdpos_fin.
endif.
wa_cdpos1 = wa_cdpos.
ENDLOOP.
* Here by value I mean value_new, as i understand, only that is considered.
* Required Results
skip 3.
loop at t_cdpos_fin into wa_cdpos1.
write : /wa_cdpos1.
endloop.
Cheers,
Susmitha
2013 May 13 10:35 AM
Moderator message: Please use proper subject line in future. This is a kind of "do my job" post, please be sure that you mention your effort in your next question.
I recommend to read the useful Blog "Asking Good Questions in the SCN Discussion Spaces will helpyou get Good Answers" to learn the principles of asking questions.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |