‎2005 Jun 21 8:19 PM
hi folks,
I need help in forms guys. I have declared a text element to display data in the body of the form. The text element constitutes a field of the table which I loop into the body of the form from the abap print program.
Loop at
Accountdata INTO WA_ACCOUNTDATA
I have declared the text element in the form as
WA_accountdata-zrate(field name) within & ______ &.
The program is fine with syntax but on execution it throws an error saying that wa_accountdata-zrate (the field declared in the body of the form) is not in the form.
It is puzzling as why it showing this error even though I have created the text element and declared the variable within &_____& in the form.
Any leads and help is really appreciated.
thanks
Santhosh
‎2005 Jun 22 4:44 AM
Hi,
Instead of manually typing the fieldname within &...&,click field list on/off icon[nearer to form painter button].Then drag the field from the set of fields displayed below.If you declared it in global data,drag it from there.Otherwise,drag from the corresponding place.
Check this link to get an idea of smartform.
https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap code samples/smartforms/smartform in abap.pdf
If your problem is solved,reward points and close the thread.Otherwise,get back.
‎2005 Jun 22 4:44 AM
Hi,
Instead of manually typing the fieldname within &...&,click field list on/off icon[nearer to form painter button].Then drag the field from the set of fields displayed below.If you declared it in global data,drag it from there.Otherwise,drag from the corresponding place.
Check this link to get an idea of smartform.
https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap code samples/smartforms/smartform in abap.pdf
If your problem is solved,reward points and close the thread.Otherwise,get back.
‎2005 Jun 22 2:38 PM
hi,
I tried that it did not work.
The error goes something like this,
Reference field WA_ACCOUNTDATA-ZRATE unknown in the form.
This field has been declared in the body of the form under the table node inside the main window. Using the table painter declared the line type and suppose to insert the variable for a field element in the body table.
Also the abap print program code goes..
check sy-subrc eq 0.
select kposn kschl krech kawrt kbetr kwert from konv into table cdata
where knumv = p_knumv.
loop at cdata into wac.
case wac-kschl.
when 'ZRAT'.
MOVE wac-kbetr to accitab-zrate.
MOVE wac-kwert to accitab-zsubtotal.
when 'ZRTC'.
MOVE wac-kbetr to accitab-zrate.
MOVE wac-kwert to accitab-zsubtotal.
endcase.
if sy-subrc = 0.
append accitab.
endif.
clear accitab-zamount.
endloop.
call function fm_name
exporting
archive_index =
archive_parameters =
control_parameters =
mail_appl_obj =
mail_recipient =
mail_sender =
output_options =
user_settings = 'X'
ZBALANCE = ZCURRENTTOTAL
ZOVER30 = ZOVER30TOTAL
ZOVER60 = ZOVER60TOTAL
ZOVER90 = ZOVER90TOTAL
ZTOTAL = ZTOTAL
zscan_code = scan_number
zpartner = bpartner
zbdate = bdate
bookings = bookings
importing document_output_info =
job_output_info =
job_output_options =
tables
stribunecustomer = customer
accountdata = accitab
Here... in the debug mode I check and data is populated into accitab but nothing displays in accountdata.
Since the errors said that the field not found in the form, Do I need to check with the abap print program also??
Thanks for your help,and this is where it stands.
Santhosh
‎2005 Jun 23 5:01 AM
Hi,
Instead of declaring that in the body of the form, declare it in Global definitions-Global data.
If it is internal table,then
itab type standard table of mara
If it is workarea,then
wa type mara.
And regarding that accountdata,
If you are using a internal table without workarea in smartforms,you should pass internal table without workarea from the program.I already suggested the same in one of your previous posts.
Check this link for sample ABAP smartform.
http://www.sap-img.com/smartforms/smartform-tutorial.htm
If it is useful,reward points and close the thread.Otherwise , get back.
‎2005 Jun 23 2:54 PM
Hi,
The declaration is same as we had discussed in the previous problem (data not looping into the body of the form and had a problem that 120 records were Not POPulating into the form ....)
Form interface
ACCOUNTDATA LIKE ZZACCOUNTDATA
Global definition
WA_ACCOUNTDATA TYPE ZZACCOUNTDATA
It's the same thing and I was able to identify the probelm to loop the data into the body. remember...
LOOP At
ACCOUNTDATA INTO WA_ACCOUNTDATA
getting the data from accitab.
It's the same nothing has changed.
ACCOUNTDATA IS AN itab with fields
ACCOUNTDATA-ZDATEPRODUCTCODE
ACCOUNTDATA-ZADNUMBER
ACCOUNTDATA-ZDESCRIPTION
ACCOUNTDATA-ZADSIZE
ACCOUNTDATA-ZRATE
ACCOUNTDATA-ZSUBTOTAL
ACCOUNTDATA-ZAMOUNT
In the earlier case I had the problem populated zdateproductcode,zadnumber,zadsize into the body if you remember it was not looping into the form..
Now using a different query i have to populate the other fields zrate,zsubtotal, and zamount into the same workarea.
The data is loading into accitab AND STOPS I DO NOT SEE THE DATA IN ACCOUNTDATA. In the fields icon when I check i do find WA_ACCOUNTDATA AND THE FIELDS ZRATE,ZSUBTOTAL AND ZAMOUNT BUT WHEN I CALL THEM IN THE TEXT ELEMENT IN THE FIELD OF THE TABLE IS GIVES ME THE ERROR saying the reference field WA_ACCOUNTDATA-ZRATE not found.
THE DECLARATION OF THE ACCITAB,ACCOUNTDATA,WA_ACCOUNTDATA IS SAME AS AND WHEN I HAD THE PREVIOUS PROBLEM. I HAVE NOT INCLUDED NEW WORKAREAS OR READING DATA INTO A NEW ITAB OR ANYTHING LIKE THAT.
i hope you can get the issue here.
thanks
‎2005 Jun 23 3:06 PM
You have set up ACCOUNTDATA in the "Tables" section of the Form interface - it will have a header line and you don't need a work area - simply set up the loop to ACCOUNTDATA INTO ACCOUNTDATA.
‎2005 Jun 23 4:00 PM
No Nathan, it does not work that way. I have to read the data into the workarea and then populate it into the body.
The issue here is the field 'WA_ACCOUNTDATA-ZRATE' is not recognized in the form even though the global definition is showing the field name. Because using the same approach I am able to read the data from the other fields and populate into the text elements of the form.
I hope you understood the issue.
Thanks
Santhosh
‎2005 Jun 23 6:07 PM
Hi,
Just wanna add few points to the above posting.
ACCOUNTDATA-ZRATE
ACCOUNTDATA-ZSUBTOTAL
ACCOUNTDATA-ZAMOUNT
they are currency fields and the error is occurring for all these three fields.
Interesting thing is, when I click the field icon,under WA_ACCOUNTDATA(declared under Global defintion)I do find these fields but error says the fields are unknown in the form.
Just wanted to share this point of the issue.
Anyhelp would be just great. Thanks in advance.
Santhosh
‎2005 Jun 24 5:49 AM
Hi Santhosh,
I am very sure that that problem is not because of the currency fields.It can also be dispalyed like normal fields.
You mentioned <b>'This field has been declared in the body of the form under the table node inside the main window.'</b>
I told you to change the declaration in Global definitions-Global data.
I hope in that ZZACOUNTDATA structure also you added these three fields.
From your coding part,
loop at cdata into wac.
case wac-kschl.
when 'ZRAT'.
MOVE wac-kbetr to accitab-zrate.
MOVE wac-kwert to accitab-zsubtotal.
when 'ZRTC'.
MOVE wac-kbetr to accitab-zrate.
MOVE wac-kwert to accitab-zsubtotal.
endcase.
if sy-subrc = 0.
<b>append accitab</b>.
endif.
clear accitab-zamount.
endloop.
That's why I asked you to change it into internal table and workarea.You should declare accitab without explicit/implicit workarea.
example:
data : i_accitab type standard table of ZZACCOUNTDATA,"internal table
w_accitab type ZZACCOUNTDATA."work area
So that coding part should be,
loop at cdata into wac.
case wac-kschl.
when 'ZRAT'.
MOVE wac-kbetr to w_accitab-zrate.
MOVE wac-kwert to w_accitab-zsubtotal.
when 'ZRTC'.
MOVE wac-kbetr to w_accitab-zrate.
MOVE wac-kwert to w_accitab-zsubtotal.
endcase.
if sy-subrc = 0.
*Here are you sure that you are passing fields for only four fields in i_accitab.Otherwise you should use read statement to read other feilds and then modify the record for other fields.
<b>append w_accitab to i_accitab</b>.
endif.
clear w_accitab.
endloop.
‎2005 Jun 24 4:50 PM
Hi Jayanti,
I am sorry if I have created any confusion, I have declared WA_ACCOUNDATA in Global defintions.as.
WA_ACCOUNTDATA TYPE ZZACCOUNTDATA ( and zzaccountdata has these fields declared in them). I have called the particular field in the main window.
Thanks a lot. But it not working. Even after including the workareas and itab it remains same. I am not able to understand how come it is not recognizing the field.
Hope you could help me in this issue.
Santhosh
‎2005 Jun 25 12:42 AM
Hi santhosh,
From the sbove discussion i understand that the problem is not with the smartforms, but with the structure/table ZZACCOUNTDATA.
Check if you have proper currency key for the three fields you mentioned.
if there is a problem there then the data will not be transported.
Regards,
siva
‎2005 Jun 27 12:49 PM
Hi,
I think you smartform is ok.Check the reporting part.
<b>data : i_accitab type standard table of ZZACCOUNTDATA,"internal table
w_accitab type ZZACCOUNTDATA."work area</b>
So that coding part should be,
loop at cdata into wac.
case wac-kschl.
when 'ZRAT'.
MOVE wac-kbetr to w_accitab-zrate.
MOVE wac-kwert to w_accitab-zsubtotal.
when 'ZRTC'.
MOVE wac-kbetr to w_accitab-zrate.
MOVE wac-kwert to w_accitab-zsubtotal.
endcase.
if sy-subrc = 0.
*Here are you sure that you are passing fields for only four fields in i_accitab.Otherwise you should use read statement to read other feilds and then modify the record for other fields.
<b>append w_accitab to i_accitab.</b>
endif.
clear w_accitab.
endloop.
‎2005 Jun 27 3:04 PM
hi,
you are right!!.
I figured out the area of problem,
if I declare
data : i_accitab type standard table of ZZACCOUNTDATA with header line, "internal table
w_accitab type ZZACCOUNTDATA."work area
and loop the data.... proceed further.
i_accitab is getting populated with data. but I am getting that error that WA_accountdata-zrate not found in the form.
If I declare
data : i_accitab type standard table of ZZACCOUNTDATA "internal table ( NO HEADER LINE)
w_accitab type ZZACCOUNTDATA."work area
then i_accitab is having no data i.e the fields are not getting populated.
but the error that WA_accountdata-zrate is solved , the form is displayed.
Does it lead to anything???. Thanks for the help.
Santhosh
‎2005 Jun 27 3:19 PM
Also.
information on the itable cdata is here.
types: begin of conditiondata,
kposn type konv-kposn,
kschl type konv-kschl,
krech type konv-krech,
kawrt type konv-kawrt,
kbetr type konv-kbetr,
kwert type konv-kwert,
end of conditiondata.
data cdata type standard table of conditiondata.
the query statement
select kposn kschl krech kawrt kbetr kwert from
konv into table cdata where knumv = p_knumv.
loop at cdata into wac.
proceed .........
endloop.
santhosh
‎2005 Jun 27 4:35 PM
hi,
NOTE!!!!!!
HERE IS THE LATEST CODE FOR THIS PART OF THE PROGRAM .IGNORE EVERTHING ELSE AND HERE IS THE CODE i HAVE BEEN WORKING ON LATELY.
types: begin of conditiondata,
kposn type konv-kposn,
kschl type konv-kschl,
krech type konv-krech,
kawrt type konv-kawrt,
kbetr type konv-kbetr,
kwert type konv-kwert,
end of conditiondata.
data cdata type standard table of conditiondata.
data: wac type conditiondata,
accitab type standard table of zzaccountdata,
w_accitab type zzaccountdata.
select kposn kschl krech kawrt kbetr kwert from
konv into table cdata where knumv = p_knumv.
loop at cdata into wac.
case wac-kschl.
when 'ZRAT'.
MOVE wac-kbetr to w_accitab-zrate.
MOVE wac-kwert to w_accitab-zsubtotal.
when 'ZRTC'.
MOVE wac-kbetr to w_accitab-zrate.
MOVE wac-kwert to w_accitab-zsubtotal.
endcase.
if sy-subrc = 0.
append w_accitab to accitab (DATA GETS POPULATED INTO ACCITAB).
endif.
clear w_accitab.
endloop.
AS OF NOW I AM POPULATING THE FOUR FIELDS OF ACCITAB. FROM THESE I NEED TO WORK MY WAY TO POPULATE THE OTHER FIELDS LATER ON...
SO I HAVE TO GET THIS RIGHT AS OF NOW.
THE ERROR THAT IAM GETTING IS THE SAME 'WA_ACCOUNTDATA-ZRATE IS UNKNOWN IN THE FORM'.
THANKS IN ADVANCE FOR YOUR HELP. I TOTALY UNAWARE AS WHERE THE ERROR IS OCCURING.
I AM CHECKING THE CODE IN THE FUNCTION MODULE OF THE FORM BY PUTTING BREAK POINTS THERE AND TRYING TO FIND THE ERROR, NO USE!!
Santhosh
‎2005 Jun 28 9:35 AM
Hi,
Now you corrected the report.ok.
THE ERROR THAT IAM GETTING IS THE SAME 'WA_ACCOUNTDATA-ZRATE IS UNKNOWN IN THE FORM'.
The error now comes in smartform part.
I hope after that coding which you had given here,I think you are using function module with table parameter
...= accitab...Am I right?
If so,do the following in smartform.
<b>In Form Interface,tables declaration
accountdata like zzaccountdata</b>
Then only it can take the table values from report.
<b>In Global definition,
in Global data
WA_ACCOUNTDATA type zzaccountdata
Then loop at accountdata into wa_accountdata.</b>
Hope this solves the problem.If so,reward points and close the thread.
‎2005 Jun 28 9:47 AM
Hi Santhosh,
This is a common problem in displaying amounts in Smartforms. Always when you want to display any amount field then in the Global Definitions declare a type of the currency field and in the definitions declare a variable of that type. In your code in the smartform move the internal table value to this variable before displaying it. This is what I do... A common problem.
Regards,
Sudhi
‎2005 Jun 28 5:00 PM
Thanks Jayanthi,
I did figure the problem out and solved it. I really appreciate your time and helping me out here. I di already declare the form interface and global defintion but it did help me. no questions on that.
I shall be rewarding the points to you.
I have two more questions.
I have the dynamic table declared in the 'main window'
and I am looping the data into the table and displayed in the body of the form.
When the data gets displayed, the line space between the data in the form is big. <b>How to reduce the space between the lines in the form? where can I adjust the line spacing?</b>
Second question,
there are some fields that take value '0.00' for the currency fields as and when the this data is transfered into the form it draws a blank. nothing displays. <b>How to display the zero values that the field pulls from the table into the form.</b>The value is pulled into the internal table in the print program but is not displayed in the form.
Santhosh
‎2005 Jun 28 5:04 PM
thanks Sudhi,
You came in at the right time. Your info certainly helped. I shall be rewarding points to you too.
And i have two questions
Question 1
I have the dynamic table declared in the 'main window'
and I am looping the data into the table and displayed in the body of the form.
<b>When the data gets displayed, the line space between the data in the form is big. How to reduce the space between the lines in the form? where can I adjust the line spacing?</b>
Second question,
there are some fields that take value '0.00' for the currency fields as and when the this data is transfered into the form it draws a blank. nothing displays. <b>How to display the zero values that the field pulls from the table into the form.The value is pulled into the internal table in the print program but is not displayed in the form.</b>
Regards
Santhosh
‎2005 Jun 29 8:03 AM
Hi Santhosh,
Here you go... first of all a reason as to why there is a space. The quantity and the amount fields are all 15 charachters and they are defaulted to be right justified. Even if you dont have data then also these fields pushes the others and there is a line space. What you can do to eliminate this ? Ex. you have a amount field as &EKPO-NETWR& you need to just put a property here.
&EKPO-NETWR(C)& The addition (C) will clear the initial spaces and the data will be displayed correctly.
For the second question I guess there is some problem in the assignment of the values that you display in the form. This should not happen. Even if it is a 0.00 it should get displayed as it is.
Regards,
Sudhi
‎2005 Jun 29 8:13 AM
Hi,
I think you can create your own style to adjust spacing.But I am not sure that you can reduce the space between lines.But you can use select characters per inch,lines per inch,tab stop etc., in styles.
Regarding the second qn.,I tried 0.00.It's displaying for me.
‎2007 Nov 05 7:31 AM
there's is a solution !
Take those problem fields .
Define program lines that get the fields and output char fields.
Use the write command to transfer values from the fields to char fields.
Then display the char fields.
Eliram.
‎2005 Jun 22 4:46 AM
I am really not sure as what exactly are you trying to do ?
<<<
The text element constitutes a field of the table which I loop into the body of the form from the abap print program
>>>
How can you do this from the ABAP print program ??
It's a smartform right ? And not a Sapscript !!
You must do any loop within the smartform itself..
You can only call the generated Function Module from the print program..
Also in the text element, you should select the variable name from the list of availbale variables ( Check the tool - icons ) while creating text element in smartform.
Rather than writing by yourself as &var_name&.
‎2005 Jul 12 8:38 AM
Hi Techies,
1) I just wanted to know how to modify standard Smartform Layout.
2) How to find-out a standard driver program from tcode SMARTFORMS .
Thanks in advance,
-Kiran