2009 Jun 30 5:28 PM
HI all,
i need to call this Fm for 5 times,
my question is instead of calling to the Fm 5 times one by one there is way to do
that better (nicer) ,i don't want to use perform.
e.g.
lv_domain_name = 'DATFM'.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = iv_table_name
langu = sy-langu
lfieldname = iv_domain_name
TABLES
fixed_values = lt_domain_values
EXCEPTIONS
not_found = 1
internal_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
Implement suitable error handling here
ENDIF.
lv_domain_name = 'DCPFM'.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = iv_table_name
langu = sy-langu
lfieldname = iv_domain_name
TABLES
fixed_values = lt_domain_values
EXCEPTIONS
not_found = 1
internal_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
Implement suitable error handling here
ENDIF.
and so on...for 5 times
Best Regards
Nina
2009 Jun 30 5:43 PM
You can go for use macro for this.
DEFINE macro_call_fm.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = &1 "(iv_table_name)
langu = &2 " (sy-langu)
lfieldname = &3 " (iv_domain_name)
TABLES
fixed_values = lt_domain_values
EXCEPTIONS
not_found = 1
internal_error = 2
OTHERS = 3.
IF sy-subrc 0.
Implement suitable error handling here
ENDIF.
END-OF-DEFINITION.
macro_call_fm: iv_table_name sy-langu iv_domain_name.
.
.
.
HI all,
i need to call this Fm for 5 times,
my question is instead of calling to the Fm 5 times one by one there is way to do
that better (nicer) ,i don't want to use perform.
e.g.
lv_domain_name = 'DATFM'.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = iv_table_name
langu = sy-langu
lfieldname = iv_domain_name
TABLES
fixed_values = lt_domain_values
EXCEPTIONS
not_found = 1
internal_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
Implement suitable error handling here
ENDIF.
lv_domain_name = 'DCPFM'.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = iv_table_name
langu = sy-langu
lfieldname = iv_domain_name
TABLES
fixed_values = lt_domain_values
EXCEPTIONS
not_found = 1
internal_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
Implement suitable error handling here
ENDIF.
and so on...for 5 times
Best Regards
Nina
2009 Jun 30 5:34 PM
Hi Nina,
Create a perform and call the FM in the perform
lv_domain_name = 'DATFM'.
Perform_get using lv_domain_name.
clear : lv_domain_name
lv_domain_name = 'DCPFM'.
Perform_get using lv_domain_name.
clear : lv_domain_name.
and so on 5 times......
FORM_get using lv_domain_name.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = iv_table_name
langu = sy-langu
lfieldname = iv_domain_name
TABLES
fixed_values = lt_domain_values
EXCEPTIONS
not_found = 1
internal_error = 2
OTHERS = 3.
IF sy-subrc 0.
* Implement suitable error handling here
ENDIF.
ENDFORM.Hope this will resolves your query.
Regards,
Manish
Edited by: Manish Bisht on Jun 30, 2009 6:34 PM
2009 Jun 30 5:35 PM
Put the values of iv_domain_name into an intrnal table and then loop through the table calling the FM each time.
Rob
2009 Jun 30 5:36 PM
Hi,
itab-domain_name = 'DATFM'. Append ITab.
itab-domain_name = 'DCPFM'. Append ITab.
LOOP AT ITAB.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = iv_table_name
langu = sy-langu
lfieldname = itab-domain_name
TABLES
fixed_values = lt_domain_values
EXCEPTIONS
not_found = 1
internal_error = 2
OTHERS = 3.
IF sy-subrc 0.
* Implement suitable error handling here
ENDIF.
ENDLOOP.
2009 Jun 30 5:37 PM
You can check below sample, Or you can prepare an internal table using changing parameters and call function in loop statement.
TYPE-POOLS abap.
DATA: line TYPE c LENGTH 80,
text_tab LIKE STANDARD TABLE OF line,
filename TYPE string,
filetype TYPE c LENGTH 80,
fleng TYPE i.
DATA: func TYPE string,
ptab TYPE abap_func_parmbind_tab,
ptab_line TYPE abap_func_parmbind,
etab TYPE abap_func_excpbind_tab,
etab_line TYPE abap_func_excpbind.
func = 'GUI_DOWNLOAD'.
filename = 'c:\temp\text.txt'.
filetype = 'ASC'.
ptab_line-name = 'FILENAME'.
ptab_line-kind = abap_func_exporting.
GET REFERENCE OF filename INTO ptab_line-value.
INSERT ptab_line INTO TABLE ptab.
ptab_line-name = 'FILETYPE'.
ptab_line-kind = abap_func_exporting.
GET REFERENCE OF filetype INTO ptab_line-value.
INSERT ptab_line INTO TABLE ptab.
ptab_line-name = 'DATA_TAB'.
ptab_line-kind = abap_func_tables.
GET REFERENCE OF text_tab INTO ptab_line-value.
INSERT ptab_line INTO TABLE ptab.
ptab_line-name = 'FILELENGTH'.
ptab_line-kind = abap_func_importing.
GET REFERENCE OF fleng INTO ptab_line-value.
INSERT ptab_line INTO TABLE ptab.
...
etab_line-name = 'OTHERS'.
etab_line-value = 10.
INSERT etab_line INTO TABLE etab.
CALL FUNCTION func
PARAMETER-TABLE
ptab
EXCEPTION-TABLE
etab.
CASE sy-subrc.
WHEN 1.
...
...
ENDCASE.
2009 Jun 30 8:27 PM
HI Gungorj ,
the solution u suggest is without doing loop on the FM or i had to do loop also?
Best Regards
Nina
Edited by: Nina C on Jun 30, 2009 10:51 PM
Edited by: Nina C on Jul 1, 2009 7:06 AM
2009 Jul 01 6:12 AM
2009 Jun 30 5:43 PM
You can go for use macro for this.
DEFINE macro_call_fm.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = &1 "(iv_table_name)
langu = &2 " (sy-langu)
lfieldname = &3 " (iv_domain_name)
TABLES
fixed_values = lt_domain_values
EXCEPTIONS
not_found = 1
internal_error = 2
OTHERS = 3.
IF sy-subrc 0.
Implement suitable error handling here
ENDIF.
END-OF-DEFINITION.
macro_call_fm: iv_table_name sy-langu iv_domain_name.
.
.
.
2009 Jun 30 8:26 PM
HI Raj ,
the solution u suggest is without doing loop on the FM or i had to do loop also?
Best Regards
Nina
2009 Jun 30 9:57 PM
I will suggest instead of calling this fm make a select from table DD01L and DD01T
or make a select on table view DD03M
a®
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |