Code Snippets ABAP

Short texts ABAP 🧑‍💻 Code snippets ABAP ✍️ Reading lists ABAP 👀

abapGit: Auto Pretty-Print Class/Interface Code

METHOD zif_abapgit_exit~custom_serialize_abap_clif. DATA: lr_sett_pp TYPE REF TO cl_pretty_printer_wb_settings, lt_code TYPE rswsourcet, lt_code_pp TYPE rswsourcet. CREATE OBJECT lr_sett_pp. ” lowercase setting: ” space = upper case ” X = lower case ” G = upper case keyword ” L = lower case keyword ” A = auto-detect (if supported) ” indent setting: ” 0 = no […]

Code for Thin wrapper around CN change BAPI for custom fields.

FUNCTION zre_change_cn_custom_field. *”———————————————————————- *”*”Local Interface: *” IMPORTING *” VALUE(COMPCODE) TYPE BAPI_RE_CONTRACT_KEY-COMP_CODE *” VALUE(CONTRACTNUMBER) TYPE BAPI_RE_CONTRACT_KEY-CONTRACT_NUMBER *” VALUE(VAR_NAME_1) TYPE STRINGVAL *” VALUE(VAR_VALUE_1) TYPE STRINGVAL *” TABLES *” RETURN STRUCTURE BAPIRET2 *”———————————————————————- * RFC-enabled FM to allow any custom field to be changed. * Technique: Reads existing custom fields of contract, and modifies only the fields we […]

move_corresponding_analysis.abap

DATA(lo_stru1) = CAST cl_abap_structdescr( cl_abap_typedescr=>describe_by_name( ‘VEKPVB’ ) ). DATA(lo_stru2) = CAST cl_abap_structdescr( cl_abap_typedescr=>describe_by_name( ‘E1EDL37’ ) ). DATA(lt_components1) = lo_stru1->get_components( ). DATA(lt_components2) = lo_stru2->get_components( ). DATA(lt_list1) = lo_stru1->get_ddic_field_list( p_including_substructres = abap_true ). DATA(lt_list2) = lo_stru2->get_ddic_field_list( p_including_substructres = abap_true ). DATA(lv_count) = 0. LOOP AT lt_list1 INTO DATA(ls_list1). IF line_exists( lt_list2[ fieldname = ls_list1-fieldname ] ). lv_count […]