Posts

Showing posts with the label ABAP

SAP ABAP - Call AMDP With Select-Option

Image
AMDP Code CLASS  zcl_amdp_acdoca  DEFINITION    PUBLIC   FINAL    CREATE  PUBLIC  .    PUBLIC  SECTION .    INTERFACES :  if_amdp_marker_hdb .    TYPES :          BEGIN  OF  ty_acdoca ,             RCLNT   type  acdoca - RCLNT ,             rbukrs  type  acdoca - rbukrs ,             belnr  type  acdoca - belnr ,             gjahr  type  acdoca - gjahr ,             DOCLN  type  acdoca - DOCLN ,             racct  type  acdoca - racct ,             budat  type  acdoca - budat ,          END  OF  ty_acdoca .    TYPES :  zz_acdoca  TYPE  STANDARD  TABLE  OF  ty_acdoca .    class-METHODS :     get_acdoca        IMPORTING          VALUE ( lv_where )  TYPE  string        EXPORTING          VALUE ( et_acdoca )  TYPE  zz_acdoca .    PROTECTED  SECTION .    PRIVATE  SECTION . ENDCLASS . CLASS  ZCL_AMDP_ACDOCA  IMPLEMENTATION . * <SIGNATURE>---------------------------------------------------------------------------------------+ * | Static Public Method ZCL_AMDP_ACDOCA=>GET_ACDOCA * +--

SAP ABAP - Run (.exe) Program

Image
  CALL  METHOD  cl_gui_frontend_services => execute    EXPORTING     document                =  'CALC' "Program Name    EXCEPTIONS     cntl_error              =  1     error_no_gui            =  2     bad_parameter           =  3     file_not_found          =  4     path_not_found          =  5     file_extension_unknown  =  6     error_execute_failed    =  7     synchronous_failed      =  8     not_supported_by_gui    =  9      OTHERS                  =  10 .

SAP ABAP - CDS View Convert TCURR Table Date Value

Image
  @AbapCatalog.sqlViewName: 'ZVTCURR' @AbapCatalog.compiler.compareFilter: true @AbapCatalog.preserveKey: true @AccessControl.authorizationCheck: #NOT_REQUIRED @EndUserText.label: 'CDS Exchange Rates' define view ZCDS_TCURR as select from tcurr {     key kurst,     key fcurr,     key tcurr,     key gdatu,     ukurs,     ffact,     tfact,     cast( cast( ( 99999999 - cast( cast( gdatu as abap.numc( 8 ) ) as abap.int4 ) ) as abap.char( 11 ) ) as abap.dats ) as gdat1,       dats_add_days(cast( cast( ( 99999999 - cast( cast( gdatu as abap.numc( 8 ) ) as abap.int4 ) ) as abap.char( 11 ) ) as abap.dats ), -1, 'INITIAL' ) as gdat2 }

SAP ABAP - Get User IP Address

Image
Function module TH_USER_INFO

SAP ABAP CDS View

Here is an example of a simple CDS View and how you can use it in an ABAP program: Creating a CDS View First, let's create a simple CDS View that retrieves data from the standard SAP table MARA (Material Master). Here's an example of the code: less Copy code @AbapCatalog . sqlViewName : 'ZMATERIAL'   @AbapCatalog .compiler. compareFilter : true @AccessControl . authorizationCheck : #NOT_REQUIRED @EndUserText . label : 'Material View' define view Z_MM_MATERIAL as select from mara {     key mara .matnr as MaterialNumber ,     mara .mtart as MaterialType ,      mara .matkl as MaterialGroup } This CDS View creates a view named "ZMATERIAL" that retrieves three fields from the MARA table: MaterialNumber, MaterialType, and MaterialGroup. Using the CDS View in an ABAP Program Now, let's use this CDS View in an ABAP program. Here's an example of the code: sql Copy code REPORT z_test_cds_view.  DATA: lt_materials TYPE STANDARD TABLE