2018 Dec 27 1:17 PM
Hi All,
Is it possible to call the Function Module in construction operator, like is it possible to make the below as one line?
kind of LW_OUTPUT_H-SL_TEXT = VALUE #( ......... )?
DATA : LT_TEXT TYPE TABLE OF bapisdtehd,.
TRY.
DATA(lw_text) = lt_text[ sd_doc = '1234567890' ].
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = lw_text-text_id
language = sy-langu
name = lw_text-text_name
object = lw_text-applobject
TABLES
lines = lt_tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc = 0.
lw_output_h-sl_text = REDUCE #( INIT x TYPE string
FOR lw_tline IN lt_tline
NEXT x = x && lw_tline-tdline ).
ENDIF.
CATCH cx_sy_itab_line_not_found.
ENDTRY.
2018 Dec 27 1:38 PM
Write a method which calls the function module & returns a value, and call the method inline.
Pseudo-sample:
METHODS my_meth
IMPORTING !iv_import TYPE some_type
RETURNING VALUE(rv_value) TYPE some_type2.
...
METHOD my_meth.
CALL FUNCTION 'MY_FUNC'
EXPORTING
iv_value = iv_import
IMPORTING
ev_value = rv_value.
ENDMETHOD.
...
ls_output-text = CONV #( my_meth( ls_output-something ) ).
2018 Dec 27 1:38 PM
Write a method which calls the function module & returns a value, and call the method inline.
Pseudo-sample:
METHODS my_meth
IMPORTING !iv_import TYPE some_type
RETURNING VALUE(rv_value) TYPE some_type2.
...
METHOD my_meth.
CALL FUNCTION 'MY_FUNC'
EXPORTING
iv_value = iv_import
IMPORTING
ev_value = rv_value.
ENDMETHOD.
...
ls_output-text = CONV #( my_meth( ls_output-something ) ).
2018 Dec 27 4:44 PM
Hi Kerem Koseoglu,
I tried using the Method and calling FM inside method and tried the below ways...
The below is working
lt_tline = fill_text( EXPORTING t_text = lt_text i_docno = lw_header-doc_number ) .
lw_output_h-sl_text = REDUCE #( INIT x TYPE string FOR lw_tline IN lt_tline NEXT x = x && lw_tline-tdline ).The Below is not working, is there any operator I can make use to use in one line? Sorry if my ask is not correct..
lw_output_h-sl_text = REDUCE #( INIT x TYPE string FOR lw_tline IN ...lt_tline... = fill_text( EXPORTING t_text = lt_text i_docno = lw_header-doc_number ) NEXT x = x && lw_tline-tdline ).
2018 Dec 27 4:59 PM
lw_output_h-sl_text =REDUCE #( INIT x TYPE string
FOR lw_tline IN fill_text( t_text = lt_text i_docno = lw_header-doc_number )
NEXT x = x && lw_tline-tdline ).
2018 Dec 27 5:17 PM
Hi Sandra Rossi,
its my mistake to try like ....LW_TLINE IN LT_TLINE = FILL_TEXT...so on..
the way you have sent is working.........Thanks a lot for your reply...
I am changing this thread as Answered..but not sure how to make your comment as answer..
Regards,
VMKumar
2018 Dec 27 6:21 PM
vmohan.kumar you're welcome. I could convert my comment into an answer, but anyway the most important thing for the forum is that your issue and solution are searchable, which is not the case because the title and question don't show the real problem, so probably people won't even look at the answer and comments. Of the importance of being the most precise possible...
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |