Category: ABAP Programs

Function Imports in SAP OData

22 DATA: ls_parameter TYPE /iwbep/s_mgw_name_value_pair, lv_custid TYPE kunnr, lv_flag TYPE char1, lt_custinfo TYPE TABLE OF ztest_gw_srv, ls_custinfo TYPE ztest_gw_srv, ls_entity TYPE zcl_ztest_gw_srv_mpc=>ts_msg_return. IF iv_action_name = ‘demoFuncImport’. ” Check what action is being requested IF it_parameter IS NOT INITIAL. * Read Function import parameter value READ TABLE it_parameter INTO ls_parameter WITH KEY name = ‘CustId’. IF […]

Continue Reading

Create Object History in SAP Blockchain

15 In this article we will learn how to create a block in Blockchain at SAP Cloud Platform. METHOD create_object_history. DATA: lo_http_client TYPE REF TO if_http_client. DATA: response TYPE string, lv_url TYPE string, lv_auth TYPE string. CONSTANTS : lv_initial_url TYPE string VALUE ‘<Your_Service>’. IF iv_object_id IS NOT INITIAL. *** Getting Token TYPES: BEGIN OF t_entry, […]

Continue Reading

Calculate a hash in ABAP

18 In ABAP we can perform the following: calculate_hash_for_raw METHOD calculate_hash_for_raw. TRY. cl_abap_message_digest=>calculate_hash_for_raw( EXPORTING if_algorithm = ‘SHA256’ if_data = iv_data IMPORTING ef_hashstring = ev_sha256 ). CATCH cx_root. ” Eh, what’re you gonna do? ENDTRY. ENDMETHOD. calculate_hash_for_string METHOD calculate_hash_for_string. TRY. cl_abap_message_digest=>calculate_hash_for_char( EXPORTING if_algorithm = ‘SHA256’ if_data = iv_data IMPORTING ef_hashstring = ev_sha256 ). CATCH cx_root. ” […]

Continue Reading

Type Casting in ABAP Class

618 Type Casting in ABAP Class Note: If you are searching for basic type casting/conversion of ABAP variable in Reports/Program, click here. Prerequisite: 1. You must have a basic Idea of local class and instance/reference of class. 2. Inheritance and Polymorphism concept Note: Parent Class is also called base class and Child class is also […]

Continue Reading

Delete Duplicates in ABAP

541 To delete duplicates in ABAP either from a string or an internal table, we need to use ABAP statement “DELETE ADJACENT DUPLICATES FROM”. In this article, we have taken an example, which implements deletion of duplicate data when two strings are merged. This process also involves internal table. Introduction DELETE ADJACENT DUPLICATES FROM <Internal […]

Continue Reading

Constructor Program in ABAP

85 TYPE-POOLS truxs. PARAMETERS p_file TYPE rlgrap-filename. TYPES : BEGIN OF t_tab, workstream TYPE char50, task TYPE zci_task, task_type TYPE char50, END OF t_tab. DATA : t_upload1 TYPE STANDARD TABLE OF ZDEMO_TEST2, wa_upload1 TYPE ZDEMO_TEST2. AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file. CALL FUNCTION ‘F4_FILENAME’ EXPORTING field_name = ‘P_FILE’ IMPORTING file_name = p_file. START-OF-SELECTION. CALL FUNCTION […]

Continue Reading

Translate »