‎2013 Jul 02 6:34 AM
Hi all,
i have a smartform, which i am using in MB90 to get printout.
The problem i am facing is that it repeadly printed for each line item.
(See the screenshot).But i want to restrict it to print only once,as it is a Header text.
Please tell me how can i achieve this.
‎2013 Jul 02 7:33 AM
Hi Sajeev
I assume you are trying to print the PO Header text in the Material Document printout.
1. You should not print it in the Line items - that is detail part of the main window.
2. You should move this text item into a heaer portion. somewhere near your PO number reference.
As long as it is inside the loop of detail section, it will print.
Still you want to put it in the same place, then you have to set the counter and based on the counte set the flag Y/N and put that condition in the condition tab of that Text element
Regards,
Venkat
‎2013 Jul 02 6:42 AM
Hi Sanjeev,
Could you please tell where you have passed your Header Text.
Thanks
Tarak
‎2013 Jul 02 6:49 AM
Hi Sanjeev,
If you have a table just check the 'header' there.
Sample Smartform tutorial - http://wiki.sdn.sap.com/wiki/display/ABAP/Learn+making+First+Smartform+Step+by+Step
BR.
‎2013 Jul 02 6:55 AM
Hi,
Header has to Give on Header part( Line, Material etc) and Line item out put internal table data(1, xxxmaterial, etc) has to give main area and Total (Total Qty = 100) has give on footer part.
So your header text data has to display on footer part
Please check the screen
Thanks and Regards,
buz_sap
‎2013 Jul 02 7:00 AM
You have put your header text inside the loop it seems.
Put the text element outside the loop.
‎2013 Jul 02 7:33 AM
Hi Sajeev
I assume you are trying to print the PO Header text in the Material Document printout.
1. You should not print it in the Line items - that is detail part of the main window.
2. You should move this text item into a heaer portion. somewhere near your PO number reference.
As long as it is inside the loop of detail section, it will print.
Still you want to put it in the same place, then you have to set the counter and based on the counte set the flag Y/N and put that condition in the condition tab of that Text element
Regards,
Venkat
‎2013 Jul 02 7:41 AM
Hi Venkateswaran,
i have used this to print in Header part of my Table, but it didn't gets printed.
Now come to your second option, it seems easy way to do that, i have three variables
wa-ebeln, wa-head, and wa-text, for which these data gets printed.
So please tell me how can i set a counter and set flag accordingly, please tell me in detail.
I have used this code, and putted FLAG = 'Y', in the condition tab of respected text, i didn't
want to let it increased, so please tell me the necessary changes, which i could make to resolve my issue.
TYPES: FLAG TYPE C LENGTH 1.
IF ( WA-EBELN IS INITIAL ) AND ( WA-HEAD IS INITIAL ) AND
( WA-TEXT IS INITIAL ).
FLAG = 'N'.
ELSE .
FLAG = 'Y'.
ENDIF.
‎2013 Jul 02 9:23 AM
Hi,
I think the above logic never met as ebeln cant be initial. However, I understood you want to print it only once.
So what you can do is.
1. Declare a variable and set a dfault value as flag = 'Y'.
2 .in the header text keep a condition - if flag = 'Y'. ( This time it will print as the default value is Y)
3. Now immedialtely after this node keep a logic node and change the default value to some other value
flag = 'X'.
The header node will not print anymore as the flag value is changed.
Regards,
Swarna
‎2013 Jul 02 10:11 AM
Hi Swarna,
according to you i have written before my text in %12New Program lines as, while set the FLAG = 'Y' in text condition.
TYPES: FLAG TYPE C .
IF FLAG = 'Y'.
G_SRNO = G_SRNO + 1.
ENDIF.
(If i kept G_SRNO = 1, it wouldn't print any texts)
and after text node i have written these code, while i set FLAG = 'X'.
IF FLAG = 'X'.
G_SRNO = G_SRNO.
ENDIF.
Now i am getting my texts like this, please tell me what should i change
‎2013 Jul 02 10:16 AM
Hi Sanjeev
I saw your full code that you posted -- reading F05 to F11..
Step 1
Okay.. I hope all you read from header text of the PO.
Effectively, these are the terms and conditions that you want to print that applies to all the materials...
So, Reading the text code remain as it s where you coded.. But do not print it in Detail section.
Go to FOOTER.
create a new row element.
In that define a row and create all these text elements.
OR
Step 2
If you still wnat to maintain the same place, do as follows
declare a global variable as counter type int2
create a program lines before yo print the material code
create a line called counter = counter + 1
In your text element in the condition tab set the condition as counter = 1.
Regards,
Venkat
‎2013 Jul 02 1:53 PM
Hello Venkat,
thanks a lot for this, but one more thing is there.Now it is printing for only one value.
e.g., i have three text fields
1. wa-ebeln Terms of Delivery
2. wa-ebeln Terms Of Payment
3. wa-ebeln Warranties
But it is printing only for Terms of Delivery only once,and i need to print all the three values once, please tell me what could i do to got all the relavant fields values.
‎2013 Jul 02 6:52 PM
Do similarly for other values as well..
Just copy the same condition and put it in every values - condition tab. 9 ie terms of payment and warranties...
‎2013 Jul 08 7:01 AM
Hello Venkat,
i don't have different values text node for each text, i have just written commands like
&wa-ebeln&-&wa-head& (for first row's value)
&wa-text& (for second row's value)
and it fetches the text from the header level where it gets declared already,these texts are not separately declared in my smartforms, (for which i have created two row line in my table to get these text), but as i told you earlier that it is printing only first rows value from Header Text.
eg.These are the texts that is to be printed there, but it is printing only for Terms of Delivery related both lines.(Upto Delivery within 7 to 10 days from the date of Purchase.)
45000250052 Terms of Delivery
Delivery within 7 to 10 days from the date of Purchase.
45000250052 Terms of Payment
Immediate payment on goods delivery.
45000250052 Warranties
Warranty as per Company warranty card.
‎2013 Jul 08 8:29 AM
Hi Sanjeev,
In your code,
append wa to itext.
is outside the loop.
I think that should be coming inside the loop, otherwise the values in wa will always be overwritten and only the last set of values will be there in itext.
‎2013 Jul 08 1:18 PM
Hi Venkat,
i have tried it to take FLAG into consideration, but it is not helping in getting my desired results.
Please let me know , how could i achieve my requirement, i am getting all these TEXTS through
commands in my SMARTFORM, and i just wants to display it single time irrespective of line items,
please do needful, so that i can restrict it to print only once.
‎2013 Jul 08 2:47 PM
Dear Sanjeev,
Just to recap.. Do as follows:
1. Step 1 -- Create three different variables
WA_TDEL (Terms of delivery)
WA_PPAY (Terms of payment)
WA_WARN (Warranties)
2. Step 2. -- Create a code line for each of these variables
to get these values by calling READ_TEXT and store
a) call read_text --> passing appropriate text_id - get value and store it in WA_TDEL
b) call read_text --> again passing text-id for terms of payment and store in WA_TPAY
c) call read_text --> again passing text_id for warranties and store in WA_WARN
3. Step 3.
Create three text_items and put one one each accordingly. Do not forget to put the condition flag for these text items as discussed earlier
Regards,
Venkat
‎2013 Jul 09 7:07 AM
Hello Venkat,
thanks a lot for your support, but still i am facing problem. i have written these code, but it is giving error that "The Type of C cannnot be converted to the Type of "wa_tdel". When i changes it as
wa_tdel type C, it gives error that The Data object "wa" doesn't have a component called "PPAY" ".
Please tell me what i should do.
COUNTER = COUNTER + 1.
DATA:BEGIN OF dt_lines OCCURS 0,
tdformat LIKE tline-tdformat, "Tag column
tdline LIKE tline-tdline, "Text Line
ktext1 LIKE esll-ktext1, "Short Text
introw LIKE esll-introw. "Line Number
DATA:END OF dt_lines.
data: wa like line of itext.
DATA : wa_tdel like line of itext,
wa_ppay like line of itext,
wa_warn like line of itext.
data: v_po LIKE thead-tdname.
* Terms of delivery text
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
id = 'F05'
language = sy-langu
name = v_po
object = 'EKKO'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
tables
lines = dt_lines
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
if dt_lines[] is not initial.
wa_tdel = 'Terms of delivery'.
wa-ebeln = imseg-ebeln.
wa-ebelp = imseg-ebelp.
loop at dt_lines.
read table dt_lines index 1.
if sy-subrc eq 0.
wa-text = dt_lines-tdline.
endif.
read table dt_lines index 2.
if sy-subrc eq 0.
wa-text1 = dt_lines-tdline.
endif.
read table dt_lines index 3.
if sy-subrc eq 0.
wa-text2 = dt_lines-tdline.
endif.
read table dt_lines index 4.
if sy-subrc eq 0.
wa-text3 = dt_lines-tdline.
endif.
concatenate wa-text '' wa-text1 '' wa-text2 '' wa-text3 into wa-text.
endloop.
append wa to itext.
clear wa.
clear : dt_lines.
refresh : dt_lines[].
endif.
* Terms of payment text
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
id = 'F07'
language = sy-langu
name = v_po
object = 'EKKO'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
tables
lines = dt_lines
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
if dt_lines[] is not initial.
wa-ppay = 'Terms of payment'.
wa-ebeln = imseg-ebeln.
wa-ebelp = imseg-ebelp.
loop at dt_lines.
read table dt_lines index 1.
if sy-subrc eq 0.
wa-text = dt_lines-tdline.
endif.
read table dt_lines index 2.
if sy-subrc eq 0.
wa-text1 = dt_lines-tdline.
endif.
read table dt_lines index 3.
if sy-subrc eq 0.
wa-text2 = dt_lines-tdline.
endif.
read table dt_lines index 4.
if sy-subrc eq 0.
wa-text3 = dt_lines-tdline.
endif.
concatenate wa-text '' wa-text1 '' wa-text2 '' wa-text3 into wa-text.
endloop.
append wa to itext.
clear wa.
clear : dt_lines.
refresh : dt_lines[].
endif.
**** Warranties text
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
id = 'F08'
language = sy-langu
name = v_po
object = 'EKKO'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
tables
lines = dt_lines
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
if dt_lines[] is not initial.
wa_warn = 'Warranties'.
wa-ebeln = imseg-ebeln.
wa-ebelp = imseg-ebelp.
loop at dt_lines.
read table dt_lines index 1.
if sy-subrc eq 0.
wa-text = dt_lines-tdline.
endif.
read table dt_lines index 2.
if sy-subrc eq 0.
wa-text1 = dt_lines-tdline.
endif.
read table dt_lines index 3.
if sy-subrc eq 0.
wa-text2 = dt_lines-tdline.
endif.
read table dt_lines index 4.
if sy-subrc eq 0.
wa-text3 = dt_lines-tdline.
endif.
concatenate wa-text '' wa-text1 '' wa-text2 '' wa-text3 into wa-text.
endloop.
append wa to itext.
clear wa.
clear : dt_lines.
refresh : dt_lines[].
endif.
‎2013 Jul 09 8:04 AM
In your declaration change as follows :
DATA : wa_tdel like line of itext,
wa_ppay like line of itext,
wa_warn like line of itext.
DATA : wa_tdel TYPE C length 15,
wa_ppay TYPE c length 15,
wa_warn TYPE c length 15.
Regards,
Venkat
‎2013 Jul 09 8:21 AM
Dear Venkat,
as you told when i declare it as TYPE C LENGTH 15 , it gives error "The data object "WA" does not
have a component called PPAY".
Previously i have used TYPE C, and i got the same error, and thats why i have written it in my previous post.
Please see my whole code snippet(in earlier post), because the Texts are declared as in " wa-head", and now if i am using any
other variable to store this value, it gives me error.So considering this please tell me what could i do.
‎2013 Jul 09 12:25 PM
Can you please down load your form as xml file and attach?
You can do it from utilities.
‎2013 Jul 09 12:37 PM
‎2013 Jul 09 3:44 PM
Dear Sanjeev,
1. In the %CODE4 - Why you are fetching the text items for the Loop of MSEG table. Which is not
required. However, keep it as now.
2. In the %CODE4 - before every READ_TEXT - refresh the dt_lines.
(If some text items are not enetered in PO, then the READ_TEXT item will not refresh the dt_lines. So make sure before calling the READ_TEXT everytime refresh the dt_lines.
Example at Line 19, Line 81, Line 140.. etc...
Your code should look like
* Terms of delivery text
REFRESH dt_lines.
CALL FUNCTION 'READ_TEXT' ...........
Regards,
Venkat
‎2013 Jul 10 5:41 AM
Dear Venkat,
adding REFRESH dt_lines didn't effect my output,(also as you sujjested i have commented my declared REFRESH statement, but it is not working) still i am getting only a single set of text in my output, and this code was written by previous abaper not me, my task is to just stop multiple time
printing of these text, and to keep it print a single time.
And in this context i am facing problem at all.
Here are the outputs which i am getting now, in my smartform for first page, i am getting
4500000.... Terms Of Delivery
and in second page
Delivery Within 7 to 10 days from the date of Purchase Order......
after texts are completely missing
Message was edited by: SANJEEV KUMAR
‎2013 Jul 10 6:32 AM
In addition to the above, though you have specified the Refresh statement, it is not the right place. You have to place is just before calling the CALL FUNCTION read_text statement. Please update me as well your result.
This should work fine now.
Regards,
Venkat
‎2013 Jul 10 10:49 AM
Okay Sanjeev
In the Code4, after every read_text statement set a break point. see the Then see itext values how it is being appended
Then in your code4 -- Change as follows for every loop at dt_lines.
( No need to read line 1 line2 etc...)
loop at dt_lines.
CONCATENATE wa-text dt_lines-tdline into wa-text SEPARATED BY SPACE
endloop.
‎2013 Jul 11 8:02 AM
Dear Venkat,
as you have sujjested, i changed my code lines, but result is same .What i have found while debugging is that "In ITEXT table First statement was there(which is shown in screenshot, after executing it many times through F8 ,the ITEXT table value get changed, as shown in second screenshot )".
And these all are happening in
append wa to itext.
so i think through COUNTER it will not work, (while debugging i see the texts in screen shot but while final execution through F8
i see only the first set of text.)
‎2013 Jul 10 11:13 AM
Hi Sajeev
you are trying to print the PO Header text in the Material Document printout.
You should move this text item into a header portion. somewhere near your PO number reference.
As long as it is inside the loop of detail section, it will print.
Still you want to put it in the same place, then you have to set the counter and based on the counte set the flag Y/N and put that condition in the condition tab of that Text element
-Ganesh