2010 Oct 21 4:49 PM
Hi,
I wrote the code like this .I am trying to use FORM which is defined in Report programm,But I am always getting error
message "Error at parameter 2 ":what change should i do for this. earlier I used the same code in ABAP ( not ABAP OO) it was working.
First Programm :
DATA : l_t_OTIFARR TYPE STANDARD TABLE OF /bic/aYO_SID0100,
w_table_to_be_read(30) type c.
w_table_to_be_read = '/bic/aYO_SID0100'.
perform READ_ODS in program YBW1_OTIF__SI_INCLUDES
tables SOURCE_PACKAGE
l_t_OTIFARR
using w_table_to_be_read.
****** REPPORT with FORM Definition
REPORT YBW1_OTIF__SI_INCLUDES.
FORM READ_ODS
TABLES SOURCE_PACKAGE structure /BIC/CS8YO_IGORD
l_t_ODS type TABLE
USING TABLE_TO_BE_READ TYPE C.
refresh l_t_ODS.
select * from (TABLE_TO_BE_READ) into table l_t_ODS
for all entries in SOURCE_PACKAGE
where /bic/ynv_order = SOURCE_PACKAGE-/bic/ynv_order.
ENDFORM.Titled modified and code tags added by: kishan P on Oct 22, 2010 10:47 AM
2010 Oct 24 12:53 PM
Hi Mandtha,
just leave the TYPE TABLE addition:
FORM READ_ODS
TABLES SOURCE_PACKAGE structure /BIC/CS8YO_IGORD
l_t_ODS
USING TABLE_TO_BE_READ TYPE C.TABLES parameters are used to pass references to tables. The only addition that makes sense is 'STRUCTURE'. As you want it generic, just don not use it.
Or use CHANGING to make it more readable:
FORM READ_ODS
USING
SOURCE_PACKAGE
TABLE_TO_BE_READ TYPE tabname.
CHANGING
ct_table type TABLE.
FIELD-SYMBOLS:
<SOURCE_PACKAGE> TYPE /BIC/CS8YO_IGORD
ASSIGN SOURCE_PACKAGE to <SOURCE_PACKAGE>.
refresh ct_table.
select * from (TABLE_TO_BE_READ) into table ct_table
for all entries in SOURCE_PACKAGE
where /bic/ynv_order = <SOURCE_PACKAGE>-/bic/ynv_order.
ENDFORM.Regards,
Clemens
Hi,
I wrote the code like this .I am trying to use FORM which is defined in Report programm,But I am always getting error
message "Error at parameter 2 ":what change should i do for this. earlier I used the same code in ABAP ( not ABAP OO) it was working.
First Programm :
DATA : l_t_OTIFARR TYPE STANDARD TABLE OF /bic/aYO_SID0100,
w_table_to_be_read(30) type c.
w_table_to_be_read = '/bic/aYO_SID0100'.
perform READ_ODS in program YBW1_OTIF__SI_INCLUDES
tables SOURCE_PACKAGE
l_t_OTIFARR
using w_table_to_be_read.
****** REPPORT with FORM Definition
REPORT YBW1_OTIF__SI_INCLUDES.
FORM READ_ODS
TABLES SOURCE_PACKAGE structure /BIC/CS8YO_IGORD
l_t_ODS type TABLE
USING TABLE_TO_BE_READ TYPE C.
refresh l_t_ODS.
select * from (TABLE_TO_BE_READ) into table l_t_ODS
for all entries in SOURCE_PACKAGE
where /bic/ynv_order = SOURCE_PACKAGE-/bic/ynv_order.
ENDFORM.Titled modified and code tags added by: kishan P on Oct 22, 2010 10:47 AM
2010 Oct 22 6:04 AM
Hi Mandha,
I think, FORM parameters
- without type or
- of type ANY or
- of type (ANY) TABLE
are not possible in OO context.
You need real types also for tables.
Try to give the real structure for l_t_ODS and I think it will work!
Regards,
Klaus
2010 Oct 22 7:53 AM
hi,
Here I gave l_t_ods of type table , as i want to use the same FORM for reading different table and fill it .table which are read
will change based on value of w_table_to_be_read.
Regards
mandha
2010 Oct 22 8:13 AM
Hello Mandha
I have tried testing your coding within a local class and a FORM routine within the same report and it has worked on ECC 6.0.
Not sure about the context (4.6c? Global class?) in your case.
What you could do is to write a function module which executes the PERFORM statement. This fm you then call within your method.
Regards
Uwe
2010 Oct 22 8:55 AM
Hi Uwe,
Yes within same report ti works fine for me also.
Actually My context , is I wrote the first part PERFORM in BI Transforamtions and FORM.. END FORM in a report programm.
Regards
mandha
2010 Oct 22 9:34 AM
For me syntatically it looks ok, but I would try replacing tables with changing . Also it would be more descriptive if you provided full error message and when you receive it - during syntax check or runtime?
Regards
Marcin
2010 Oct 22 10:37 AM
Hi ,
Its runtime error :
error msg is : The attempt to call the subroutine READ_ODS in the program &PROGRAM& failed due to a type error involving parameter number 2
mandhaa
2010 Oct 22 2:02 PM
This is not an OO problem, and your contention that it works fine in an non-OO context I find hard to believe.
You have:
FORM READ_ODS
TABLES SOURCE_PACKAGE structure /BIC/CS8YO_IGORD
l_t_ODS type TABLESo you are saying that you've got a table that you're calling SOURCE_PACKAGE, which has a line type of /BIC/CS8YO_IGORD, and a table you're calling l_t_ODS, which has a line type of table.
Do you see the discrepency?
When you call the form, a table with a line type that's a STANDARD TABLE is expected. Which is a bit odd really... A table of tables?
Change the code to
FORM READ_ODS
TABLES SOURCE_PACKAGE structure /BIC/CS8YO_IGORD
USING l_t_ODS type TABLE
TABLE_TO_BE_READ TYPE C.for example.
2010 Oct 22 3:03 PM
2010 Oct 22 3:54 PM
I was wrong about the parameters not working. I didn't spot the TYPE keyword.
I've tested the idea that it's an OO problem, and still can't see that it is. With the following, I get no problem.
data : l_t_otifarr type standard table of t100,
w_table_to_be_read(30) type c.
data: source_package type standard table of t000.
*----------------------------------------------------------------------*
* CLASS tst DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class tst definition.
public section.
class-methods: main.
endclass. "tst DEFINITION
*----------------------------------------------------------------------*
* CLASS tst IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class tst implementation.
method main.
select * from t100 up to 10 rows into table l_t_otifarr.
w_table_to_be_read = 'T100'.
perform read_ods in program ymabitest1
tables source_package
l_t_otifarr
using w_table_to_be_read.
endmethod. "main
endclass. "tst IMPLEMENTATION
start-of-selection.
tst=>main( ).YMABITEST1.
*&---------------------------------------------------------------------*
*& Form READ_ODS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->SOURCE_PACKAGE text
* -->L_T_ODS text
* -->TABLE_TO_BE_READ text
*----------------------------------------------------------------------*
form read_ods
tables source_package structure t100
l_t_ods type table
using table_to_be_read type c.
endform.Edited by: Matt on Oct 22, 2010 4:57 PM
2010 Oct 22 4:09 PM
I suspect your problem may be caused, because in BI 7.0, in start routines, the source_package is defined differently from how it is in BI 3.5.
In your form, you give SOURCE_PACKAGE as having structure /BIC/CS8YO_IGORD. Verifiy that the fields of /bic/cs8yo_igord exactly match those defined in the start routine.
matt
2010 Oct 22 4:55 PM
Hello Matt,
Thank you very much for your effort to help.Yes you are right , i used this same code in BW3.5,it was OK but now I am trying to use in BI 7,but its not working.
But I am not seeing the error for SOURCE_PACKAGE. error msg is : The attempt to call the subroutine READ_ODS in the program &PROGRAM& failed due to a type error involving parameter number 2. And i Code the parameter 2 is l_T_OTIFARR.
"
2010 Oct 22 6:33 PM
>
> The attempt to call the subroutine READ_ODS in the program &PROGRAM& failed due to a type error involving parameter number 2. And i Code the parameter 2 is l_T_OTIFARR.
>
> "
Yes, I know that. There is a possibility, you know, that you've got more than one error! You may well have an issue in any case because you can no longer use the type of the communication structure. ( Which is a big deal when it comes to taking the ABAP out of a routine into a proper ABAP object like a subroutine pool, class or function module ).
Have you checked and made sure they are EXACTLY the same structure?
Have you tried my earlier suggestion, changing the parameters of the form, so you have two under USING and one under TABLES.
It's all very well looking at the proposals and going "oh, it's not that". But have you actually tried? As a developer with over 20 years experience, I can tell you that sometimes the error messages you get are misleading or even entirely wrong. You are attempting to marry object oriented technology with the old external call of forms functionality. I'm not surprised you're having trouble.
One other tip. Every now and then, restart RSA1, regenerate the transformation and DTP. Sometimes the generation screws up.
2010 Oct 24 12:53 PM
Hi Mandtha,
just leave the TYPE TABLE addition:
FORM READ_ODS
TABLES SOURCE_PACKAGE structure /BIC/CS8YO_IGORD
l_t_ODS
USING TABLE_TO_BE_READ TYPE C.TABLES parameters are used to pass references to tables. The only addition that makes sense is 'STRUCTURE'. As you want it generic, just don not use it.
Or use CHANGING to make it more readable:
FORM READ_ODS
USING
SOURCE_PACKAGE
TABLE_TO_BE_READ TYPE tabname.
CHANGING
ct_table type TABLE.
FIELD-SYMBOLS:
<SOURCE_PACKAGE> TYPE /BIC/CS8YO_IGORD
ASSIGN SOURCE_PACKAGE to <SOURCE_PACKAGE>.
refresh ct_table.
select * from (TABLE_TO_BE_READ) into table ct_table
for all entries in SOURCE_PACKAGE
where /bic/ynv_order = <SOURCE_PACKAGE>-/bic/ynv_order.
ENDFORM.Regards,
Clemens
2010 Oct 24 9:38 PM
>
> Hi Mandtha,
>
> just leave the TYPE TABLE addition:
>
>
FORM READ_ODS > TABLES SOURCE_PACKAGE structure /BIC/CS8YO_IGORD > l_t_ODS > USING TABLE_TO_BE_READ TYPE C.>
> TABLES parameters are used to pass references to tables. The only addition that makes sense is 'STRUCTURE'. As you want it generic, just don not use it.
>
The syntax FORM form TABLE tab TYPE tab_type is valid, certainly in the latest version. However, the use of TABLES is discouraged now - it is only kept for backward compatability. With the introduction of table types into the ABAP Dictionary, USING and CHANGING are all that are required. As Mandha Kranthi is working on BI 7.0, I think we can safely assume he's on fairly recent ABAP release!
I disagree that omitting TYPE TABLE is a good idea. Even if the type is generic, it's worth putting it in. TYPE TABLE on its own, by the way, is a generic STANDARD TABLE. The generic type covering all tables is ANY TABLE. But types should be specified as specifically as possible. See my blog on [type safety.|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/11938] [original link is broken] [original link is broken] [original link is broken];
2010 Dec 16 10:13 AM
Hi,
Sorry for late late late feedback.
Yes its works when i remove the 'TYPE TABLE'.
And I am using like that.
Regards
Mandha
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |