Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[ABAP] Restrict Select-Option to single values

INITIALIZATION.

  DATA: ls_restrictions TYPE sscr_restrict.

  APPEND VALUE #( name = 'CP' options-cp = abap_true ) TO ls_restrictions-opt_list_tab.

  APPEND VALUE #( kind    = 'S' name    = 'S_GRUND' sg_main = 'I'
                  sg_addy = ' ' op_main = 'CP'      op_addy = 'CP' ) TO ls_restrictions-ass_tab.

  CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
    EXPORTING
      restriction = ls_restrictions.

[FI] CALCULATE_TAX_FROM_GROSSAMOUNT

    DATA lt_mwdat TYPE TABLE OF RTAX1U15.

    CALL FUNCTION 'CALCULATE_TAX_FROM_GROSSAMOUNT'
      EXPORTING
        i_bukrs                 = lv_bukrs
        i_mwskz                 = lv_mwskz
*       I_TXJCD                 = ' '
        i_waers                 = lv_waers
        i_wrbtr                 = lv_wrbtr
*     IMPORTING
*       E_FWNAV                 =
*       E_FWNVV                 =
*       E_FWSTE                 =
*       E_FWAST                 =
      TABLES
        t_mwdat                 = lt_mwdat
      EXCEPTIONS
        bukrs_not_found         = 1
        country_not_found       = 2
        mwskz_not_defined       = 3
        mwskz_not_valid         = 4
        account_not_found       = 5
        different_discount_base = 6
        different_tax_base      = 7
        txjcd_not_valid         = 8
        not_found               = 9
        ktosl_not_found         = 10
        kalsm_not_found         = 11
        parameter_error         = 12
        knumh_not_found         = 13
        kschl_not_found         = 14
        unknown_error           = 15
        OTHERS                  = 16.
    IF sy-subrc <> 0 OR lt_mwdat IS INITIAL. 
      RAISE EXCEPTION TYPE zcx_xxx
        EXPORTING
          textid = zcx_xxx=>zcx_xxx
          msgv1  = SWITCH #( sy-subrc
         WHEN 1 THEN 'BUKRS_NOT_FOUND  '
         WHEN 2 THEN 'COUNTRY_NOT_FOUND'
         WHEN 3 THEN 'MWSKZ_NOT_DEFINED'
         WHEN 4 THEN 'MWSKZ_NOT_VALID'
         WHEN 5 THEN 'ACCOUNT_NOT_FOUND'
         WHEN 6 THEN 'DIFFERENT_DISCOUNT_BASE'
         WHEN 7 THEN 'DIFFERENT_TAX_BASE'
         WHEN 8 THEN 'TXJCD_NOT_VALID'
         WHEN 9 THEN 'NOT_FOUND'
         WHEN 10 THEN 'KTOSL_NOT_FOUND'
         WHEN 11 THEN 'KALSM_NOT_FOUND'
         WHEN 12 THEN 'PARAMETER_ERROR'
         WHEN 13 THEN 'KNUMH_NOT_FOUND'
         WHEN 14 THEN 'KSCHL_NOT_FOUND'
         WHEN 15 THEN 'UNKNOWN_ERROR' )
          mtype  = 'E'.
    ENDIF.

[ABAP] BAPI_PR_CREATE – extensionin

METHOD fill_extension_struc 
    RETURNING value(rt_extin) TYPE bapiparex_t.

    APPEND INITIAL LINE TO rt_extin ASSIGNING FIELD-SYMBOL(<ls_extin>).

    <ls_extin>-structure    = 'BAPI_TE_MEREQITEM'.

    CALL METHOD cl_abap_container_utilities=>fill_container_c
      EXPORTING
        im_value               = is_bapi_te_mereqitem
      IMPORTING
        ex_container           = <ls_extin>+30
      EXCEPTIONS
        illegal_parameter_type = 1
        OTHERS                 = 2.
    IF sy-subrc <> 0.
      CLEAR <ls_extin>.
    ENDIF.

    APPEND INITIAL LINE TO rt_extin ASSIGNING FIELD-SYMBOL(<ls_extinx>).

    <ls_extin>-structure    = 'BAPI_TE_MEREQITEMX'.

    CALL METHOD cl_abap_container_utilities=>fill_container_c
      EXPORTING
        im_value               = is_bapi_te_mereqitemx
      IMPORTING
        ex_container           = <ls_extinx>+30
      EXCEPTIONS
        illegal_parameter_type = 1
        OTHERS                 = 2.
    IF sy-subrc <> 0.
      CLEAR <ls_extin>.
    ENDIF.

  ENDMETHOD.

[WordPress] Remove Google Fonts in Theme Fluida

I usually try to avoid Google products, especially when it comes to web tracking, although I’m a big fan of what they do in other technologies.
Today I was testing another WordPress Theme called Fluida, a free theme from Cryout Creations. It’s clean and simple, the only thing that bothers me, is the usage of the Google Fonts API. Even if you don’t enter a Google Font in the settings, it’s connecting to the API.

Google Fonts has advantages as well as disadvantages. Read more about it here.

There are a few WordPress plugins to remove Google Fonts (e.g. Autoptimize), but I tried to avoid another plugin and wanted to do it manually. After a short search through the theme I found “includes/styles.php”. There you just had to comment out the following lines and it’s done.

	// Google fonts
        $gfonts = array();
	$roots = array();
	foreach ( $cryout_theme_structure['google-font-enabled-fields'] as $item ) {
		$itemg = $item . 'google';
		$itemw = $item . 'weight';
		// custom font names
		if ( ! empty( $options[$itemg] ) && ! preg_match( '/custom\sfont/i', $options[$item] ) ) {
				if ( $item == _CRYOUT_THEME_PREFIX . '_fgeneral' ) { 
					$gfonts[] = cryout_gfontclean( $options[$itemg], ":100,200,300,400,500,600,700,800,900" ); // include all weights for general font 
				} else {
					$gfonts[] = cryout_gfontclean( $options[$itemg], ":".$options[$itemw] );
				};
				$roots[] = cryout_gfontclean( $options[$itemg] );
		}
		// preset google fonts
		if ( preg_match('/^(.*)\/gfont$/i', $options[$item], $bits ) ) {
				if ( $item == _CRYOUT_THEME_PREFIX . '_fgeneral' ) { 
					$gfonts[] = cryout_gfontclean( $bits[1], ":100,200,300,400,500,600,700,800,900" ); // include all weights for general font 
				} else {
					$gfonts[] = cryout_gfontclean( $bits[1], ":".$options[$itemw] );
				};
				$roots[] = cryout_gfontclean( $bits[1] );
		}
	};