2008 Jul 25 3:40 PM
hi,
i am passing an internal table to a BADI method as exporting parameter. In the BADI definition i acept it as importing.
i change the value in the internal table, will it be reflected outside the BADI in the calling program ??
what if i select Pass by value in BADI method parameter definition ? in that case, will the changed value be reflected in the calling program ?
thks
2008 Jul 25 4:15 PM
If the pass by value is selected, then what you expected is right.
But, you cannot change the badi method's definition since it is standard.
Regards,
ravi
hi,
i am passing an internal table to a BADI method as exporting parameter. In the BADI definition i acept it as importing.
i change the value in the internal table, will it be reflected outside the BADI in the calling program ??
what if i select Pass by value in BADI method parameter definition ? in that case, will the changed value be reflected in the calling program ?
thks
2008 Jul 25 4:01 PM
Hi,
I don't know how it is in BADI's but I think it is simillar to FORMs, where there are 4 types of passing data objects:
- Pass by reference for USING parameters
For the formal parameters p1 p2 ..., no local data object is created in the subroutine. Instead, when it is called, a reference is passed to the specified actual parameter. A change to the formal parameter in the subroutine also changes the value of the actual parameter.
- Pass by reference for CHANGING parameters
The formal parameters p1 p2 ... are handled exactly like those parameters defined for pass by reference using USING.
- Pass by value for USING parameters
For each formal parameter p1 p2 ..., a local object with the same data type as the corresponding actual parameter is created in the subroutine and filled with its values. A change to the formal parameter in the subroutine does not change the value of the actual parameter. The actual parameter also retains its original value even after the subroutine has ended.
- Pass by value for CHANGING parameters
For each formal parameter p1 p2 ..., a local data object with the same data type as the corresponding actual parameter is created in the subroutine and filled with its values. A change to the formal parameter in the subroutine does not directly change the value of the actual parameter. If the subroutine is ended using ENDFORM, RETURN, CHECK or EXIT however, the content of the formal parameter is assigned to the actual parameter. If the subroutine is ended by a message or an exception, the actual parameter remains unchanged.
Anyhow it would be logical to pass all internal tables via its reference. The system would only need to know address of the table to access it, avoiding to copying large contents.
I hope it will help you,
Marcin
2008 Jul 25 4:15 PM
If the pass by value is selected, then what you expected is right.
But, you cannot change the badi method's definition since it is standard.
Regards,
ravi
2008 Jul 25 4:32 PM
2008 Jul 25 5:24 PM
Pass by value can be extremely inefficient for large data structures and tables, since the system makes a copy of the data instead of just passing an address.
This may be a consideration for performance purposes.
Good luck
Brian