FUNCTION zsd_output_format_date.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(IV_CONTRACT_NO) TYPE VBELN_VAUF
*" REFERENCE(IV_COUNTRY_KEY) TYPE LAND1
*" REFERENCE(IV_ITEMNO) TYPE POSNR OPTIONAL
*" EXPORTING
*" REFERENCE(ES_FORMATTED_DATES) TYPE
*" ZST_SD_OUTPUT_FORMATTED_DATES
*"----------------------------------------------------------------------
*FM to format the contract validity dates
IF iv_itemno IS INITIAL.
SELECT SINGLE vbegdat, venddat FROM veda INTO @DATA(ls_veda) WHERE vbeln = @iv_contract_no
AND vposn = '000000'.
ELSE.
SELECT SINGLE vbegdat, venddat FROM veda INTO @ls_veda WHERE vbeln = @iv_contract_no
AND vposn = @iv_itemno.
ENDIF.
IF ls_veda-vbegdat IS NOT INITIAL AND ls_veda-venddat IS NOT INITIAL.
es_formatted_dates-start_date = zcl_fi_outputs_utility=>format_date( iv_land1 = iv_country_key iv_date = ls_veda-vbegdat ).
es_formatted_dates-end_date = zcl_fi_outputs_utility=>format_date( iv_land1 = iv_country_key iv_date = ls_veda-venddat ).
ENDIF.
ENDFUNCTION.
METHOD format_date.
SET COUNTRY iv_land1.
rv_result = |{ iv_date DATE = ENVIRONMENT }|.
ENDMETHOD.
Step 4: Parameter mapping in Procedure from BRF= Function to ABAP FM
METHOD _get_description_from_brf.
CONSTANTS:lc_function_id TYPE if_fdt_types=>id VALUE '005056A5F0F91EEBA0DFD379B4AB5FE1'.
DATA:lv_timestamp TYPE timestamp,
lt_name_value TYPE abap_parmbind_tab,
ls_name_value TYPE abap_parmbind,
lr_data TYPE REF TO data,
lx_fdt TYPE REF TO cx_fdt,
ls_doc_header TYPE vbdkr,
lr_it_document_items TYPE REF TO data,
lr_vbkdr_line TYPE REF TO data,
lv_language TYPE if_fdt_types=>element_text.
FIELD-SYMBOLS: <ls_any> TYPE any,
<lt_document_items> TYPE STANDARD TABLE.
****************************************************************************************************
* All method calls within one processing cycle calling the same function must use the same timestamp.
* For subsequent calls of the same function, we recommend to use the same timestamp for all calls.
* This is to improve the system performance.
****************************************************************************************************
* If you are using structures or tables without DDIC binding, you have to declare the respective types
* by yourself. Insert the according data type at the respective source code line.
****************************************************************************************************
GET TIME STAMP FIELD lv_timestamp.
****************************************************************************************************
* Process a function without recording trace data, passing context data objects via a name/value table.
****************************************************************************************************
* Prepare function processing:
****************************************************************************************************
* Let BRFplus convert your data into the type BRFplus requires:
* Data object is bound to a DDIC type, so you can improve performance by passing a variable of that type.
* If you pass a variable of this type, you should indicate this by passing "abap_true" for parameter "iv_has_ddic_binding".
****************************************************************************************************
ls_name_value-name = 'IS_DOC_HEADER'.
GET REFERENCE OF ms_header_billing_print INTO lr_data.
cl_fdt_function_process=>move_data_to_data_object( EXPORTING ir_data = lr_data
iv_function_id = lc_function_id
iv_data_object = '005056A5F0F91EDBA0DFDA48F5688028' "IS_DOC_HEADER
iv_timestamp = lv_timestamp
iv_trace_generation = abap_false
iv_has_ddic_binding = abap_true
IMPORTING er_data = ls_name_value-value ).
INSERT ls_name_value INTO TABLE lt_name_value.
****************************************************************************************************
* Let BRFplus convert your data into the type BRFplus requires:
****************************************************************************************************
ls_name_value-name = 'IT_DOCUMENT_ITEMS'.
CREATE DATA lr_it_document_items TYPE vbdpr_tt.
ASSIGN lr_it_document_items->* TO <lt_document_items>.
CREATE DATA lr_vbkdr_line TYPE vbdpr.
ASSIGN lr_vbkdr_line->* TO FIELD-SYMBOL(<ls_data_line>).
LOOP AT mt_items_print ASSIGNING FIELD-SYMBOL(<ls_items>).
ASSIGN COMPONENT 'VBDPR' OF STRUCTURE <ls_items> TO FIELD-SYMBOL(<ls_vbdpr>).
IF sy-subrc = 0.
<ls_data_line> = <ls_vbdpr>.
APPEND <ls_data_line> TO <lt_document_items>.
ENDIF.
ENDLOOP.
lr_data = lr_it_document_items.
cl_fdt_function_process=>move_data_to_data_object( EXPORTING ir_data = lr_data
iv_function_id = lc_function_id
iv_data_object = '005056A5F0F91EDBA0DFE94C0CE5E031' "IT_DOCUMENT_ITEMS
iv_timestamp = lv_timestamp
iv_trace_generation = abap_false
iv_has_ddic_binding = abap_false
IMPORTING er_data = ls_name_value-value ).
INSERT ls_name_value INTO TABLE lt_name_value.
****************************************************************************************************
ls_name_value-name = 'IV_LANGUAGE'.
GET REFERENCE OF mv_spras INTO lr_data.
ls_name_value-value = lr_data.
INSERT ls_name_value INTO TABLE lt_name_value.
****************************************************************************************************
* Create the data to store the result value after processing the function
* You can skip the following call, if you already have
* a variable for the result. Please replace also the parameter
* EA_RESULT in the method call CL_FDT_FUNCTION_PROCESS=>PROCESS
* with the desired variable.
****************************************************************************************************
cl_fdt_function_process=>get_data_object_reference( EXPORTING iv_function_id = lc_function_id
iv_data_object = '_V_RESULT'
iv_timestamp = lv_timestamp
iv_trace_generation = abap_false
IMPORTING er_data = lr_data ).
ASSIGN lr_data->* TO <ls_any>.
TRY.
cl_fdt_function_process=>process( EXPORTING iv_function_id = lc_function_id
iv_timestamp = lv_timestamp
IMPORTING ea_result = rt_result"<ls_any>
CHANGING ct_name_value = lt_name_value ).
CATCH cx_fdt INTO lx_fdt.
****************************************************************************************************
* You can check CX_FDT->MT_MESSAGE for error handling.
****************************************************************************************************
ENDTRY.
ENDMETHOD.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 | |
2 |