01-15-2009 6:36 AM
Hi All,
I have an issue with PERFORM - FORM statement .I have declared the subroutine with the PERFORM stmt and the corresponding FORM subroutine has been generated.Below is the code.
But i get a syntax error in the FORM saying out_buf2 is not defined using DATA statement.
I am not getting what is the problem in this code as i have already decaled the OUT_BUF2.
Any insight into the same will be very helpful.
TYPES: BEGIN OF out_buf1 ,
return_flag(1),
po_date(8),
po_no(15),
ship_to(10),
material(18),
description(40),
sec_no(10),
sec_line(5) TYPE n,
po_qty(6),
spg_qty(6),
pdg_qty(6),
status(20),
etd(8),
part_status(2),
END OF out_buf1.
*swati
DATA: out_buf2 TYPE TABLE OF out_buf1.
PERFORM display_all_pending_quot TABLES out_buf2
USING sales_org in_buf-from_date in_buf-to_date.
&----
*& Form DISPLAY_ALL_PENDING_QUOT
&----
text
----
-->P_OUT_BUF2 text
-->P_SALES_ORG text
-->P_IN_BUF_FROM_DATE text
-->P_IN_BUF_TO_DATE text
----
form display_all_pending_quot tables p_out_buf2 structure out_buf2
using p_sales_org
p_in_buf_from_date
p_in_buf_to_date.
endform. " DISPLAY_ALL_PENDING_QUOT
Thanks in advance.
01-15-2009 6:42 AM
Hi Swathi,
Try the declaration as given below.
TYPES: BEGIN OF out_buf1 ,
" fields
END OF out_buf1.
TYPES: ty_t_out_buf2 TYPE STANDARD TABLE OF out_buf1.
DATA: out_buf2 TYPE ty_t_out_buf2.
PERFORM display_all_pending_quot CHANGING out_buf2
USING sales_org in_buf-from_date in_buf-to_date.
form display_all_pending_quot changing p_out_buf2 type ty_t_out_buf2
using p_sales_org
p_in_buf_from_date
p_in_buf_to_date.
endform. " DISPLAY_ALL_PENDING_QUOT
The above given syntax works.
Best Regards,
Ram.
01-15-2009 6:43 AM
Hi Swathi,
The below code should help you solve the syntax error.
Use the below code.
form display_all_pending_quot tables p_out_buf2
using p_sales_org
p_in_buf_from_date
p_in_buf_to_date.
endform. " DISPLAY_ALL_PENDING_QUOT
Regards
Sayee
01-15-2009 6:48 AM
hi,
try to give like this....
PARAMETERS: p_carr TYPE sflight-carrid,
p_conn TYPE sflight-connid.
DATA sflight_tab TYPE STANDARD TABLE OF sflight.
...
PERFORM select_sflight TABLES sflight_tab
USING p_carr p_conn.
...
********Change the form syntax as per this code
FORM select_sflight TABLES flight_tab LIKE sflight_tab
USING f_carr TYPE sflight-carrid
regards
vijay
f_conn TYPE sflight-connid.
01-15-2009 6:51 AM
Hi Swati,
Declare one table type:
DATA: ty_out_buf2 type out_buf1.
Then use it in form:
form display_all_pending_quot tables p_out_buf2 type ty_out_buf2.
Regards,
Nitin.
01-15-2009 6:59 AM
Hello Swati,
You can do an F1 and check the documentation for STRUCTURE.
with the additon STRUCTURE instead of typing, where struc must be a program-local structure (data object, no data type)
You can declare a Data Object use with STRUCTURE addition.
DATA: ST_BUF1 TYPE OUT_BUF1.
DATA: OUT_BUF2 TYPE TABLE OF OUT_BUF1.
PERFORM DISPLAY_ALL_PENDING_QUOT
TABLES OUT_BUF2
USING SALES_ORG
V_DAT1 V_DAT2.
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALL_PENDING_QUOT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_OUT_BUF2 text
* -->P_SALES_ORG text
* -->P_V_DAT1 text
* -->P_V_DAT2 text
*----------------------------------------------------------------------*
FORM DISPLAY_ALL_PENDING_QUOT TABLES P_OUT_BUF2 STRUCTURE ST_BUF1
USING P_SALES_ORG
P_V_DAT1
P_V_DAT2.
ENDFORM. " DISPLAY_ALL_PENDING_QUOT
FYI STRUCTURE is an obsolete addition
BR,
Suhas
@ Nitin:
Declare one table type:
DATA: ty_out_buf2 type out_buf1.
This is not a table type, its a data object. You define table type using TYPES stmt.
01-15-2009 7:21 AM
Check out the following examples for passing itab and using tables.
As you have created an itab namely out_buf2, you need not use tables, you can go for changing or using. And your form stmt can be :
form display_all_pending_quot changing p_out_buf2 like out_buf2
using p_sales_org
p_in_buf_from_date
p_in_buf_to_date.
Try this as using Tables is not a good idea.
The TABLES parameter is only supported for the sake of compatibility.
Hope this helps
Example of Passing Internal Tables
-
REPORT demo_mod_tech_example_5.
DATA: BEGIN OF line,
col1 TYPE i,
col2 TYPE i,
END OF line.
DATA itab LIKE STANDARD TABLE OF line.
PERFORM fill CHANGING itab.
PERFORM out USING itab.
FORM fill CHANGING f_itab LIKE itab.
DATA f_line LIKE LINE OF f_itab.
DO 3 TIMES.
f_line-col1 = sy-index.
f_line-col2 = sy-index ** 2.
APPEND f_line TO f_itab.
ENDDO.
ENDFORM.
FORM out USING value(f_itab) LIKE itab.
DATA f_line LIKE LINE OF f_itab.
LOOP AT f_itab INTO f_line.
WRITE: / f_line-col1, f_line-col2.
ENDLOOP.
ENDFORM.
This produces the following output:
1 1
2 4
3 9
You can define the types of the formal parameters of the parameter interface of procedures as internal tables. In the example, the subroutines fill and out each have one formal parameter defined as an internal table. An internal table without header line is passed to the subroutines. Each subroutine declares a work area f_line as a local data object. Were itab a table with a header line, you would have to replace itab with itab[] in the PERFORM and FORM statements.