Código fuente de la función: DATA: lt_data TYPE STANDARD TABLE OF zcfcl_fi_es_tax,
ls_data TYPE zcfcl_fi_es_tax.
DATA: ls_t007a TYPE t007a,
lt_t007a TYPE STANDARD TABLE OF t007a,
lt_ftaxp TYPE STANDARD TABLE OF ftaxp,
ls_ftaxp TYPE ftaxp,
lv_kalsm TYPE t005-kalsm,
lv_txjcd TYPE txjcd.
DATA: lv_valor TYPE p DECIMALS 2.
CONSTANTS: lc_fix_kappl TYPE kappl VALUE 'TX'.
CLEAR lv_kalsm. REFRESH: lt_t007a[], lt_ftaxp[], et_data[]. SELECT SINGLE kalsm FROM t005 INTO lv_kalsm WHERE land1 EQ iv_land1. IF sy-subrc EQ 0. CLEAR lv_txjcd. SELECT SINGLE txjcd FROM ttxj INTO lv_txjcd WHERE kalsm EQ lv_kalsm. IF sy-subrc NE 0 OR lv_txjcd IS INITIAL. MOVE 'X' TO lv_txjcd. ENDIF.
SELECT * FROM t007a INTO TABLE lt_t007a WHERE kalsm EQ lv_kalsm. IF sy-subrc EQ 0. CLEAR ls_t007a. LOOP AT lt_t007a INTO ls_t007a.
IF lt_ftaxp[] IS NOT INITIAL. CLEAR ls_ftaxp. READ TABLE lt_ftaxp INTO ls_ftaxp INDEX 1. IF sy-subrc EQ 0. MOVE-CORRESPONDING ls_ftaxp TO ls_data. MOVE ls_t007a-mwskz TO ls_data-mwskz.
lv_valor = ls_ftaxp-kbetr / 10. WRITE lv_valor TO ls_data-tax DECIMALS 2 . REPLACE ALL OCCURRENCES OF '.' IN ls_data-tax WITH ','. CONDENSE ls_data-tax. APPEND ls_data TO lt_data. ENDIF. ENDIF.
*&---------------------------------------------------------------------* *& Form F_GET_TEXT *&---------------------------------------------------------------------* FORM f_get_text USING p_v_obj TYPE tdobject p_v_id TYPE tdid p_v_langu TYPE spras p_v_name TYPE tdobname CHANGING p_v_string TYPE string.
DATA: lt_lines_tab TYPE efg_tab_tline, ls_line_es TYPE tline, lv_texto_line TYPE string.
CALL FUNCTION 'READ_TEXT' EXPORTING id = p_v_id language = p_v_langu
name = p_v_name
object = p_v_obj TABLES lines = lt_lines_tab 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. * Implement suitable error handling here ELSE. LOOP AT lt_lines_tab INTO ls_line_es. IF sy-tabix EQ 1.
p_v_string = ls_line_es-tdline. ELSE. CONDENSE ls_line_es-tdline. CONCATENATE p_v_string ls_line_es-tdline INTO p_v_string SEPARATED BY space. ENDIF. ENDLOOP. ENDIF.
ENDFORM. " F_GET_TEXT LLAMADA A LA FORM: en este caso es un texto de posición. DATA: lv_string TYPE string, lv_name TYPE tdobname,CLEAR: lv_string, lv_name. CONCATENATE <fs_item>-vbeln <fs_item>-vbposINTO lv_name. PERFORM f_get_text USING 'VBBP' '0001' syst-langu lv_name CHANGING lv_string.
*&---------------------------------------------------------------------* *& Form F_ALPHA_O *&---------------------------------------------------------------------* FORM f_alpha_o CHANGING p_v. WRITE p_v TO p_v USING EDIT MASK '==ALPHA'. CONDENSE p_v. ENDFORM. " F_ALPHA_O Llamada a la form:
DATA: lv_variable TYPE c LENGTH 5 VALUE '00005'. PERFORM f_alpha_o CHANGING lv_variable.
*&---------------------------------------------------------------------* *& Form F_GET_SET_DATA *&---------------------------------------------------------------------* FORM f_get_set_data TABLES p_t_range USING p_v_set. REFRESH: p_t_range[]. SELECT setleaf~valsign AS sign setleaf~valoption AS option setleaf~valfrom AS low setleaf~valto AS high INTO CORRESPONDING FIELDS OF TABLE p_t_range FROM setheader INNER JOIN setleaf ON setleaf~setclass EQ setheader~setclass AND setleaf~subclass EQ setheader~subclass AND setleaf~setname EQ setheader~setname WHERE setheader~setname EQ p_v_set. ENDFORM. "f_get_set_data
INVOCAR LA FORM: RANGES: lr_kschl FOR komv-kschl. PERFORM f_get_set_data TABLES lr_kschl USING 'Z0004'. "set creado en la trx GS01