2007 Jun 15 7:29 AM
hi adept's,
the work we are doing with local we can also do with the using and changing the what is the use of local then
plz clear me.
2007 Jun 15 7:32 AM
Hi,
LOCAL will not create any new data.
LOCAL can only be used with already declared GLOBAL data mostly using (TABLES statement).
So dont get confused that LOCAL creates a new local variable.
USING and CHANGING are for passing parameter, when you use USING you pass some data, and when you use CHANGING you pass and return some data.
Where as LOCAL will not bring in any data to FORM and it will not RETURN any data out of form, its just acts as a local variable.
<b>You cannot write LOCAL for any non global data, check it out.</b>
Regards,
Sesh.
.
hi adept's,
the work we are doing with local we can also do with the using and changing the what is the use of local then
plz clear me.
2007 Jun 15 7:31 AM
Hi
The Form :
/:PERFORM CDE_CENT IN PROGRAM ZKRPMM_PERFORM_Z1MEDRUCK
/:USING &EKKO-EBELN&
/:CHANGING &CDECENT&
/:ENDPERFORM
The report :
REPORT zkrpmm_perform_z1medruck .
DATA : BEGIN OF it_input_table OCCURS 10.
INCLUDE STRUCTURE itcsy.
DATA : END OF it_input_table.
déclaration de la table output_table contenant les
variables exportées
DATA : BEGIN OF it_output_table OCCURS 0.
INCLUDE STRUCTURE itcsy.
DATA : END OF it_output_table.
DATA : w_ebeln LIKE ekko-ebeln,
w_vbeln LIKE vbak-vbeln,
w_zcdffa LIKE vbak-zcdffa.
*----
*
FORM CDE_CENT
*
*----
*
FORM cde_cent TABLES input output.
it_input_table[] = input[].
it_output_table[] = output[].
READ TABLE it_input_table INDEX 1.
MOVE it_input_table-value TO w_ebeln.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = w_ebeln
IMPORTING
output = w_ebeln.
SELECT SINGLE zcdffa FROM ekko
INTO w_zcdffa
WHERE ebeln = w_ebeln.
it_output_table-name = 'CDECENT'.
MOVE w_zcdffa TO it_output_table-value.
MODIFY it_output_table INDEX 1.
output[] = it_output_table[].
ENDFORM.
Regards,
Sree
2007 Jun 15 7:31 AM
Hi,
The LOCAL statement is used to prevent the global data object from being changed inside a subroutine..
Check this link for details..
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db983935c111d1829f0000e829fbfe/content.htm
Thanks
Naren
2007 Jun 15 7:31 AM
Hi,
Form Syntax is
<b>PERFORM <subr> [USING ... <pi>... ]
[CHANGING... <pi>... ].</b>
We use only USING and CHANGING with the perform, we can create the Local Variables with in the FORM and ENDFORM, whatever we create the variables with in this the Variable life will be with in that FORM and ENDFORM only
Regards
Sudheer
2007 Jun 15 7:32 AM
Hi
See the doc on PERFORM..USING..CHANGING
PERFORM - parameter_list
Syntax
... [TABLES itab1 itab2 ...]
[USING a1 a2 ...]
[CHANGING a1 a2 ...].
Extras:
1. ... TABLES itab1 itab2 ...
2. ... USING a1 a2 ...
3. ... CHANGING a1 a2 ...
Effect
These additions assign actual parameters to the formal parameters from the parameter interface for the subroutine subr. You can specify all data objects whose data type matches the typing of the corresponding formal parameter (see Check Typing) as actual parameters. Each formal parameter assumes all the properties of the actual parameter assigned to it when it is called.
Addition 1
... TABLES itab1 itab2 ...
Effect
If you specify the addition TABLES, each table parameter t1 t2 ... for the subroutine called that is defined with the addition TABLES to the FORM statement must be assigned an internal table itab as the actual parameter. The assignment of the actual parameters to the formal parameters takes place using their positions in the lists t1 t2 ... and itab1 itab2 ... .
You can only specify standard tables for itab. Transfer takes place by means of a reference. If a specified table itab has a header line, this is also transferred; otherwise, the header line in the corresponding table parameter t is blank when it is called.
Note
Use of table parameters in the interface for subroutines is obsolete but a large number of subroutines have not yet been converted to appropriately typed USING or CHANGING parameters, so that they must still be supplied with data by the TABLES addition to the PERFORM statement.
Example
Static call of the internal subroutine select_sflight transferring a table parameter.
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.
...
FORM select_sflight TABLES flight_tab LIKE sflight_tab
USING f_carr TYPE sflight-carrid
f_conn TYPE sflight-connid.
SELECT *
FROM sflight
INTO TABLE flight_tab
WHERE carrid = f_carr AND
connid = f_conn.
ENDFORM.
Addition 2
... USING a1 a2 ...
Addition 3
... CHANGING a1 a2 ...
Effect
If you specify the additions USING and CHANGING, an actual parameter a1 a2 ... of the appropriate type must be assigned to each of the formal parameters u1 u2 ... and c1 c2 ... defined with the same additions to the FORM statement. The actual parameters specified after USING and CHANGING form one shared list. They are assigned to the formal parameters after the position in the shared list. The type of parameter transfer is defined with the additions USING and CHANGING to the FORM statement. The addition USING must be before CHANGING. Otherwise, the assignment of the actual parameters to the additions USING and CHANGING is irrelevant to the PERFORM statement. It is also irrelevant whether only one or both of the additions is specified.
Notes
For the sake of program documentation, we advise that you specify the additions USING and CHANGING in the FORM statement according to the definition of the parameter interface.
In non-Unicode programs, you can address memory area outside an actual parameter if an actual parameter a1 a2 ... is assigned offset or length specifications. In non-Unicode programs, the length is set to the length of the current parameter if an offset is specified without a length. Both of these lead to warnings in the syntax check and to syntax errors in Unicode programs. The rules for the ASSIGN statement apply to the addressable memory area in non-Unicode programs as well.
Example
The following five PERFORM statements mean the same but only the fourth is recommended, since it is the only one that documents the interface of the subroutine called.
DATA: a1 TYPE string,
a2 TYPE string,
a3 TYPE string,
a4 TYPE string.
PERFORM test USING a1 a2 a3 a4.
PERFORM test CHANGING a1 a2 a3 a4.
PERFORM test USING a1 CHANGING a2 a3 a4.
PERFORM test USING a1 a2 CHANGING a3 a4.
PERFORM test USING a1 a2 a3 CHANGING a4.
...
FORM test USING p1 TYPE string
p2 TYPE string
CHANGING value(p3) TYPE string
value(p4) TYPE string.
...
ENDFORM.
Reward points for useful Answers
Regards
Anji
2007 Jun 15 7:32 AM
Hi,
The LOCAL key word if for whatever values changed inside the subroutine will not reflect outside the subroutine..
Regards,
Padmam.
2007 Jun 15 7:32 AM
Hi,
LOCAL will not create any new data.
LOCAL can only be used with already declared GLOBAL data mostly using (TABLES statement).
So dont get confused that LOCAL creates a new local variable.
USING and CHANGING are for passing parameter, when you use USING you pass some data, and when you use CHANGING you pass and return some data.
Where as LOCAL will not bring in any data to FORM and it will not RETURN any data out of form, its just acts as a local variable.
<b>You cannot write LOCAL for any non global data, check it out.</b>
Regards,
Sesh.
.