‎2005 Jun 03 4:07 PM
HI FOLKS,
ANY SMARTFORM EXPERTS I WOULD APPRECIATE YOUR HELP GUYS!!!
thanks a lot for taking your time off to help me in this regard. Both my probelms are not solved yet.
I will explain it to you in detail what i have done and what i am trying to achieve.
the code in the abap print program goes like this.
select fbuda vavtyp aubel breite_s HOEHE_S from zzjhtfp INNER JOIN jhamot ON zzjhtfpaubel = jhamotavm_nr INTO table BDATA WHERE zzjhtfp~kunnr = p_custid.
pulling data of fbuda and vavtyp to merge them****
if sy-subrc = 0.
loop at bdata into wa.
write:wa-fbuda to zdate ddmmyy.
write: zdate to zdate1 dd/mm/yy.
write: wa-aubel to zadnumber.
write:wa-vavtyp.
***MERGED THE DATA FROM THE TWO FIELDS***
concatenate zdate1 wa-vavtyp into wa1-zdateproductcode separated by space.
trying to insert into the field of the new internal table (accitab) -it has not data it has several fields with a different structure(z_ty-accountdata is its structure)
accitab-zdateproductcode = wa1-zdateproductcode.
accitab-zadnumber = wa1-aubel.
accitab-zadsize = wa1-zadsize.
if sy-subrc = 0.
append accitab.
endif.
endloop.
endif.
generated functional module related to smartform
note: the data from the internal table accitab is read into accountdata
now call the generated function module
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
exceptions formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
others = 5.
objective: This data which gets populated into the accountdata is to be populated into the main window- body of the form.
parameter declaration given in smartforms;
form interface - under tables
accountdata type z_ty_accountdata (this is table type with structure zzaccountdata)
global definitions
wa_accountdata type zzaccountdata
In the main window - under loop section I have given
accountdata into wa_accountdata
problem definition: In the form when I try to print the field values like zdateproductcode, zaubel only the first row of data in printing in the form BUT THERE AT 120 RECORDS.
but I run the abap print program in the debug mode IT IS SHOWING the internal table 'accountdata' does not have any records -the table 'accitab' has 120 RECORDS.
I am not able figure it out how else can i transfer the data TO ACCOUNTDATA.
My question is if accountdata has no data how can it read the SINGLE FIELD DATA into the form. I hope you understand here.
There is some missing peice that is not transporting the data from accitab into accountdata completely.
I know my explanation is quite big but i have working towards this from past two days, I NEED YOUR HELP. ONCE IT GETS SOLVED I WILL REWARD POINTS FOR ALL.
santhosh
‎2005 Jun 06 7:15 AM
Hi Santhosh,
I am just giving a small example here which is similar to your requirement.
*This is the report program.
In this zzz_test is a user-defined struture which I created in SE11 which consists of three fields vbeln,posnr & vkorg.
*Internal table declaration
data itab type standard table of zzz_test.
select likpvbeln lipsposnr likp~vkorg from likp inner join lips
on likpvbeln = lipsvbeln into table itab.
CALL FUNCTION '/1BCDWB/SF00000016'
TABLES
itab = itab
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
In my smartform,
In Form Interface,tables declaration
itab <b>like</b> zzz_test
In Global definition,
in Global data
wa <b>type zzz_test</b>
Then I created a loop in the main window.
loop itab into wa.
Then I created a text element.
It is working fine .It's displaying all the records.
In your program,the following are the things to be noted.
1. In your report program,if accitab has user defined struture z_ty_accountdata ,then in smartform
form interface - under tables
accountdata <b>like</b> z_ty_accountdata
global definitions-under global data
wa_accountdata type <b>z_ty_accountdata</b>
In the main window - under loop section
accountdata into wa_accountdata.
This time it should work.If not, get back to me.
Regards,
J.Jayanthi
‎2005 Jun 03 6:40 PM
Hi Santosh,
Based on information you have provided, it seems like the table definition needs to be checked. May be it is a structure and thats why only one record is printed.
(accountdata type z_ty_accountdata (this is table type with structure zzaccountdata.
Another area could be your loop node / Data Tab.
Hope this helps!
Message was edited by: SBX
‎2005 Jun 03 6:57 PM
Well, when the records are not tranferred from the prgram into form, the only reason could be that "accountdata" is not recognised as a table but just as a structure. I think whatever was there in your header of accitab is moved to this structure.
But since you have mentioned that accountdata is declared under Tables section this problem should generally not occur. I dont see any reason for its failure. Why dont you try by defining your accountdata table as "accountdata LIKE zzaccountdata" under the Tables section in your forms interface. Just give a shot.
All the best.
Regards,
Vijay
‎2005 Jun 03 7:37 PM
thanks for your response vijay
You might be right, accountdata has the table type (z_ty_accountdata) and has a structure zzaccountdata as the line type. The reason being there exists no table that matches to the accountdata because in accountdata I am pulling data from two to three different tables.
hence i defined the structure zzaccountdata that contains the components of various fields
Any otherway I could have done...
santhosh
‎2005 Jun 06 7:23 AM
Hi Santhosh,
Assuming that you have defined the table ACCOUNTDATA in the smartforms under the TABLES node in Form Interface, the data in the internal table of your main program will be transferred to your smartform without any trouble. There is nothing wrong in this part.
Hence I can only suspect the following things:
1. whether data is present in ACCITAB at the time smartform is called.
2. Do you have any REFRESH statement or any other conditions that delete the records in ACCOUNTDATA after the data is moved to the smartform.
You might have done this check already, but checking this can narrow down your problem and we can come to know whether the problem is in transfer of data into smartform or in sibsequent steps:
Put a breakpoint in your main program at the function module and check the contents of ACCITAB at this point.
Press F5 twice (by this time it would have gone into you smartform function module) and check the contents of the Internal table defined in the smartform (ACCOUNTDATA).
If ACCITAB has entries and ACCOUNTDATA does not have, then we can conclude that the problem is in defining the interface for the data transfer of internal table (Hope you have defined your ACCOUNTDATA table only under TABLES tab of Form Interface and not under IMPORT tab). We can further look at the problem then.
Regards,
Vijay
‎2005 Jun 06 3:50 PM
Hi vijay,
I checked all that in the debug mode. in the function module i find the data in the accitab. but not into accountdata. also, I have made the declaration under tables of form interface. Also no refresh statements.
Thanks vijay.
santhosh
‎2005 Jun 07 3:34 AM
what to say then....going by your explanations I couldnt find anything wrong with your code and actions seems a little strange. But believing that SAP system cannot show strange behaviour by itself, lets try a few more options to test it:
1. Copy the generated funtion module for your smartform and hardcode in your print program and check the result.
2. Or, introduce "program lines" node just before your loop statement and append a few records by yourself into the ACCOUNTDATA table and see whether the data is printing. This ensures that the ACCOUNTDATA is defined as table only and also the loop statement works fine to print multiple records ( As you have mentioned that it prints only one record even though 120 records are coming from your print program). You can also clear the header line of acctitab in your print program and check this result.
Also, can you please once again tell me how you have defined your accitab in the print program & accountdata in the smartform. Just give the complete ABAP stmt of these 2 defintions.
One more point..check how "stribunecustomer" in smartform gets the data from "customer" in your print program. that can also help u spot the problem.
Regards,
Vijay
‎2005 Jun 07 3:45 PM
thanks vijay,
i did check from 'stribunecustomer' and 'customer'
form interface
stibunecustomer type z_ty_stribunecustomer
here z_ty_stribunecustomer is a table type that has a line type of a database table.
This is not the case with accountdata that cannot have the line type of a database table because there is no one.
And how to appmed the records using program lines node is it like writing the query and appending the data.. what part of the code should I write here?
Thanks for continuing help in this regard.
Santhosh
‎2005 Jun 08 7:28 AM
Hi Santhosh,
Right click on the first window of your page and choose program lines.
enter your table name and work area name in the import and export parameters.
write a piece of code, may be DO stmt to iterate for a couple of times and append the records using the work area.
DO 2 times.
append <wa> to <accountdata>.
ENDDO.
break <yourid>.
and check the table contents.
If the data is getting populated here, then it infers that your table defintion is also correct and the most probable error might be something like you might have unknowingly unchecked the 'Internal table' option in your loop statement under 'data' tab. Just a thought!!
Regards,
Vijay
‎2005 Jun 08 9:30 PM
thanks vijay. the problem got solved. I have awarded the points to you also. I really appreciate for taking your time off and helping me out.
Santhosh
‎2005 Jun 06 7:15 AM
Hi Santhosh,
I am just giving a small example here which is similar to your requirement.
*This is the report program.
In this zzz_test is a user-defined struture which I created in SE11 which consists of three fields vbeln,posnr & vkorg.
*Internal table declaration
data itab type standard table of zzz_test.
select likpvbeln lipsposnr likp~vkorg from likp inner join lips
on likpvbeln = lipsvbeln into table itab.
CALL FUNCTION '/1BCDWB/SF00000016'
TABLES
itab = itab
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
In my smartform,
In Form Interface,tables declaration
itab <b>like</b> zzz_test
In Global definition,
in Global data
wa <b>type zzz_test</b>
Then I created a loop in the main window.
loop itab into wa.
Then I created a text element.
It is working fine .It's displaying all the records.
In your program,the following are the things to be noted.
1. In your report program,if accitab has user defined struture z_ty_accountdata ,then in smartform
form interface - under tables
accountdata <b>like</b> z_ty_accountdata
global definitions-under global data
wa_accountdata type <b>z_ty_accountdata</b>
In the main window - under loop section
accountdata into wa_accountdata.
This time it should work.If not, get back to me.
Regards,
J.Jayanthi
‎2005 Jun 06 3:46 PM
Thanks jayanti,
Just want to explain my inital declaration in my abap program.
types: begin of structbdata,
fbuda type jhtfp-fbuda,
vavtyp type jhtfp-vavtyp,
aubel type jhtfp-aubel,
breite_s type jhamot-breite_s,
hoehe_s type jhamot-HOEHE_S,
end of structbdata.
data bdata type standard table of structbdata.
data: wa type structbdata,
accitab type standard table of zzaccountdata with header line,
wa1 type zzaccountdata,
zdate(8) type c,
zdate1(8) type c,
zproductdate(12) type c,
zadnumber(10) type c,
zwidth(7) type c,
zheight(7) type c,
zadsize(16) type c.
select fbuda vavtyp aubel breite_s HOEHE_S from zzjhtfp INNER JOIN jhamot ON zzjhtfpaubel = jhamotavm_nr INTO table BDATA WHERE zzjhtfp~kunnr = p_custid.
SO ON ..... REST IS THE SAME
As per your statement
data accitab type standard table of zzaccountdata.
throws an error saying that accitab is a table without header line. why is it so ???
I have to include 'with the header line'.
After your explanation it seems to me that the coding in the smartform side is ok.
Like your zzz_test I have declared the structure zzaccountdata in SE11.
and executed the form it throws the error
that the data fields declared in the text elements has no defined value.( same error which i got at the start)
Just take a look into the coding in the abap print program probably that has to do with some thing.
Also note: BDATA (strucutre is not same as zzaccountdata) is the internal table that has the data from the query. accitab is a different internal table with(strucutre zzaccountdata) because I have to pull the data from the tables,concatenate some fields data and then load the data into accitab.
The suprise thing is upon concatenation process,all the records are getting stored in accitab (even during the execution of the function module - I checked it in the debugg mode) but not to accountdata.
This is the update. Thanks for your help
Santhosh
‎2005 Jun 07 4:48 AM
Hi Santhosh,
It throws an error message b'coz of the following statement.In these statements you are using it as both workarea and internal table.
accitab-zdateproductcode = wa1-zdateproductcode.
accitab-zadnumber = wa1-aubel.
accitab-zadsize = wa1-zadsize.
if sy-subrc = 0.
append accitab.
....
If you declared like this
<b>data accitab type standard table of zzaccountdata.</b>
Then accitab is a internal table without workarea.
So declare workarea explicitly as follows with that internal table:
<b>data w_accitab type zzaccountdata.</b>
Then your statements should be
<b>w_accitab-</b>zdateproductcode = wa1-zdateproductcode.
<b>w_accitab</b>-zadnumber = wa1-aubel.
<b>w_accitab</b>-zadsize = wa1-zadsize.
if sy-subrc = 0.
append <b>w_accitab to accitab</b>.
....
Have you modified your smartform declarations as I mentioned in my previous reply?
Check for the coding in report.
types: begin of structbdata,
fbuda type jhtfp-fbuda,
vavtyp type jhtfp-vavtyp,
aubel type jhtfp-aubel,
breite_s type jhamot-breite_s,
hoehe_s type jhamot-HOEHE_S,
end of structbdata.
data bdata type standard table of structbdata.
data: wa type structbdata,
<b>accitab type standard table of zzaccountdata ,
w_accitab type zzaccountdata,</b>
wa1 type zzaccountdata,
zdate(8) type c,
zdate1(8) type c,
zproductdate(12) type c,
zadnumber(10) type c,
zwidth(7) type c,
zheight(7) type c,
zadsize(16) type c.
select fbuda vavtyp aubel breite_s HOEHE_S from zzjhtfp INNER JOIN jhamot ON zzjhtfpaubel = jhamotavm_nr INTO table BDATA WHERE zzjhtfp~kunnr = p_custid.
pulling data of fbuda and vavtyp to merge them****
if sy-subrc = 0.
loop at bdata into wa.
write:wa-fbuda to zdate ddmmyy.
write: zdate to zdate1 dd/mm/yy.
write: wa-aubel to zadnumber.
write:wa-vavtyp.
***MERGED THE DATA FROM THE TWO FIELDS***
concatenate zdate1 wa-vavtyp into wa1-zdateproductcode separated by space.
<b>w_accitab-zdateproductcode = wa1-zdateproductcode.
w_accitab-zadnumber = wa1-aubel.
w_accitab-zadsize = wa1-zadsize.</b>
if sy-subrc = 0.
<b>append w_accitab to accitab.
</b>
endif.
endloop.
endif.
<b>*Check whether the records are in accitab</b>
now call the generated function module
....rest of the code
‎2005 Jun 07 3:37 PM
hi jayanti,
thanks a lot guys. Really appreciate for taking your time off and being persistent in helping me.
The error continues to occur. while debugging I observed that in the function module the records are there in 'accitab' How come it is not taking the records into accountdata? Is there any other way I can declare accountdata in the form interface.
I tried something like this.
accountdata type standard table of zzaccountdata - It did not accept.)form interface)
I think it is treating accountdata as a structure( hence one record)
***In the function module***
tables
accountdata ( no records) = accitab ( records are there in the internal table ) why?????
As you had given the declaration part in smartform
Note: z_ty_accountdata is a table type so i have not used it.
Form interface
Accountdata like zzaccountdata(structure)
Global definition
wa_accountdata type zzaccountdata (structure).
Latest update.
thanks
Santhosh
‎2005 Jun 08 9:25 PM
Hurray!!! solved the problem. The problem was declaration of the loop in the wrong place.
everything else was fine. I had declared it under the main area (sub node) of the table structure of the main window instead it has to be declared in the loop section of the table structure and not in the sub node.
Thanks a lot jayanti for taking your time off and helping me out.
I have awarded points for all.
Santhosh