12-14-2012 7:19 AM
I have used the IF/ElSE statement to get data in an Internal Table say ITAB1 on base of some parameters. If ITAB1 IS NOT INITIAL it will PERFORM FORM_FILL.
FORM_FILL takes the ITAB1 data and filters it on certain parameters, and READ TABLE is done to get data from other tables. I want to know the method of passing the ITAB1 data to the FORM_FILL subroutine.
How can I do this?
Moderator Message - Basic ABAP syntax question. Thread locked.
Message was edited by: Suhas Saha
12-14-2012 7:22 AM
Hi,
You can write like this..
Declare itab1 globally. and write like below.
PERFORM FORM_FILL using itab1.
Regards
Ram
12-14-2012 7:43 AM
hi,
If your using FM declare lit(internal table ) in top include,,,,
for local internal table use TABLES to pass internal table.
perform update_table tables lit .
form update_table tables lit structure ztt.
ztt should be type of lit. if standerd structure not there you have to create zstructure.
regards.
Lingaraj.
12-14-2012 7:51 AM
If you want to use local variables, it is better to use USING/CHANGING instead of TABLES. TABLES is an old way of passing internal tables.
12-14-2012 8:00 AM
Hi,
Suppose the structure name is ty_itab, internal table name is t_itab1. Table Type is tty_itab1.
TYPES: tty_itab1 TYPE STANDARD TABLE of ty_itab.
PERFORM FORM_FILL CHANGING t_itab1.
FORM FORM_FILL CHANGING t_itab1 type tty_itab1.
*-- Business Logic
ENDFORM.
Regards,
Debopriya Ghosh
12-14-2012 8:08 AM
Hi Das,
Check the below code.
Perfrom TEST_FORM TABLES ITAB
USING WA.
In the Form----EndForm the code will be like this.
FORM TEST_FORM TABLES P_ITAB
USING P_WA.
-----------------Your Code-------------------
ENDFORM.
Remember the only Rule is whenever you are using TABLES Parameter in the PERFORMs it should be the First One later you can add USING , CHANGING etc.. Hope this helps.
12-14-2012 8:54 AM
Sesha solution is the near one. I don't want to use global declaration.
12-14-2012 9:25 AM
SELECT ZBSDV ZINDV VKBUR KUNNR ZMODEL AUART VBELN AUDAT BNDDT FROM VBAK INTO TABLE IT_VBAK
WHERE AUDAT IN P_DAT AND AUART = P_AUART.
ENDIF.
IF IT_VBAK IS NOT INITIAL.
PERFORM FILL_FINAL TABLES IT_VBAK USING WA_VBAK.
FORM FILL_FINAL TABLES IT_VBAK USING WA_VBAK.
*********** code***************
ENDFORM.
Gives error data object "WA_VBAK" has no structure and therefore no component called BNDDT
12-14-2012 9:37 AM
Hi Das,
Check the below code and try it will work. Hope this helps
PERFORM FILL_FINAL TABLES IT_VBAK USING WA_VBAK.
FORM FILL_FINAL TABLES IT_VBAK
USING P_WA_VBAK Like WA_VBAK.
*********** code***************
* Here you use the P_WA_VBAK as WA_VBAK.
ENDFORM.
12-14-2012 8:43 AM
Hello Soumen,
Do you want to just pass internal table to refer in routine or you want to make changes. If it global declaration that you can use it directly without passing it in form routine. If still you need to access thru routine then check below logic
PERFORM FORM_FILL TABLES t_itab1.
***************************************************
FORM FORM_FILL TABLES t_itab1.
*.............
Logic
............
ENDFORM.
regards,
Deepti
12-14-2012 9:26 AM
Options for you:-
FORM subroutine CHANGING pi_table LIKE i_table
FORM subroutine TABLES pi_table TYPE STANDARD TABLE
FORM subroutine TABLES pi_table STRUCTURE dictionary_structure
FORM subroutine CHANGING pi_table TYPE table_type
12-14-2012 9:33 AM
Hi Souman
If your table data needs to be modified or changed and gets returned from the subroutine then you can use:
Perform Form_fill changing itab1.
Form Form_fill changing ITAb1 type <type of itab1>.
....
.....
ENDFORM.
or if you simply wants to pass the data from data from table :
use value instead of changing.
regards
vaibhav