2005 Feb 11 7:07 AM
Hi Experts,
I want to pick up some 7 fields from different tables with one input criteria in a sap script. I tried using the subroutines for this. But the problem i am facing is that it is just returning one value. I want 7 fields.
The code is used
Perform xyz in program aaa using one
chaning two
chaning three
chaning four
chaning five.
endperform.
Same goes for the report.
form xyz tables in_par structure itcsy
out_par structure itcsy.
Read table in_par with key 'one'.
(select statements....
these values are stored in internal table.. or variables.)
move ITAB-one to out_par-value.
move ITAB-two to out_par-value.
move ITAB-three to out_par-value.
move ITAB-four to out_par-value.
move ITAB-five to out_par-value.
modify out_par index sy-tabix.
endform.
but here it is overwritting the value everytime and just the last thats itab-five is returned.
Any inputs to resolve this issue. If for such a requirment subroutine willnot work, then pls suggest some other solution for this.
Thanks.
NC
2005 Feb 11 8:21 AM
Hi NC,
if you call like this:
perform xyz in program aaa
using &one&
changing &two&
changing &three&
changing &four&
changing &five&
then you should develop the following code in subroutine pool "aaa":
form xyz tables in_par structure itcsy
tables out_par structure itcsy.
read table in_par with key 'ONE'.
check sy-subrc = 0.
* (select whatever you want)...
read table out_par with key 'TWO'.
check sy-subrc = 0.
out_par-value = '...'.
modify out_par index sy-tabix.
read table out_par with key 'THREE'.
check sy-subrc = 0.
out_par-value = '...'.
modify out_par index sy-tabix.
read table out_par with key 'FOUR'.
check sy-subrc = 0.
out_par-value = '...'.
modify out_par index sy-tabix.
read table out_par with key 'FIVE'.
check sy-subrc = 0.
out_par-value = '...'.
modify out_par index sy-tabix.
endform.
That is, you should read every output parameter from itab out_par, and then modify column "value" by this "modify...index sy-tabix".
Please let us know if it helped. Best regards,
Alvaro
Hi Experts,
I want to pick up some 7 fields from different tables with one input criteria in a sap script. I tried using the subroutines for this. But the problem i am facing is that it is just returning one value. I want 7 fields.
The code is used
Perform xyz in program aaa using one
chaning two
chaning three
chaning four
chaning five.
endperform.
Same goes for the report.
form xyz tables in_par structure itcsy
out_par structure itcsy.
Read table in_par with key 'one'.
(select statements....
these values are stored in internal table.. or variables.)
move ITAB-one to out_par-value.
move ITAB-two to out_par-value.
move ITAB-three to out_par-value.
move ITAB-four to out_par-value.
move ITAB-five to out_par-value.
modify out_par index sy-tabix.
endform.
but here it is overwritting the value everytime and just the last thats itab-five is returned.
Any inputs to resolve this issue. If for such a requirment subroutine willnot work, then pls suggest some other solution for this.
Thanks.
NC
2005 Feb 11 8:21 AM
Hi NC,
if you call like this:
perform xyz in program aaa
using &one&
changing &two&
changing &three&
changing &four&
changing &five&
then you should develop the following code in subroutine pool "aaa":
form xyz tables in_par structure itcsy
tables out_par structure itcsy.
read table in_par with key 'ONE'.
check sy-subrc = 0.
* (select whatever you want)...
read table out_par with key 'TWO'.
check sy-subrc = 0.
out_par-value = '...'.
modify out_par index sy-tabix.
read table out_par with key 'THREE'.
check sy-subrc = 0.
out_par-value = '...'.
modify out_par index sy-tabix.
read table out_par with key 'FOUR'.
check sy-subrc = 0.
out_par-value = '...'.
modify out_par index sy-tabix.
read table out_par with key 'FIVE'.
check sy-subrc = 0.
out_par-value = '...'.
modify out_par index sy-tabix.
endform.
That is, you should read every output parameter from itab out_par, and then modify column "value" by this "modify...index sy-tabix".
Please let us know if it helped. Best regards,
Alvaro
2005 Feb 11 1:35 PM
Hi Alvaro,
This is exactly what i required. Thanks for your prompt reply. It solved my problem.
Thanks,
NC
2005 Mar 18 10:52 AM
Hi alvaro,
Can u please explain how do i exactly declare this in my custom form , like where exactly i have to declare and how to i declare the subroutine pool.
my customform is ZMEDRUCK and my program is medruck.
i want to insert and extra field like ekko-unsez.
could explain me if possible in a step by step procedure.
Thanks in advance.
Regards,
Roberts.K
2005 Mar 18 5:58 PM
Hi alvaro,
in the program you have given select statments , so like if my select statment is like this
select ebeln ekorg from ekko where bukrs = p_bukrs.
where do i have to declare parametetrs : p_bukrs like ekko-bukrs.
and in the statement out-par = 'itab-ebeln', is this return the numeric value on the form.
let me know please.
thanks in advance,
regards,
Roberts.K