Dynamic ITAB in function module parameter
Hi
How to define in FM dynamic internal table returning some values in.
For example I want to call FM with any internal table structure and FM must return fill in ITAB.
I got it.
I added type standard table to parameter.
Similar Messages
-
Can I add special character "$" in the function module parameter name??
Hi Friends
Can I add special character "$" in the function module parameter name??
awaiting for your reply,
Regards
Praveen>
prashanth kishan wrote:
> Thomas,
> ... What if Praveen passes the $ parameter in that unknown FM and suddenly theres smoke coming from the rear of the CPU? Who's answerable to that??
>
> pk
Blame Canada! -
Dynamic Actions with Function Module
Hai all,
I got a problem while doing Dynamic Actions. I want to delete a record from 0105 infotype and it is through dynamic actions using function module. All things going correct but in the database table the entry was not deleted. While debugging it was giving as deleted but actually it is not deleting in database table. I hope u help me out.
Thanks,
Tara.Hai Srimantra,
Thanks for ur response and here iam sending the code where i used the function module. and i called the subroutine from sm30.
I should not use any sql statements or commands to delete the records from database tabels. hope u will help me out.
Thank u,
Tara.
TABLES p0105.
*data: lw_0105 type p0105.
TABLES: pspar.
*& Form HR_INFOTYPE_OPERATION
text
FORM hr_infotype_operation.
DATA: l_it_pa0105 TYPE STANDARD TABLE OF pa0105.
DATA: l_it_p0105 TYPE STANDARD TABLE OF p0105.
DATA: l_p0105 TYPE p0105.
DATA: wa_pa0105 TYPE pa0105.
DATA: l_return TYPE bapireturn1.
break developer.
SELECT SINGLE * FROM pa0105 INTO CORRESPONDING FIELDS OF l_p0105
WHERE pernr EQ p0105-pernr AND
subty EQ p0105-subty AND
begda EQ p0105-begda AND
endda EQ p0105-endda AND
seqnr EQ p0105-seqnr AND
objps EQ p0105-objps AND
sprps EQ p0105-sprps.
CHECK sy-subrc EQ 0.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '0105'
number = l_p0105-pernr
subtype = l_p0105-subty
objectid = l_p0105-objps
lockindicator = l_p0105-sprps
validityend = l_p0105-endda
validitybegin = l_p0105-begda
recordnumber = l_p0105-seqnr
record = l_p0105
operation = 'DEL'
TCLAS = 'A'
NOCOMMIT =
VIEW_IDENTIFIER =
SECONDARY_RECORD =
IMPORTING
return = l_return.
KEY =
MESSAGE l_return-message TYPE 'S'.
ENDFORM. "HR_INFOTYPE_OPERATION -
Structure of Dynamic Table in Function Module
Hi,
I'm trying to find a way to get as OUTPUT a dynamic Table from a Function Module.
I declared a table called T_DATA without a type.
And this table should have a dynamic table back.
The problem that I get the data back but, I only found a data without any field-elements.
The data is there but there's no structure, no table.
Is there any way that I can send the Data in a proper structure?Hi
Try using the following code
type-pools:slis.
data:it_fcat type lvc_t_fcat,
wa_fcat type lvc_s_fcat,
itab type ref to data.
data:it_fcat1 type slis_t_fieldcat_alv,
wa_fcat1 like line of it_fcat1.
data:cl_tab type ref to cl_alv_table_create,
wa_ref type ref to data.
field-symbols:<itab> type table,
<wa> type any,
<comp>.
create object cl_tab.
refresh:it_fcat.
wa_fcat-fieldname = 'NAME'.
wa_fcat-inttype = 'C'.
wa_fcat-intlen = '10'.
wa_fcat1-fieldname = 'NAME'.
wa_fcat1-inttype = 'C'.
wa_fcat1-intlen = '10'.
append wa_fcat to it_fcat.
append wa_fcat1 to it_fcat1.
wa_fcat-fieldname = 'NAME2'.
wa_fcat-datatype = 'CHAR10'.
wa_fcat1-fieldname = 'NAME2'.
wa_fcat1-datatype = 'CHAR10'.
append wa_fcat to it_fcat.
append wa_fcat1 to it_fcat1.
cl_alv_table_create=>create_dynamic_table(
exporting
I_STYLE_TABLE = I_STYLE_TABLE
it_fieldcatalog = it_fcat
I_LENGTH_IN_BYTE = I_LENGTH_IN_BYTE
importing
ep_table = itab
E_STYLE_FNAME = E_STYLE_FNAME
EXCEPTIONS
GENERATE_SUBPOOL_DIR_FULL = 1
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
assign itab->* to <itab>.
create data wa_ref like line of <itab>.
assign wa_ref->* to <wa>.
do.
assign component 'NAME' of structure <wa> to <comp>.
<comp> = 'AA'.
unassign <comp>.
assign component 'NAME2' of structure <wa> to <comp>.
<comp> = 'AB'.
insert <wa> into table <itab>.
exit.
enddo.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME = I_STRUCTURE_NAME
I_BACKGROUND_ID = ' '
I_GRID_TITLE = I_GRID_TITLE
I_GRID_SETTINGS = I_GRID_SETTINGS
IS_LAYOUT = IS_LAYOUT
it_fieldcat = it_fcat1
IT_EXCLUDING = IT_EXCLUDING
IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS
IT_SORT = IT_SORT
IT_FILTER = IT_FILTER
IS_SEL_HIDE = IS_SEL_HIDE
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT = IS_VARIANT
IT_EVENTS = IT_EVENTS
IT_EVENT_EXIT = IT_EVENT_EXIT
IS_PRINT = IS_PRINT
IS_REPREP_ID = IS_REPREP_ID
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS = IT_ALV_GRAPHICS
IT_HYPERLINK = IT_HYPERLINK
IT_ADD_FIELDCAT = IT_ADD_FIELDCAT
IT_EXCEPT_QINFO = IT_EXCEPT_QINFO
IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER
IMPORTING
E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER
ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER
tables
t_outtab = <itab>
EXCEPTIONS
PROGRAM_ERROR = 1
Regards -
Passing dynamic table to function module
Hi all,
actully i have to pass dynamic internal table from function module.
for that i use syntax
move <dyn_table> to data_tab.
but now my question is that in fm parameters what is the type spec & associated type for data_tab in fm parameters.
regards,
anujHi
Good
Here is a simple example of passing an internal table "itab" to a function module "REUSE_ALV_LIST_DISPALY".
It displays the internal table data into a list format.
data : itab like ztest213 occurs 0 with header line.
tables : ztest213 .
select * from ztest213 into table itab.
loop at itab.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
i_structure_name = 'ztest213'
IS_LAYOUT =
IT_FIELDCAT =
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IR_SALV_LIST_ADAPTER =
IT_EXCEPT_QINFO =
I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = itab
exceptions
program_error = 1
others = 2
if sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endloop.
Thanks
mrutyun^ -
Dynamic Table Selection function module
Dear Friends,
We have got critical requirement on Custom BAPI function module :
we have to pass one field name of table and table name : Eg (Matnr and MARC).
we have to get table contents w.r.t field name of table and table : Has to display MARC based on Matnr.
(It is something like we display table contents in SE11 and SE16, Our requirement is to get the data by giving random field name of table and table name ).
My View : Imports Tab of F.M of is static
Tables Tab of F.M could be dynamic....if so how to achieve or any other approach?
Note : Eg1 : Matnr and MARA (Input to F.M) -
> Get MARA contents (Table from F.M)
Eg2 : Matnr and MARC (Input to F.M) -
> Get MARC contents (Table from F.M)
Eg3 : Lifnr and LFA1 (Input to F.M) -
> Get LFA1 contents (Table from F.M)
Eg1 : Ebeln and EKKO (Input to F.M) -
> Get EKKO contents (Table from F.M)
Awaiting for positive and quick views.
Regards
SekharDear Sarcevic,
I have created zfunction module with imports and tables.
I'm able to manage import parameters as dynamical, but tables declaration gives fuzzy.
How do we make tables tab declaration in function module as dynamic? any other views?
Regards
Sekhar -
Any example to import and export itab to function module
hi all,
as the table parameter in function module is obsolete, please advise an example on how to pass in an internal table
and return back the result in an internal table as well.
for example, i have itab1 and itab2. By using table parameters i got the following code. Please advise alternative way by using import and export.
""Local Interface:
*" TABLES
*" itab1 STRUCTURE Zitab1
*" itab2 STRUCTURE Zitab2
loop at itab1 into wa_itab.
**do some logic here to assign value to itab2 and return.
wa_itab2-a = xxx .
wa_itab2-b = xxx.
append wa_itab2 to itab2.
endloop.
thank you.hi,
suppose you have two structure name struc1 and struc2.
create table type zitab1 & 2 for both.
please do the following:
""Local Interface:
*" IMPORTING
*" VALUE(itab1) TYPE Zitab1
*" EXPORTING
*" VALUE(itab2) TYPE Zitab2
you can avoid to use the obsolete table parameters as well as LIKE in function module creation.
cheers -
Select options to Function Module parameter
Hello,
I have a select options parameter in my report and then I have a function module that have to select into a database table using this SO.
How can I pass the SO to the FM?
The code must be something like that:
REPORT ZXXXX.
SELECT-OPTIONS: so_werks FOR marc-werks.
CALL FUNCTION 'ZFUNCTION'
FUNCTION ZFUNCTION
SELECT matnr FROM marc INTO TABLE it
WHERE werks IN so_werks
The select options must be a TABLES parameter? I have to create a structure type for that SO?Hi,
In FM interface you can use
structure EFG_RANGES ( In Tables Parameter ) . This structure is same as select options.
Or in Importing parameters use EFG_TAB_RANGES . This is an internal table type .
In both ways you can pass your select option to FM diretcly.
Check the following link as well
https://forums.sdn.sap.com/click.jspa?searchID=11071891&messageID=4908310
Regards,
Raj. -
Dynamic parameters in function module
Hi. I need to write a program that can call various different function modules based on what the user inputs.
For example, if the user chooses "BAPI_USER_GET_DETAIL" I need to then call that function module. There is a list of about 30 functions they can choose from.
I can read in the function interface using FUNCTION_IMPORT_INTERFACE and have got the import, changing and tables parameters being entered in an editable ALV.
Now I just need to work out how to call the function module.
I could spend ages hard coding all the various combinations, but what I would like to do is call the function totally dynamically.
I know this wouldn't work, but this sort of thing:
CALL FUNCTION p_funct
EXPORTING
<imp_1> = <val_1>
<imp_2> = <val_2>.
Has anyone got any ideas?
Thanks a lot,
Dave.Hi. I think you've solved it, thanks a lot.
Just checking it all now, will be back shortly.
Can't believe it was that simple, spent ages looking through SDN and google. I was searching for dynamic function, not bapi, so I missed that posting too.
Regards,
Dave. -
Dynamic calling of Function Modules
Hi,
I have the requirement that I have to call the Function Modules dynamcally in my program. i m creating 9 function modules in my developemt and I m maintaining all this function modules in one of the custom table I m creating whicth the part of development please help me.
Thanks&Regards
Uday KiranHi Suhas,
The reference types will not be applicable as you said,
what i think is the abap_func_parmbind in type pool abap is use.
just by appending all the signatures into it
and the passing it to a fm created.
check the standard include LV69AF21, how the fm's PRICING_SUBSCREEN_PBO and PRICING_SUBSCREEN_PAI gets called.
The signatures in each fm are different. -
Dynamic call to Function module.
Hi
In one of the program, we have found a FM ' rfc_update_taxes_doc', and which does not has any code,
but what i think that this Fm is called dynamically from some prog and is calling external system.
As it has 'targt server' in importing parameters.
So can anybody tell me if this is the way we call to External system.
And please if anyone can tell me the real meaning of calling a Fm dynamically.
Please dont provide links.
Thanks and Regards
ManuHi Manu,
You can try with this example. I connect Bussiness system with R/3 system, because I need R/3 table in Bw system.
IF SY-SYSID EQ 'BWD'. "SYSID = Name sap system
D_DESTINATION = 'DESD47020'.
ELSEIF SY-SYSID EQ 'BWC'.
D_DESTINATION = 'DESW47420'.
ELSEIF SY-SYSID EQ 'BWP'.
D_DESTINATION = 'DESP47420'.
ENDIF.
CAMPOS-FIELDNAME = 'MANDT'.
CAMPOS-OFFSET = '000000'.
CAMPOS-LENGTH = '000003'.
CAMPOS-FIELDTEXT = 'Mandant'.
APPEND CAMPOS.
CLEAR CAMPOS.
CAMPOS-FIELDNAME = 'BUKRS'.
CAMPOS-OFFSET = '000004'.
CAMPOS-LENGTH = '000004'.
CAMPOS-FIELDTEXT = 'Society'.
APPEND CAMPOS.
CLEAR CAMPOS.
CALL FUNCTION 'RFC_READ_TABLE' DESTINATION D_DESTINATION
EXPORTING
QUERY_TABLE = 'TZBZ'
* DELIMITER = ' '
* NO_DATA = ' '
* ROWSKIPS = 0
* ROWCOUNT = 0
TABLES
OPTIONS = OPTIONS1
FIELDS = CAMPOS
DATA = DATOS
* EXCEPTIONS
* TABLE_NOT_AVAILABLE = 1
* TABLE_WITHOUT_DATA = 2
* OPTION_NOT_VALID = 3
* FIELD_NOT_VALID = 4
* NOT_AUTHORIZED = 5
* DATA_BUFFER_EXCEEDED = 6
* OTHERS = 7
That's all.
About the real meaning of calling a FM dynamically could be something like that because
you can generate the call dynamically to just call with the needed parameters (you can change
the parameters).
types: begin of s_codigo,
Lines type string,
End of s_codigo.
Data: it_codigo type standard table of s_codigo with header line.
APPEND 'Title.' TO it_codigo.
APPEND 'form Calculate_sum.' TO it_codigo.
APPEND 'call function ''RFC FUNCTION ''' TO it_codigo.
APPEND 'destination ''D_DESTINATION''' TO it_codigo.
APPEND 'exporting PARAM1 = ''2''' TO it_codigo.
APPEND 'PARAM2 = IT_TABLE ' TO it_codigo.
APPEND 'importing PARAM_I1 = RESULT.' TO it_codigo.
APPEND 'endform.' TO it_codigo.
DATA prog_name LIKE sy-cprog.
DATA resultado(1) TYPE c.
GENERATE SUBROUTINE POOL it_codigo NAME prog_name.
PERFORM Calculate_sum IN PROGRAM (prog_name) CHANGING nok.
Best regards .
Ana -
Dynamic internal table+function module
Hi guys,
I need a help.Could u plz tell me how to pass a field symbol contexts inside an export parameter?
Points will be rewarded for helpful answers....Hi,
You can use the TYPE TABLE in the exporting parameters..If you use TABLE it assumes an internal table.
Ex..
ITAB TYPE TABLE
Thanks
naren -
Hi ,
i am using BAPI_ACC_DOCUMENT_POST to post accounting document. This accounting document is used to post amount from reconcilation account to bank GL account.the table parameter am using is ACCOUNTGL (in the function module)Now i want to give posting keys to the function module parameter. can anyone please guide me how to give posting keys?
Edited by: Santhosh Kumar Cheekoti on Dec 18, 2008 7:48 AMHi,
As pointed out in one of the previous post, posting key will be decided by the BAPI depending on the sign of the amount. Have a look at bthe following code:-
DATA: doc_header LIKE BAPIACHE09,
criteria LIKE BAPIACKEC9 OCCURS 0 WITH HEADER LINE,
doc_item LIKE BAPIACGL09 OCCURS 0 WITH HEADER LINE,
doc_ar LIKE BAPIACGL09 OCCURS 0 WITH HEADER LINE,
doc_values LIKE BAPIACCR09 OCCURS 0 WITH HEADER LINE,
return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
extension1 like BAPIACEXTC occurs 0 with header line,
obj_type LIKE bapiache08-obj_type,
obj_key LIKE bapiache02-obj_key,
obj_sys LIKE bapiache02-obj_sys,
docnum LIKE bkpf-belnr.
*DATA:
* ITEMNO_ACC POSNR_ACC
* FIELDNAME FIELDNAME
* CHARACTER ACPI_RKE_CRIGEN
* Fill Document Header
doc_header-bus_act = 'RFBU'.
doc_header-bus_act = 'RMRP'.
*doc_header-bus_act = 'SD00'.
doc_header-username = sy-uname.
doc_header-header_txt = 'TEST BOC BAPI POSTING'.
doc_header-comp_code = 'IN10'.
doc_header-compo_acc = 'FICA'.
doc_header-doc_date = '20060127'.
doc_header-pstng_date = sy-datlo.
doc_header-doc_type = 'SA'.
** Fill Line 1 of Document Item
*doc_item-itemno_acc = '1'.
*doc_item-gl_account = '0000500001'.
*doc_item-pstng_date = sy-datum.
*doc_item-item_text = 'TEST POSTING DEBIT ITEM'.
*doc_item-costcenter = ''.
*doc_item-quantity = '1'.
*doc_item-base_uom = 'ST'.
*APPEND doc_item.
*CLEAR doc_item.
** Fill Line 2 of Document Item
*doc_item-itemno_acc = '2'.
*doc_item-customer = '0000000016'.
*doc_item-gl_account = '0000000016'.
*doc_item-pstng_date = sy-datlo.
*doc_item-item_text = 'TEST POSTING CREDIT ITEM'.
*APPEND doc_item.
*CLEAR doc_item.
doc_ar-itemno_acc = '1'.
doc_ar-gl_account = '0000500001'.
doc_ar-pstng_date = sy-datum.
doc_ar-item_text = 'TEST POSTING DEBIT ITEM'.
doc_ar-costcenter = ''.
doc_ar-quantity = '1'.
doc_ar-base_uom = 'ST'.
APPEND doc_ar.
CLEAR doc_ar.
* Fill Line 2 of Document Item
doc_ar-itemno_acc = '2'.
doc_ar-customer = '0000000016'.
doc_ar-gl_account = '0000000016'.
doc_ar-pstng_date = sy-datlo.
doc_ar-item_text = 'TEST POSTING CREDIT ITEM'.
doc_ar-stat_con = ' '.
doc_ar-costcenter = '0000201681'.
APPEND doc_ar.
CLEAR doc_ar.
* Fill Line 1 of Document Value.
doc_values-itemno_acc = '1'.
doc_values-currency_iso = 'INR'.
doc_values-amt_doccur = '200.00'.
doc_values-currency = 'INR'.
doc_values-CURR_TYPE = '00'. "Doc currency
APPEND doc_values.
CLEAR doc_values.
* Fill Line 2 of Document Value
doc_values-itemno_acc = '2'.
doc_values-currency_iso = 'INR'.
doc_values-amt_doccur = '200.00-'.
doc_values-currency = 'INR'.
doc_values-curr_type = '00'. "Doc currency
APPEND doc_values.
CLEAR doc_values.
* Add tax code in extension1 table.
extension1-field1 = 'BAPI CALL'.
APPEND EXTENSION1.
* Fill CRITERIA for CO-PA
*refresh criteria.
*criteria-ITEMNO_ACC = '1'.
*criteria-FIELDNAME = 'ARTNR'.
*criteria-CHARACTER = '000000000001312251'.
*Append criteria.
*criteria-ITEMNO_ACC = '1'.
*criteria-FIELDNAME = 'WERKS'.
*criteria-CHARACTER = 'IN91'.
*Append criteria.
*criteria-ITEMNO_ACC = '1'.
*criteria-FIELDNAME = 'KNDNR'.
*criteria-CHARACTER = '0000000016'.
*Append criteria.
*criteria-ITEMNO_ACC = '1'.
*criteria-FIELDNAME = 'FKART'.
*criteria-CHARACTER = 'ZIN2'.
*Append criteria.
*criteria-ITEMNO_ACC = '1'.
*criteria-FIELDNAME = 'KAUFN'.
*criteria-CHARACTER = '0000000633'.
*Append criteria.
*criteria-ITEMNO_ACC = '1'.
*criteria-FIELDNAME = 'KDPOS'.
*criteria-CHARACTER = '000010'.
*Append criteria.
*criteria-ITEMNO_ACC = '1'.
*criteria-FIELDNAME = 'VKGRP'.
*criteria-CHARACTER = '009'.
**Append criteria.
* All tables filled - now call BAPI.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
EXPORTING
documentheader = doc_header
IMPORTING
OBJ_TYPE = doc_header-obj_type
OBJ_KEY = doc_header-obj_key
OBJ_SYS = doc_header-obj_sys
TABLES
* criteria = criteria
accountgl = doc_item
ACCOUNTRECEIVABLE = doc_ar
currencyamount = doc_values
return = return
EXTENSION1 = EXTENSION1.
LOOP AT return WHERE type = 'E'.
EXIT.
ENDLOOP.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = doc_header
IMPORTING
OBJ_TYPE = doc_header-obj_type
OBJ_KEY = doc_header-obj_key
OBJ_SYS = doc_header-obj_sys
TABLES
* criteria = criteria
accountgl = doc_item
currencyamount = doc_values
return = return
EXTENSION1 = EXTENSION1.
LOOP AT return WHERE type = 'E'.
EXIT.
ENDLOOP.
IF sy-subrc EQ 0.
WRITE: / 'BAPI call failed - debug and fix!'.
ELSE.
CLEAR return.
REFRESH return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
IMPORTING
return = return.
WRITE: / 'BAPI call worked!!'.
WRITE: / doc_header-obj_key, ' posted'.
ENDIF.
Regards
Raju Chitale
Edited by: Raju Chitale on Dec 18, 2008 8:31 AM -
How to find the names of Function Module used in the program
Hi all,
can you people help me with this issue.I want to the names of all the Function Module used in the program along with their parameters into an internal table.It will be helpful for your suggestions.
Kind Regards,
Edited by: Prasenjit Sengupta on Nov 20, 2008 7:39 AMTake structure of internal table as
TYPES : BEGIN OF TY_FM,
FUNCNAME TYPE RS38L_FNAM, "Name of Function Module
PARAMETER TYPE RS38L_PAR_, "Parameter name
PARAMTYPE TYPE RS38L_KIND, " Parameter type
R3STATE TYPE R3STATE, "ABAP: Program Status (Active, Saved, Transported...)
STRUCTURE TYPE RS38L_TYP, "Associated Type of an Interface Parameter
DEFAULTVAL TYPE RS38L_DEFO,"Default value for import parameter
REFERENCE TYPE RS38L_REFE, "Call by reference
OPTIONAL TYPE RS38L_OPTI, "Optional parameters
TYPE TYPE RS38L_TYPE, "Reference Structure is an ABAP/4 Type
END OF TY_FM.
DATA : IT_FM TYPE TABLE OF TY_FM WITH HEADER LINE. -
Dynamic Function Module call with table parameter?
Hi All,
I'm trying to call FMs dynamically with PARAMETER-TABLE. These FMs are mainly about searching data from inputs and returning internal table as outputs. I managed to pass data into import parameters as query conditions, but still failed to set tables parameter. The code is like below, could you please help me check what's the problem? Thank you very much!!
data: lv_val type RS38L_TYP value 'ls_service_para-fmparam'.
data: lt_interface TYPE rsfbintfv,
ls_import_para TYPE rsfbpara,
ptab TYPE abap_func_parmbind_tab,
ptab_line TYPE abap_func_parmbind,
ref_wa type ref to data.
Field-symbols: <fs> type any,
CALL METHOD cl_fb_function_utility=>meth_get_interface
EXPORTING
im_name = LV_FM "FM name
IMPORTING
ex_interface = lt_interface
EXCEPTIONS
error_occured = 1
object_not_existing = 2
OTHERS = 3.
***loop IMPORT parameters and fill in data from lt_params***
loop at lt_interface-import into ls_import_para.
read table lt_params into ls_param with key key = ls_import_para-parameter. "check if exists query value
if sy-subrc = 0 and ls_param-value is not initial.
assign (lv_val) to <fs>.
<fs> = ls_param-value.
create data ref_wa type (ls_import_para-STRUCTURE).
assign ref_wa->* to <fs2>.
<fs2> = <fs>. UNASSIGN: <fs>,<fs2>.
ptab_line-name = ls_import_para-PARAMETER.
ptab_line-value = ref_wa.
ptab_line-kind = abap_func_exporting.
insert ptab_line into table ptab.
endif.
endloop.
***loop at TABLE parameters to retrieve data from FM***
loop at lt_interface-TABLES into ls_import_para.
create data ref_wa type (ls_import_para-STRUCTURE).
ptab_line-tables_wa = ref_wa. "set data type
ptab_line-name = ls_import_para-PARAMETER.
ptab_line-kind = abap_func_tables.
insert ptab_line into table ptab. "if commented, no exception occurs,but I cannot get any dataset.
endloop.
CALL FUNCTION LV_FM PARAMETER-TABLE ptab.
if I execute the code, when there has TABLES parameter defined in the FM, I get CX_SY_DYN_CALL_PARAM_MISSING exception with runtime error DATREF_NOT_ASSIGNED. But in debug mode, as shown in the screen shot attached, I did see the field TABLES_WA has correct type. So maybe I misunderstand the usage of PARAMETER-TABLE. Does anyone has experience on it?
Best Regards,
JeffHi Rama,
Yes, I'm not passing value to the table parameter, but that parameter is where I want to retrieve data from FM, not pass value to, so I don't assign any value to ptab_line-value for that parameter.
BTW, I just did some test to pass value to the parameter using the following code and still got CALL_FUNCTION_PARM_MISSING exception:
FM: ZLEAD_CONTACT
parameters:
IMPORT: I_PARTNER TYPE BUT000-PARTNER mandatory
TABLES: OT_CONT LIKE ZLEAD_INFO_S optional (here ZLEAD_INFO_S is a flat structure)
ptab_line-name = ls_import_para-PARAMETER.
ptab_line-kind = abap_func_tables.
create data ref_type type table of (ls_import_para-STRUCTURE).
ptab_line-tables_wa = ref_wa.
ptab_line-value = ref_type.
The detail of ptab:
VALUE
TABLES_WA
KIND
NAME
->2000000025
{A:initial}
10
2000000025
->Standard Table[0x10(588)]
->Structure: flat & not charlike
30
OT_CONT
And the same error if I set parameter using below code:
create data ref_wa type RS38L_TYP.
assign ref_wa->* to <fs>.
<fs> = ls_import_para-STRUCTURE.
ptab_line-tables_wa = ref_wa.
The detail of ptab:
VALUE
TABLES_WA
KIND
NAME
->2000000025
{A:initial}
10
2000000025
->Standard Table[0x10(588)]
->ZLEAD_INFO_S
30
OT_CONT
Regards,
Jeff
Maybe you are looking for
-
Missing Scroll Bar from Applications Folder in Dock
When I click the Applications Folder from the Dock in the Grid format, the scrollbar is missing. The only way to "scroll down," to other apps is by pressing the up/down arrow keys, in which the vertical bar briefly pops up but then disappears (no arr
-
Hi, I have maintain two vendor groups one for domestic and another for international vendors . By mistakable international vendor created domestic vendor group and postings happened for quite some after that user find that mistake . how to change e
-
How to run a program in background?
Hi abapers, I want to run a program in background using sm36 and sm37.But i am not aware of input in that tansaction.So kindly tell me the steps ho run a program in background. Regards Ansuman
-
Do I need a sub-query and getting ORA-00937 error
I'm writing a query where I want returned all data that is in a list 510 and all duplicate entries for the AID are eliminated. select * from entities e where e.list_id in (select aid from entities e where e.list_id = 510 having count(e.aid) > 1); Whe
-
Delivery address in bapi_po_getdetail
Hi friends, i am using a BAPI(BAPI_po_getdetail) to display PO details in this i am not able to find out the delivery address. can any one tell me in which structure and filed where i can get directly the delivery address instead of plant and storag