2005 Aug 18 12:03 PM
Hello,
i want to convert a Function Module into subroutine.
Can someone give me good tips.
regards
2005 Aug 18 12:27 PM
Hi,
you must'nt use form ... tables...
-> only by internal tables with headerline !
-> if it's e.g. a sorted table you can say:
FORM get_info
using it type sorted table
...
regards Andreas
2005 Aug 18 12:07 PM
You just have to copy paste the code.
For the parameters use :
using " for input parameters
changing " for export parameters
tables " for table
Regards,
Erwan.
2005 Aug 18 12:23 PM
Erwan,
your tips are very useful,
pls explain one thing , how to declare variables which are under tab 'Tables'.
regards
2005 Aug 18 12:28 PM
perform form_routine tables itable using p1 p2 p3 changing p4.
*--------------
form form_routine tables structure t_table
using p1 p2 p3
changing p4.
....
endform.
2005 Aug 18 12:29 PM
perform form_routine tables itable using p1 p2 p3 changing p4.
*--------------
form form_routine tables structure t_table
using p1 p2 p3
changing p4.
....
endform.
2005 Aug 18 12:34 PM
i think my confusion is still there.
let me explain
say in FM , under tab 'Tables' i have
itab like dbstr.
so when converting this FM to subroutine , i will capture all source code of FM in Form.. Endform.
And i will declare import and export variables globally.
but how to declare these tables?
should i declare them as:
data itab like dbstr occurs 0 with header line.
please clarify .
regard.
2005 Aug 18 12:10 PM
i am little confused.
in a FM we declare tables under 'Tables' tab.
they refer to either a dbtable or structure.
what i want to know that all these new declaration we do in this tab say
manc like str.
is this same as:
data: manc like str occurs 0 with header line.
please if someone can clarify me on this.
regards
2005 Aug 18 12:14 PM
No,
In fact you use :
perform form_routine tables itable.
....
*--------------------
* Form_routine
*--------------------
form from_routine tables itab structure t_mara.
...
endform.Hope it helps,
Erwan.
2005 Aug 18 12:11 PM
Hi,
You can do this by converting the FM's import and export parameters to Changing and using and paste the code of the FM in the body of the subroutine. But can i know why you want to do this??
Cheers,
Sam
2005 Aug 18 12:19 PM
i want to convert cause some BAPI's of 4.6c don't exist in 4.0B , and i also don't want to create more function group.
regards.
2005 Aug 18 12:27 PM
Hi,
you must'nt use form ... tables...
-> only by internal tables with headerline !
-> if it's e.g. a sorted table you can say:
FORM get_info
using it type sorted table
...
regards Andreas
2005 Aug 18 12:35 PM
Andreas can you explain in detail
you must'nt use form ... tables...
-> only by internal tables with headerline !
regards
2005 Aug 18 12:37 PM
in other words in want to know that when we declare a table in FM under tab 'Tables' is it default internal table with header line or what....?
regards
2005 Aug 18 12:54 PM
In a FM, you can declare both ( i table with header line or 'table type ..' )
2005 Aug 18 1:10 PM
Erwan,
in the FM it is declared as
PARAMETER LIKE BAPIPARAM
so when creating subroutine, i should declare it how.
data PARAMETER LIKE BAPIPARAM.
or
data PARAMETER LIKE BAPIPARAM occurs 0.
or
PARAMETER LIKE BAPIPARAM occurs 0 with header line.
pls clarify
regards
2005 Aug 18 1:41 PM
Hi,
try that:
DATA param TYPE TABLE OF bapiparam.
DATA wa TYPE bapiparam.
PERFORM form1 USING param wa.
FORM form1 USING par TYPE table wa type bapiparam.
LOOP AT par INTO wa.
ENDLOOP.
ENDFORM.Andreas
2005 Aug 18 1:44 PM
BAPIPARAM is a structure containning sveral fields ( PARID, PARVA, PARTXT ).
So I suggest you to declare like this :
data : begin of parameter.
include structure bapiparam.
data : end of parameter.or
data : parameters type bapiparam.It should work...
Erwan.
2005 Aug 18 1:54 PM
so Erwan u mean that there is no need to declare them as internal table, is that ok ?
regards
2005 Aug 18 2:00 PM
YES.
If, in your actual FM/BAPI this is an input parameter, this is just a flat structure.
Not a internal table.
Regards,
Erwan.
2005 Aug 18 3:29 PM
Hello Erwan,
sorry to say but you were wrong, Andreas is right, i have to declare it as internal table
regards.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |