on 01-28-2010 12:13 PM
Hi All,
I am creating Smartforms using two tables -- BSID and KNKK.
I've defined KUNNR, DATE1 and DATE2 as Input parameters.
Then, I declared I_BSID as of type BSID and I_KNKK as of type KNKK.
In the Initialization I populated I_BSID as per condition.
But, the problem is -- I_BSID does not get populated.
I think, I'm missing some step.
Can anybody give me the idea of fetching data from two tables.
Thanks.
Kumar Saurav.
Hi,
first see which field is same and primary key for one table for both table...
i think its kunnr ,by using this you can fetch data using select query......
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Yes, KUNNR is in both the table.
I'm using the query for that. Still, none of the I_BSID or I_KNKK is getting populated.
I guess, my problem lies somewhere in declaration part.
Can you please guide me the steps to do declaration.
I followed the following steps --
a) Defined KUNNR
DATE1
DATE2
in Form Interface - Import Tab.
b) In Tables
I_BSID
I_KNKK
c) In Global Defnitions - Initializations Tab
SELECT SINGLE * FROM BSID INTO I_BSID
WHERE KUNNR = KUNNR
AND BUDAT BETWEEN DATE1 AND DATE2.
Other than this, defined Input Parameter in Initialization Tab
KUNNR
I_BSID
DATE1
DATE2
in Output Parameter of Initialization Tab
I_BSID
These are steps, I've followed. Please suggest me as if I am missing anything?
Thanks.
Kumar Saurav.
Hi,
My poblem still persist.
When I'm using data passing in this manner in Initialization --
date = i_bsid-budat.
DocNo = i_bsid-vbeln.
It passes those values and displays one line of records - because, I guess it is like fetching one row from a table. But, when I try to loop at I_BSID , it does not reflect any data in I_BSID. There happens to be 0 records.
I guess, I'm doing some mistake in defining ITAB and Work-area.
I defined I_BSID in Tables Tab of Global Declaration.
Can you please suggest how to declare itab and work-area on this table.
Thanks.
Kumar Saurav.
Hi Kumar,
Is there Tables tab in global declarations also?Which version you are working on?
Assuming: You are trying to declare it_bsid as table in global data and you are trying to fill this internal table in initialization tab.
Try this way:
In global definitions there are tabs with name 'Types' and 'Global data'
In Types Tab:
DATA: IT_BSID type standard table of BSID,
wa_bsid type bsid.
Now in Global data tab declare these variable:
I_BSID type it_bsid
w_bsid type wa_bsid.
Now you can use them in initializing tab code.
I_BSID as tables variable
and w_bsid as workarea.
Let me know if my assumption is not correct
Regards,
Swarna Munukoti
Hi Swarna,
I'm working on SAP ECC 6.0, and yes, there is TABLES Tab in Form Interface.
I'm defining I_BSID in that Tab of Tables as --
I_BSID LIKE BSID
Further, in Import Tab of Form Interface --
KUNNR TYPE KNA1-KUNNR
DATE1 LIKE BSID-BUDAT
Then, in Global definition, in Types Tab --
types: IT_BSID type standard table of BSID,
wa_bsid type bsid.
And, in Initialization Tab --
date2 = sy-datum.
select single * from bsid into i_bsid
where kunnr = kunnr
and budat between date1 and date2.
Now, here is the difference--
when I use --
v_budat = i_bsid-budat.
v_vbeln = i_bsid-vbeln.
v_belnr = i_bsid-belnr.
v_zuonr = i_bsid-zuonr.
This displays one record. But, I need as many as are present.
Then, in Main Window, I used Table and within that table, in Main Area, run a loop at IT_BSID into WA_BSID.
But, data is not getting passed on. It displays nothing. When I debugged, I found that I_BSID is empty.
So, where am I doing some silly mistake...
Please guide.
Thanks.
Kumar Saurav.
Hi Kumar,
When you need multiple records, you should not restrict your select query with single statement in between,
select * from bsid into table i_bsid
where kunnr = kunnr
and budat between date1 and date2.
And as you are populating the table i_bsid in initialization table, remove the declaration from From Interface Tbale tab and keep it is as I explained in my earlier post.
Regards,
Swarna Munukoti
Hi Kumar,
Nick has already written in his earlier post.
Hi,
Sorry, typo in the code
SELECT * FROM BSID INTO table I_BSID
WHERE KUNNR = KUNNR
AND BUDAT BETWEEN DATE1 AND DATE2.
SELECT * FROM KNKK INTO table I_KNKK
WHERE KUNNR = KUNNR.
You are of course filling a table so you need SELECT * INTO TABLE....
Regards,
Nick
Regards,
Swarna Munukoti
if you want to declare those IT as Import parameters fill them in the program that calls the smartform.
if you want to declare those IT as Global Parameters in Smart Forms, do the initialization in Smart Form
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You define your tables in the TABLES table I_BSID and I_KNKK
With 'Like' and not 'type'.
Define I_BSID_LINE Type BSID in the global definitions.
Check that your values that you are importing from your driver program is populating the kunnr , date1 and date2 values.
Because if it is not getting the kunnr,date1 and date2 values your table will not get populated.
Then in the main window take a table ,
In the table in Data tab write
I BSID INTO IBSID_LINE.
in the tables , main area in the text write the field in capital letters &I_BSID_LINE-KUNNR&
You can write the headetrs in the headers.
I hope you will get the values populated properly.
Regards,
Richa Tripathi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Richa,
Thanks for your reply.
Actually, I_BSID is not being populated. I tried as per your suggestion and declared I_BSID_LINE. But, even then, the data is not getting paased on.
Here, I'd like to mention that if I try to print single row of data; it is happening.
Therefore, I can say that it is problem of handling the itab and loop thereon.
Yes, for your doubts, KUNNR, DATE1 and DATE2 are being read by the smartforms program. Only on that basis one line of data is coming up. But, I have to display all possible data -- not restricted to single record obviously.
Guide me further.
Thanks.
Kumar Saurav.
Hi,
There's a lot of information in this post, and rather than try to pick through what you've tried so far let me explain what I think you need to do.
KUNNR, DATE1 and DATE2 declared on the import tab of the form interface as they are currently.
Declare I_BSID in the Global Data tab of the Global Definitions as TYPE TABLE OF BSID. (and I_KNKK in the same way)
In the initialisation tab specify Input Parameters KUNNR, DATE1, DATE2, I_BSID and I_KNKK, in the Output Parameters I_BSID and I_KNKK.
In the code for the initialisation enter;
SELECT * FROM BSID INTO I_BSID
WHERE KUNNR = KUNNR
AND BUDAT BETWEEN DATE1 AND DATE2.
SELECT * FROM KNKK INTO I_KNKK
WHERE KUNNR = KUNNR.
(Note: In your earlier post you used SELECT SINGLE to read BSID, could explain why you're only getting one record!)
You can now use both I_BSID and I_KNKK in Tables or Loops in your smartform.
Regards,
Nick
hi
Delare Form interface--->Import
KUNNR TYPE KUNNR
DATE1 TYPE BUDAT
DATE2 TYPE BUDAT
check i_bsid declaration(It should be in table type)
select BUKRS
KUNNR
from bsid
into table I_BSID
where
kunnr = kunnr
and budat ge DATE1 AND
budat le DATE2.
BREAK-POINT.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.