02-03-2009 7:13 PM
Hi Gurus,
Please help me achieve the below task.
I want to write a PERFORM in which i want to pass two internal tables. say it_A and it_B.
Please tell me how to write the code to pass two internal tables.
i have filled both the internal tables before PERFORM .
These two tables should be accessible to me inside the form. Because i want to use this tables data inside FORM and pass to a FM in the FORM-ENDFORM.
i have written the code like below,but not working. please help!
PERFORM display_result USING/TABLES. " Please help to code here to pass two internal table
FORM " Please help to code here
ENDFORM.
I am new to this ABAP codes. Please help.
Thanks & Regards,
Pallavi.
02-03-2009 7:26 PM
Hello,
You could start by using the F1 key to look at the help form FORM and PERFORM.
You might come up with something like:
FORM aForm using itab1 type standard table
itab2 type standard table.
.......
ENDFORM
PERFORM aForm using itab1 itab1.
Regards
Greg Kern
02-03-2009 7:38 PM
Hi Pallavi,
while writing form endform statement use the example given below,
if you dont want any entries to be changed then
form <form_name> using pc_it_a like it_a
pc_it_b like it_b
if you want certain entries of the tables to be changed then you can give the following syntax
form <form_name> changing pc_it_a like it_a
pc_it_b like it_b
regards,
Siddarth
02-04-2009 9:11 AM
Hi,
Syntax for passing the internal table as parameter is
PERFORM <SUBROUTINE> TABLES <intrenal table name>.
FORM <subroutine> TABLES <INTRENAL TABLE> STRUCTURE<NAME OF THE STRUCTURE>.
INTERNAL TABLE IS ALWAYS PASSED BY REFERENCE .
Hope this might help you.
Pooja
Edited by: Pooja Gupta on Feb 4, 2009 10:11 AM
02-04-2009 9:26 AM
hi
declare the internal table global.
h_unicode_errors
wt_error
i used like this in my code.
PERFORM synt_error.
FORM synt_error .
READ TABLE wt_error WITH KEY prog = itab-repname.
IF sy-subrc = 0.
DESCRIBE TABLE h_unicode_errors LINES i.
otab2-name1 = wi_upload-name.
otab2-name = wt_error-prog.
otab2-count1 = 0.
otab2-count2 = i.
APPEND otab2.
ENDIF.
ENDFORM.
02-04-2009 9:32 AM
Hey pallavi ,
Here's a simple prog. to describe how to pass an internal table .
hope it helps!!
tables :
sflight .
types:
begin of type_s_tabex ,
carrid type sflight-carrid ,
connid type sflight-connid ,
end of type_s_tabex .
data :
fs_tabex type type_s_tabex .
data :
t_tabex like standard table of fs_tabex .
append entries here.....
perform tabex TABLES t_tabex .
form tabex TABLES t_tabex .
write :
..........
endform .
This is the example of passing a table as a parameter using 'TABLES' keyword .
But the internal table here should be a table with Header ine .
Regards ,
Amuktha .
02-04-2009 9:56 AM
try this
TYPES: BEGIN OF ty_p1001.
INCLUDE STRUCTURE pa0000.
TYPES: END OF ty_p1001.
TYPES: ty_1001 TYPE TABLE OF ty_p1001.
DATA: it_p1001 TYPE ty_1001,
wa_p1001 LIKE LINE OF it_p1001.
select * from pa0000 into table it_p1001 where pernr lt 10.
perform p0001 using it_p1001.
&----
*& Form P0001
&----
text
----
-->P_IT_P0105 text
----
FORM P0001 USING IT_P1001 type ty_1001.
loop at it_p1001 into wa_p1001.
write wa_p1001-pernr.
endloop.
ENDFORM. " P0001
02-04-2009 10:06 AM
Hi Pallavi,
Internal table passed to any of the Subroutines within the report itself doesn't need any passing mechanisms.
If the internal table is declared and passed among subroutines, the internal table values change accordingly as subjected to the changes in sub-routines.
For example, say SFLIGHT data in an internal table.
DATA:
BEGIN OF fs_sflight,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
price TYPE sflight-price,
END OF fs_sflight,
t_sflight LIKE STANDARD TABLE OF fs_sflight.
SELECT carrid
connid
price
FROM sflight
INTO TABLE t_sflight.
PERFORM change_table.
PERFORM put_table.
FORM change_table .
LOOP AT t_sflight INTO fs_sflight.
fs_sflight-price = sy-uzeit.
MODIFY t_sflight FROM fs_sflight.
ENDLOOP. " LOOP AT T_SFLIGHT INTO FS_FLIGHT
ENDFORM. " FORM CHANGE_TABLE
FORM put_table.
LOOP AT t_sflight INTO fs_sflight.
WRITE:/ fs_sflight-carrid,
fs_sflight-connid,
fs_sflight-price.
ENDLOOP. " LOOP AT T_SFLIGHT INTO FS_FLIGHT
ENDFORM. " FORM PUT_TABLE
In case of changes made to 1 table to be considered in another table or passing data among programs or function modules, then opting for passing mechanisms serves the purpose.
Thankyou,
Zahack.