‎2013 Oct 22 2:18 PM
Hi all,
i have a smartform (created by previous abaper), it is used for purchase requisition.
The problem is that it was used for only single PR. Because there is a problem in it.
The smartform consists of a secondary window in which Address are get printed by passing
ADRNR, now if i wants to use it for multiple PR No, this address window gets printed at every page,
so the problem is that if any PR have many line items spread into say 3 pages, then this window
overlaps the line item in second and third page line items, so my requirement is that "when ever the line
items corresponds to a PR will ends,then only this address window should print its value. I have changed
conditions accordingly, but not getting desired result".
Attach is the screenshot of my smartform, in which i have used window2 to fetch address, and it is to be
printed inside template2.
Please sujjest me what can i do next.
‎2013 Oct 22 2:50 PM
Dear sanjeev,
Dcleare two global variable .
v_lines type i.
v_chk type char1 default 'N'.
and put a program lines before the line item .
clear: v_lines
describe it_items lines v.
give this variable in the output of program lines.
at the end of the put another program lines.
in the input parameters give both the variables v_lines and v_chk of the program lines.
and in the output parameters give v_chk.
if sy-subc eq v_lines.
v_chk = 'Y'.
endif.
now in the address condition just put v_chk = 'Y'.
and at the end of address put another program lines
and in the input parameters
v_chk.
in the code.
v_chk = 'N'.
this might be helpful.
‎2013 Oct 22 2:23 PM
Hi Sanjeev,
For address window set condition 'Only after end of main window'. So that it will print only when all data is printed from main window.
Regards,
Koustubh
‎2013 Oct 22 2:31 PM
Hi Koustubh,
thanks for your reply, but its not so easy, i have tried at my best,if i put conditions according to you then it prints for only last value of PR.
‎2013 Oct 22 3:45 PM
Hi Sanjeev,
I think simple option would be calling your smartform inside loop which has all PR to be printed. Inside smartform just keep logic for fetching data for 1 PR at a time.
This should solve the issue.
Regards,
Koustubh
‎2013 Oct 23 2:29 PM
Dear Koustubh,
i wants to do the same here but not getting how to brake the main driver program code,
here is my SF, if you can do something then it would be a great help for me.
‎2013 Oct 22 2:35 PM
Hi Sanjeev
First of all how are you printing multiple PR's by calling same smartform again in a loop only i believe.
Please provide the details.
Thanks
Nabheet
‎2013 Oct 23 6:24 AM
Hi Nabheet,
actually the driver program was written by previous abaper, now what i can told you is that in my smartforms the code written to fetch is as below...
From your words, i am not getting what you wants to say, please clear it.
Describe table it_eban lines v_count.
counter = counter + 1.
loop at it_item.
sum = ( it_item-menge * it_item-preis ).
value_rs = value_rs + sum .
endloop.
sort it_item BY BNFPO.
* condense value_rs.
select single adrnr
from twlad
into adrnr
where werks = it_eban-werks
and lgort = it_eban-lgort.
‎2013 Oct 23 7:01 AM
My question is how are you printing multiple PR? Are you handling them via Driver program where for each PR smartform is called or you do some logic in smartform only?
‎2013 Oct 23 2:17 PM
Dear Nabheet,
i have a main driver program to call my smartform, but there are some coding inside my smartform
to show values, and in the same i am not able to handle my windows.
Here i am enclosing my smartform , if possible please correct the code inside, so that for multiple line items
and for multiple PO, i didn't face any problem.
Thanks in advance
‎2013 Oct 22 2:50 PM
Dear sanjeev,
Dcleare two global variable .
v_lines type i.
v_chk type char1 default 'N'.
and put a program lines before the line item .
clear: v_lines
describe it_items lines v.
give this variable in the output of program lines.
at the end of the put another program lines.
in the input parameters give both the variables v_lines and v_chk of the program lines.
and in the output parameters give v_chk.
if sy-subc eq v_lines.
v_chk = 'Y'.
endif.
now in the address condition just put v_chk = 'Y'.
and at the end of address put another program lines
and in the input parameters
v_chk.
in the code.
v_chk = 'N'.
this might be helpful.
‎2013 Oct 23 6:20 AM
Hi Zahid,
thanks for your reply, please see the screenshot, in my program lines %code10
i have written these code lines,
CLEAR V_COUNT.
Describe table it_eban lines v_count.
counter = counter + 1.
loop at it_item.
sum = ( it_item-menge * it_item-preis ).
value_rs = value_rs + sum .
endloop.
sort it_item BY BNFPO.
* condense value_rs.
select single adrnr
from twlad
into adrnr
where werks = it_eban-werks
and lgort = it_eban-lgort.
and after the table where i am fetching data, i have written according to you (i have used v_count instead of v_lines)
IF SY-SUBRC EQ V_COUNT.
V_CHK = 'Y'.
ENDIF.
But the problem is that by doing this, i didn't get my address window and also, when the value of a PR ends then next
value starts on the same page, see the second screenshot, please sujjest me what can i do to avoid it.
‎2013 Oct 23 7:12 AM
Dear Sanjeev,
Rather then using windows for the address.
put your template on the main window and remove the secodary window if possible and adjust your address template. It will be easier for you to control. using multiple windows some times become headache. or you can don one thing more use a line in the footer of the table and try to print it accordingly it will always print for you at the end of the lines item of similar PR.
Regards,
‎2013 Oct 23 7:43 AM
Hi Hameed,
tell me one thing, through address window we pass the value of "ADRNR", and it provides me the
details related to that address no., but how can i fetch these values inside my template, if i will use
the command &adrnr&, then it will provide me the details ?
‎2013 Oct 23 8:06 AM
Dear Sanjeev,
you want to display you can use a global variable for address and use command line to move it to that global variable it will exist global for all the text and templates. then pass that variable to address. and before moving just clear you declare adrnr variable.