Smooth Transition For Cloud Devlopment
Smooth Transition For Cloud Devlopment
Smooth Transition For Cloud Devlopment
community.sap.com
More and more organizations are coming across the term ABAP on Cloud. Whether
they are considering Side-by-Side Extension with SAP Business Technology Platform
or On-stack Extension in S4 HANA, I'm certain that this is discussed in your strategy
meeting at least once.
ABAP on Cloud(aka ABAP for Cloud Development language version) is similar yet
different from standard ABAP in many ways. Even if your organization holds in-house
ABAP developers, the transition path to ABAP on Cloud may not be easy. This is due
to the fact that certain APIs(table, function module, tcode, etc.) exist in your system
built with standard ABAP language are not functional in ABAP on Cloud. On the front-
end level, the major factor of not being able to use SAP GUI changes certain ABAP
based solutions. In addition, there are changes in ABAP syntax as well.
This blogs is a one-stop shop for developers and IT strategist who like to make
smooth transition from standard ABAP to ABAP for Cloud Development. It consists of
three parts:
You can choose to just refer to the cheat sheet, or you can deep dive into each
solution at later half of this blog.
1 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
Disclaimer:
Availability of ABAP object for cloud development may differ between ABAP Platform
for S4 HANA and BTP ABAP Environment
ABAP object for cloud development may be renewed and deprecated over time
The list covers the most common ABAP topics and Line of Business(from personal
perspective) but certain areas of your interest may be missing. You are welcome to
comment these areas and I maybe able to add them later on.
LoB(Line of Business)
Standard ABAP object/ based solution Public local API to use instead in
ABAP for Cloud Development
Business Partner
Table: CDS view:
KNA1 i_customer
KNB1 i_customercompany
KNVK i_contactperson
KNVP i_custsalespartnerfunc
KNVV i_customersalesarea
LFA1 i_supplier
LFB1 i_suppliercompany
LFM1 i_supplierpurchasingorg
Delivery
Table: CDS view:
LIKP i_deliverydocument
LIPS i_deliverydocumentitem
TVST i_shippingpoint
Finance
Table: CDS view:
BKPF i_journalentry
BSEG i_operationalacctgdocitem
ACDOCA i_journalentryitem
SKA1 i_glaccountlineitem
2 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
SKB1 i_glaccountlineitemrawdata
T001 i_glaccountinchartofaccounts
T003 i_glaccountincompanycode
CEPC i_companycode
Function Module: i_profitcenter
BAPI_ACC_EMPLOYEE_EXP_POST Behavior Definition:
BAPI_ACC_INVOICE_RECEIPT_CHECK i_journalentrytp
BAPI_ACC_INVOICE_RECEIPT_POST
BAPI_ACC_DOCUMENT_CHECK
BAPI_ACC_DOCUMENT_POST
BAPI_ACC_ACT_POSTINGS_REVERSE
Finance(Hierarchy)
Table: CDS view:
SETHEADER i_costcenterhierarchy
SETHEADERT i_costcenterhierarchynode
SETLEAF i_costctractivitytypehiernode
SETNODE i_functionalareahierarchy
i_functionalareahiernode
i_profitcenterhierarchy
i_profitcenterhierarchynode
Manufacturing
Table: CDS view:
MARA i_product
MARC i_productqm
MARD i_productsales
MARM i_productprocurement
AFKO i_productplantbasic
AFPO i_productsupplyplanning
AFRU i_productstoragelocationbasic
AFVC i_productunitsofmeasure
AFVU i_manufacturingorder
AFVV i_manufacturingorderitem
MKAL i_mfgorderconfirmation
PLKO i_manufacturingorderoperation
PLPO i_manufacturingorderoperation
Function Module: i_manufacturingorderoperation
BAPI_MATERIAL_MAINTAINDATA_RT i_productionversion
BAPI_MATERIAL_SAVEREPLICA i_billofoperationsgroup
BAPI_MATERIAL_SAVEDATA i_mfgbillofoperationsoperation
BAPI_PLANNEDORDER_GET_DETAIL Behavior Definition:
BAPI_PRODORD_CHANGE i_producttp_2
BAPI_PRODORD_COMPLETE_TECH i_plannedordertp
BAPI_PRODORD_CREATE i_productionordertp
BAPI_PRODORD_RELEASE i_productionordconfirmationtp
BAPI_MATERIAL_STOCK_REQ_LIST i_plndindeprqmttp
i_supplydemanditemtp
3 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
Payment
Table: CDS view:
REGUH i_paymentprogramcontrol
REGUP i_paymentproposalpayment
REGUV i_paymentproposalitem
REGUT i_paymentproposalcontrol
Physical Inventory Management
Table: CDS view:
IKPF i_physinvtrydocheader
ISEG i_physinvtrydocitem
T001L i_storagelocation
T001W i_plant
MSEG i_materialdocumentitem_2
MKPF i_materialdocumentheader_2
Function Module: Behavior Definition:
MB_CREATE_GOODS_MOVEMENT i_materialdocumenttp
MB_POST_GOODS_MOVEMENT i_physicalinventorydocumenttp
BAPI_GOODSMVT_CANCEL
BAPI_GOODSMVT_CREATE
BAPI_MATPHYSINV_CHANGECOUNT
BAPI_MATPHYSINV_COUNT
BAPI_MATPHYSINV_CREATE
Sales
Table: CDS view:
VBAK i_salesdocument
VBAP i_salesdocumentitem
VBEP i_salesdocumentscheduleline
VBFA i_sddocumentmultilevelprocflow
VBKD i_salesdocument
VBRK i_billingdocumentbasic
VBRP i_billingdocumentitembasic
TVGRT i_salesgroup
TVKBT i_salesoffice
TVKBZ i_salesareasalesoffice
TVKGR i_salesgroup
TVKO i_salesorganization
TVTA i_salesarea
TVTW i_distributionchannel
Function Module: Behavior Definition:
BAPISDORDER_GETDETAILEDLIST i_salesordertp
BAPI_SALESORDER_CREATEFROMDAT2
Sales (Pricing)
Table: CDS view:
KONH i_slsprcgconditionrecord
KONM i_slsprcgcndnrecordscale
4 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
KONP i_slsprcgconditionrecord
KONV i_slsprcgconditionrecord
PRCD_ELEMENTS i_slsprcgconditionrecord
T685 i_conditiontype
T685A i_pricingconditiontype
Sourcing and Procurement
Table: CDS view:
EKKO i_purchaseorderapi01
EKPO i_purchaseorderitemapi01
RBKP i_supplierinvoiceapi01
RSEG i_suplrinvcitempurordrefapi01
MATDOC i_materialdocumentheader_2
EBAN i_purchaserequisitionitemapi01
EBKN i_purreqnacctassgmtapi01
EINA i_purchasinginforecordapi01
EINE i_purchasinginforecordapi01
MSKA i_materialstock
MSKU Behavior Definition:
MSLB i_purchaseordertp_2
MSLBH i_purchaserequisitiontp
Function Module: i_purchasecontracttp
BAPI_PO_CHANGE i_supplierinvoicetp
BAPI_PO_CREATE1
BAPI_PR_CHANGE
BAPI_PR_CREATE
BAPI_REQUISITION_CHANGE
BAPI_REQUISITION_CREATE
BAPI_REQUISITION_GETDETAIL
BAPI_INCOMINGINVOICE_CREATE
BAPI_INCOMINGINVOICE_POST
BAPI_INCOMINGINVOICE_RELEASE
Standard ABAP syntax/ based solution Syntax/API to use instead in ABAP for
Cloud Development
ABAP memory
5 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
ABAP Object
Table: Class:
DD01L xco_cp_abap_dictionary
DD02L xco_cp_database_table
DD02V xco_cp_cds
DD03L xco_cp_data_element
DD04L xco_cp_domain
Access management
SAP Role x Profiles based access Access Control based on Authority Object/
management Field, Restriction Type/Field, IAM app, CDS
Access Control Object and Business Catalog/
Role
For the detailed solution , scroll down below
to "Access management"
Application log
Tcode: Class:
SLG0 cl_bali_object_handler(CRUD application log
SLG1 object)
Function module: cl_bali_log / cl_bali_header_setter(Write log)
BAL_LOG_CREATE cl_bali_log_db/cl_bali_log_filter(Read log)
BAL_LOG_MSG_ADD xco_cp_bal
BAL_DB_SAVE Fiori app:
BAL_DB_SEARCH Application logs
BAL_LOG_MSG_READ
BAL_DSP_TXT_MSG_READ
Table:
BALHDR
BALDAT
Calculation
ADD, SUBTRACT, MULTIPLY, DIVIDE ADD-> + or +=
SUBTRACT-> – or –=
MULTIPLY-> * or *=
DIVIDE-> / or /=
Calendar(Factory calendar)
Tcode: Class:
6 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
SCAL CL_FHC_CALENDAR_RUNTIME
Function module: CDS views:
FACTORYDATE_CONVERT_TO_DATE I_FactoryCalendarBasic
DATE_CONVERT_TO_FACTORYDATE I_FactoryCalendarBasicText
CALCULATE_DATE ....
RKE_SELECT_FACTDAYS_FOR_PERIOD For the detailed solution , scroll down below
Table: to "Calendar(Factory calendar)"
TFACD
TFACS
Calendar(General)
Function module: Class:
MONTH_NAMES_GET CL_SCAL_UTILS
WEEK_GET_FIRST_DAY
DATE_GET_WEEK
Calendar(Public holidays)
Tcode: Class:
SCAL CL_FHC_CALENDAR_RUNTIME
Function module: CDS views:
HOLIDAY_CHECK_AND_GET_INFO I_PublicHolidayCalendarBasic
HOLIDAY_GET I_PublHolidayCalendarBasicText
HOLIDAY_CALENDAR_GET ...
Table: For the detailed solution , scroll down below
THOC to "Calendar(Public holidays)"
THOCD
Call stack
Function module: Class:
SYSTEM_CALLSTACK xco_cp_call_stack
SYSTEM_CALLSTACK_OF_PROCESS
Conversion(XSTRING, Binary, BASE64)
Function module: Class:
SCMS_BINARY_TO_XSTRING xco_cp=>xstring
SCMS_BINARY_TO_STRING xco_cp_binary
SCMS_XSTRING_TO_BINARY
SCMS_STRING_TO_XSTRING
SCMS_BASE64_ENCODE_STR
SCMS_BASE64_DECODE_STR
Count itab rows
DESCRIBE TABLE lt_table line DATA(lv_count) = lines( lt_table )
DATA(lv_count)
Date handling
Function module: Class:
CONVERT_DATE_TO_EXTERNAL cl_abap_datfm
CONVERT_DATE_TO_INTERNAL cl_abap_timefm
7 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
DATE_CONV_EXT_TO_INT cl_abap_tstmp
DATE_CHECK_PLAUSIBILITY
Class:
cl_demo_date_time
With write:
WRITE sy-datum TO date.
Debugging
SAP GUI based debugging ABAP Development Tools based debugging
Synatax:
break-point
Event Blocks
LOAD-OF-PROGRAM Not allowed because 1. Program object is not
INITIALIZATION allowed to be created 2. No dynpro allowed
therefore no selection screen.
AT SELECTION-SCREEN
START-OF-SELECTION, etc..
8 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
Tcode: Tool:
SE71~SE77(SAP Script) Adobe LiveCycle Designer(for designing form
SMARTFORMS, layout)
SMARTSTYLES(Smartforms) Services:
SFP(Adobe forms) Forms Service by Adobe(for rendering PDF
Function module: forms built with Adobe LiveCycle Designer)
OPEN_FORM Class:
START_FORM cl_print_queue_utils(writing print queues)
WRITE_FORM Fiori app:
END_FORM Maintain print queues
CLOSE_FORM ...
Call Function '<Smartform/Adobe form For the detailed solution , scroll down below
FM>' to "Forms and printing"
Fiori programming model
Gateway service builder SEGW RESTful ABAP Programming model (RAP)
BOPF framework
HTTP Service
Tcode: ABAP object:
SICF Create HTTP service and implement logic in
Interface: underlying ABAP class
IF_HTTP_EXTENSION
Identity Management
Table: CDS View:
AGR_USERS I_IAMBusinessUserBusinessRole(Business
USR01 Role assignment to Business User)
USR03 I_IAMBusinessRole(Business Role)
Tcode: I_IAMBusinessUserLogonDetails (Business
PFCG user login info)
SU01 I_BusinessPartner(Employee general data)
SU10 I_WorkplaceAddress(Employee address
data)
Class:
cl_iam_business_role_factory
cl_iam_business_user_factory
Fiori app:
Maintain Business User
Maintain Business Roles
XML handling
9 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
10 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
ENDLOOP.
Number range
Tcode: Class:
SNRO cl_numberrange_objects(maintain number
Table: range object)
NRIV cl_numberrange_intervals(maintain number
Function module: range interval)
NUMBER_GET_NEXT cl_numberrange_runtime(get next number,
NUMBER_CHECK check number)Fiori app:
Manage number range intervals
Parallel processing
CALL FUNCTION … STARTING NEW Class:
TASK cl_abap_parallelFor the detailed solution ,
scroll down below to "Parallel processing"
Regex
DATA:lv_input TYPE string VALUE Class:
'ABCDE12345'. cl_abap_matcher
REPLACE ALL OCCURRENCES OF cl_abap_regex
REGEX '[A-Z]' IN lv_input xco_cp_regular_expression
WITH space. or
DATA:lv_input TYPE string VALUE
'ABCDE12345'.
REPLACE ALL OCCURRENCES OF
PCRE '[A-Z]' IN lv_input
WITH space.
RFC
Tcode: ABAP object:
SE37 For Outbound
SM59 - Create outbound service with service type
RFC
- Create communication scenario for this
outbound service
For Inbound
- Create function module and set the
processing type as RFC
- Create Communication Scenario and set the
created RFC there as inbound service
- Create Communication Arrangement for the
Communication Scenario.
- Client can now trigger the API created by
Communication Arrangement to process the
logic inside the function module.
Class:
cl_rfc_destination_provider(create instance of
RFC destination)
11 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
Search string
DATA: text TYPE string VALUE DATA: text TYPE string VALUE `ABCDEFG`.
`ABCDEFG`. FIND 'CD' IN text IN CHARACTER MODE.
SEARCH text FOR 'CD' IN CHARACTER
MODE.
SOAP Service
Tcode: ABAP object:
SOAMANAGER Create outbound service with service type
SPROXY SOAP
Function module based web service Create communication scenario for this
creation outbound service
Class:
cl_soap_destination_provider(create instance
of SOAP destination)
*Inbound SOAP service creation is not
supported
System date, time, timezone
sy-datum cl_abap_context_info=>get_system_date( )
sy-uzeit cl_abap_context_info=>get_system_time( )
sy-zonlo cl_abap_context_info=>get_user_time_zone(
)
System fields
Everything else than those specified on the sy-batch, sy-dbcnt, sy-fdpos, sy-index, sy-
right index , sy-mandt, sy-mandt, sy-msgno,
sy-msgty, sy-msgv1234, sy-subrc, sy-sysid,
sy-tabix, sy-uname
Translation
SAP GUI based translation maintenance Class:
xco_cp_i18n
Fiori app:
Maintain translations
...
For the detailed solution , scroll down below
to "Translation"
Transport request
Table: Class:
E070 xco_cp_cts
E071 xco_cp_transport
UI
12 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
ABAP memory
You may use BUFFER or INTERNAL TABLE to exchange ABAP memory but former is
much simpler to use. BUFFER transfers to cluster data the buffer data object which is
in xstring format.
The main difference is that passing data using MEMORY ID is not supported anymore.
Therefore only these 2 options are available.
"ABAP memory using buffer
DATA:buffer TYPE xstring,
lt_input_bf TYPE STANDARD TABLE OF I_UnitOfMeasure,
lt_output_bf TYPE STANDARD TABLE OF I_UnitOfMeasure.
Access management
* Below example demonstrates how to restrict access inside IAM app. In addition, you
may choose to implement Access Control on your CDS Data Definition.
13 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
Similar to in SAP on-premise access management, Authorization Object and Role are
still relevant in ABAP for Cloud development. The big difference is that User Profiles is
not used anymore and instead, IAM App and Business Catalog are used to map
Authorization Object and Business Role. User Profile is where the fine-grained access
control is setup, so that some users have display access to certain table objects, while
some users don’t. This is in turn done by IAM App and Access Control Object in the
ABAP for Cloud development.
The actual authorization check uses the same ABAP syntax, AUTHORITY-CHECK
OBJECT. This checks the authorization object and activity value, which hasn't changed
from standard ABAP.
In my below example, I created Authorization Field "ZTABLE", Authorization Object
"ZAUTH_OBJ". In the IAM app, set the authorization object and restrict the table name
and activity.
14 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
IF requested_authorizations-%update EQ if_abap_behv=>mk-on.
* check update authorization
AUTHORITY-CHECK OBJECT 'ZAUTH_OBJ' ID 'ACTVT' FIELD '02'.
result-%update = COND #( WHEN sy-subrc = 0 THEN
if_abap_behv=>auth-allowed ELSE
if_abap_behv=>auth-unauthorized ).
ENDIF.
Now go to the Fiori application generated from the Odata service and go to the item
to edit the record. The debugger should start and you can see that the result of
authorization check for update(sy-subrc = 0) is OK. This is because in IAM app,
02(change) is allowed.
Now let's create a new record. This time, the authority check fails because IAM app
does not allow 01(create).
15 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
Calendar(Factory calendar)
This example shows part of the feature to handle factory calendar from released API
cl_fhc_calendar_runtime.
"Add 2 days from a date considering factory calendar
DATA(lo_holidaycalendar) =
cl_fhc_calendar_runtime=>create_factorycalendar_runtime(
iv_factorycalendar_id
= 'SAP_CA' ). "Canada
lo_holidaycalendar->add_workingdays_to_date(
EXPORTING
iv_start = '20221230'
iv_number_of_workingdays = 2
RECEIVING
rv_end = DATA(lv_end) "Result is 20230103
).
Calendar(Public holidays)
This example shows part of the feature to handle holidaycalendar from released API
cl_fhc_calendar_runtime.
DATA(lo_holidaycalendar) =
cl_fhc_calendar_runtime=>create_holidaycalendar_runtime(
EXPORTING
iv_holidaycalendar_id = 'SAP_CA' ). "Canada
16 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
).
lo_holidays->get_text(
EXPORTING
iv_language = sy-langu
RECEIVING
rs_text = DATA(ls_text)
).
1. Create a table where you want to log the document change. Create data element for
the field and check on Change Document Logging.
2. Create Change Document Object and set your Z table. Check how you want to log
your Z table
Log Field values for insert - Create log entry record for each field value that's
entered.
Log Initial values for insert - Create log entry record for each field value even if they
are empty. This created high volumn of change doucment records. Use with caution.
Log Field values for deletion - When object is deleted, create log entry record for
each field value that's entered.
Log Initial values for deletion - When object is deleted, create log entry record for
each field value even if they are empty. This created high volumn of change doucment
records. Use with caution.
17 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
3. Creating change document entry. Use the generated class to write change
document logging. In the below example, it's logging update of table field
DATA:lt_xzcd_test TYPE zcl_zobj_cd_test_chdo=>tt_zcd_test,
lt_yzcd_test TYPE zcl_zobj_cd_test_chdo=>tt_zcd_test,
lv_username TYPE if_chdo_object_tools_rel=>ty_cdusername.
DATA(lv_sys_datum) = cl_abap_context_info=>get_system_date( ).
DATA(lv_sys_time) = cl_abap_context_info=>get_system_time( ).
DATA(lv_user) = cl_abap_context_info=>get_user_formatted_name( ).
lv_username = lv_user.
zcl_zobj_cd_test_chdo=>write(
EXPORTING
objectid = 'ZOBJ_CD_TEST'
utime = lv_sys_time
udate = lv_sys_datum
username = lv_username
* planned_change_number =
object_change_indicator = 'U'
* planned_or_real_changes =
* no_change_pointers =
xzcd_test = lt_xzcd_test
yzcd_test = lt_yzcd_test
upd_zcd_test = 'U'
IMPORTING
changenumber = DATA(lv_changenumbner)
).
4. Reading the change document entry. In the generated class, add method
implementation "if_chdo_enhancements~authority_check" and put below code inside.
This method is for implementing your own autheority check, but in the below example,
it is simply returning rv_is_authorized = 'X', meaning the authroity check is succesfull.
METHOD if_chdo_enhancements~authority_check.
"No Auth check performed. Allow all
rv_is_authorized = 'X'.
ENDMETHOD.
Now, use class method cl_chdo_read_tools=>changedocument_read to read the
change log.
cl_chdo_read_tools=>changedocument_read(
18 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
EXPORTING
i_objectclass = 'ZOBJ_CD_TEST'
IMPORTING
et_cdredadd_tab = DATA(lt_cdredadd_tab)
).
Step1. Upload excel file by RAP Odata service described in "Large object
handing(storing as MIME)". This way, the excel data is transformed to XSTRING.
Step2. Read the XSTRING to with xco_cp_xlsx. This class will read worksheet
specified. Prepare an internal table that matches the file structure of excel. Use
IF_XCO_XLSX_RA_WORKSHEET to select the range of the worksheet. Finally, use
write_to method in if_xco_xlsx_ra_rs_operation_fc to write the values in internal table.
TYPES:
BEGIN OF ts_row,
Column1 TYPE string,
Column2 TYPE string,
END OF ts_row,
DATA(lo_xlsx) = xco_cp_xlsx=>document->for_file_content(
iv_file_content = <Your file that is in XSTRING format> )-
>read_access( ).
DATA(lo_worksheet) = lo_xlsx->get_workbook( )->worksheet->for_name(
iv_name = 'Sheet1' ).
DATA(lo_selection_pattern) = xco_cp_xlsx_selection=>pattern_builder-
>simple_from_to( )->get_pattern( ).
lo_worksheet->select( lo_selection_pattern
)->row_stream(
)->operation->write_to( REF #( lt_rows )
)->if_xco_xlsx_ra_operation~execute( ).
19 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
Exchange rate
*The below setup is for Business Technology Platform. Connecting Forms Service by
Adobe with ABAP Environment in S4 may require different setup.
Preparation
Forms Service by Adobe and Forms Service by Adobe API are required in Business
Technology Platform. On the service instance of Forms Service by Adobe API, create
a service key. Finally, create destination for Forms Service by Adobe instance.
20 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
Since there is no SAP Script or Smartforms, Adobe LiveCycle Designer must be used
to create form layout. Follow note 2187332 to install it to your local PC.
Once the template is created, download in Adobe XML Form (*xdp), then upload this
to Forms Template Store.
Rendering Forms
Rendering forms requies Forms Service by Adobe. Follow my blog below to set it up
and consume from ABAP. https://blogs.sap.com/2022/12/14/get-started-with-forms-
service-by-adobe-rest-api-in-btp/
Create client for Forms Service by Adobe template store.
mo_http_destination =
cl_http_destination_provider=>create_by_cloud_destination(
i_service_instance_name = CONV #( iv_service_instance_name )
i_name = 'ADS_SRV'
i_authn_mode = if_a4c_cp_service=>service_specific
).
mv_client = cl_web_http_client_manager=>create_by_http_destination(
mo_http_destination ).
Render PDF by calling Forms Service by Adobe API URI "/v1/adsRender/pdf". You
can find the complete list of supported URI of this API here. https://adsrestapi-
formsprocessing.cfapps.eu10.hana.ondemand.com/swagger
21 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
The rendering will return the PDF content result with base64 encoded string.
Viewing PDF
To view the content, we must first convert base64 encoded content to xstring. Then
upload this xstring as mime object in your Ztable. This Z table can be created following
"Excel upload to itab" part of this blog.
"Get the base64 encoded PDF content
DATA(lo_json) = /ui2/cl_json=>generate( json = lv_rendered_pdf ).
IF lo_json IS BOUND.
ASSIGN lo_json->* TO FIELD-SYMBOL(<data>).
ASSIGN COMPONENT `fileContent` OF STRUCTURE <data> TO FIELD-
SYMBOL(<field>).
ASSIGN <field>->* TO FIELD-SYMBOL(<pdf_base64>).
ENDIF.
"Upload the xstring to z table, so the content can be viewed with RAP
generated report
DATA: lt_input TYPE STANDARD TABLE OF zblob_test.
lt_input = VALUE #( ( docnum = '1000000001' filename = 'test.pdf'
attachment = lv_pdf_xstring mimetype =
'application/pdf' )
).
INSERT zblob_test FROM TABLE @lt_input.
Go to the RAP service and the inserted record is disaplayed. Click on the attachment
and the generated PDF from Form Service by Adobe will open.
22 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
Print Queue
Create a print queue by using cl_print_queue_utils. The below examples sends data
from table zcd_test and send it to print queue.
DATA: lv_print_data TYPE xstring,
lv_err_msg TYPE STRING.
If you want to integrate physical printer to ABAP Environment, follow this blog that
guides you from setting up communication scnerio and installing Cloud Print Manager.
https://blogs.sap.com/2017/08/07/cloud-print-manager-installation-and-configuration/
23 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
Job scheduling
1. There are predefined job template to schedule your job from. If none of them meet
your need, you must create your custom job template.
2. To create your custom template, first define your job entry by creating below class.
This defines design time information on your job.
CLASS zcl_job_schedule_apj DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_apj_dt_exec_object.
INTERFACES if_apj_rt_exec_object.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
24 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
)
( selname = 'P_DESCR' kind = if_apj_dt_exec_object=>parameter sign
= 'I' option = 'EQ' low = 'Application Job Description' )
( selname = 'P_SIMUL' kind = if_apj_dt_exec_object=>parameter sign
= 'I' option = 'EQ' low =
abap_true )
).
ENDMETHOD.
METHOD if_apj_rt_exec_object~execute.
"Execution logic when the job is started
TYPES ty_id TYPE c LENGTH 10.
" Getting the actual parameter values(Just for show. Not needed for
the logic below)
LOOP AT it_parameters INTO DATA(ls_parameter).
CASE ls_parameter-selname.
WHEN 'S_ID'.
APPEND VALUE #( sign = ls_parameter-sign
option = ls_parameter-option
low = ls_parameter-low
high = ls_parameter-high ) TO s_id.
WHEN 'P_DESCR'.
p_descr = ls_parameter-low.
WHEN 'P_SIMUL'.
p_simul = ls_parameter-low.
ENDCASE.
ENDLOOP.
25 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
lo_apj_create->create_job_template_entry(
iv_template_name = 'Z_TESTJOB_TEMPLATE'
iv_catalog_name = 'Z_TESTJOB_CATALOG'
iv_text = 'Job template text'
it_parameters = lt_parameters
iv_transport_request = 'H01K900008'
iv_package = 'ZSANDBOX'
).
out->write( |Job template created successfully| ).
ENDMETHOD.
ENDCLASS.
4. After successful execution, go to Fiori app maintain Application Job Template and
the new job template is created.
26 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
5. Use Fiori app Application jobs to create a job with the job template.
The completely guide to storing large object in database table can be found in Streams
in RAP : Uploading PDF , Excel and Other Files in RAP Application | SAP Blogs
Parallel processing
27 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
PROTECTED SECTION.
PRIVATE SECTION.
DATA gt_time_1 TYPE TABLE OF cl_abap_context_info=>ty_system_time.
DATA gv_wp_number TYPE char3.
ENDCLASS.
gv_wp_number = '001'.
ENDMETHOD.
METHOD get_time.
rt_time = gt_time_1.
ENDMETHOD.
METHOD get_wp_number.
rv_wp_number = gv_wp_number.
ENDMETHOD.
ENDCLASS.
Parallel process 2
CLASS zcl_paralell2 DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
TYPES ty_t_time TYPE STANDARD TABLE OF
cl_abap_context_info=>ty_system_time WITH DEFAULT KEY.
INTERFACES if_abap_parallel.
METHODS get_time RETURNING VALUE(rt_time) TYPE ty_t_time.
METHODS get_wp_number RETURNING VALUE(rv_wp_number) TYPE char3.
PROTECTED SECTION.
PRIVATE SECTION.
DATA gt_time_2 TYPE TABLE OF cl_abap_context_info=>ty_system_time.
DATA gv_wp_number TYPE char3.
ENDCLASS.
28 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
WAIT UP TO 2 SECONDS.
DATA(lv_system_time) = cl_abap_context_info=>get_system_time( ).
APPEND lv_system_time TO gt_time_2.
ENDDO.
gv_wp_number = '002'.
ENDMETHOD.
METHOD get_time.
rt_time = gt_time_2.
ENDMETHOD.
METHOD get_wp_number.
rv_wp_number = gv_wp_number.
ENDMETHOD.
ENDCLASS.
Trigger parallel processing
DATA(lo_parallel) = NEW cl_abap_parallel( ).
DATA(lo_instance_1) = NEW zcl_paralell1( ).
DATA(lo_instance_2) = NEW zcl_paralell2( ).
lo_parallel->run_inst(
EXPORTING
p_in_tab = VALUE #( ( lo_instance_1 ) ( lo_instance_2 ) )
IMPORTING
p_out_tab = DATA(lt_out_tab)
).
29 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
Translation
Since there is no GUI, the GUI based translation maintenance is no longer available.
For this purpose, Maintain Translations app is used.
Data Definition
Data Element
Domain
Message Class
Metadata Extension
Define the source language and target language. Demonstrate translation for
metadata extension for RAP based application.
30 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
XLF file is downloaded and this is the file that defines the translation. Add target
translation of Japanese. Upload the same file back in the Maintain Translation app and
don't forget to publish the translation.
Start the application in Japanese and English. The field names are translated based
on the uploaded XLF file.
UI
Since there is no SAP GUI, write statement or ALV output is not possible. The easiest
way in ABAP for Cloud Development is to use output console in ADT. Wrap
IF_OO_ADT_CLASSRUN into your class and use it's Write method to output data.
31 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
This output is only suited for simple string output. It is not meant only for developer,
and not for generating report for business application user.
CLASS ztest_class DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES: if_oo_adt_classrun.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
This is the primary approach to generate UI for report applications. It is part of ABAP
RAP framework and no front end development is needed to generate Fiori application.
It is completely different framework from SAP GUI. Instead of creating dynpro and
controlling logic in PBO, PAI, ABAP RAP uses CDS view as base and expose Odata
service. Fiori launchpad consumes UI service part of Odata and generates a Fiori list
report based on the data from CDS view and metadata definition of it.
Supported feature:
Visualization(graph, chart)
Inline edit
32 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
Locking mechanism
Limitation:
All limitation with Fiori Element apply(No flexibility in UI, limitation in screen control,
etc.)
This is open source project that allows developer to create Fiori UI5 application with
pure ABAP. It is the closest approach to built free-style UI5 application in ABAP
Environment. https://github.com/abap2UI5/abap2UI5
Highlights:
33 of 34 5/16/2024, 6:18 PM
Smooth transition to ABAP for Cloud Development(Ch... - SAP Community about:reader?url=https%3A%2F%2Fcommunity.sap.com%2Ft5%2Ftec...
Avaialble for both ABAP for Cloud and Standard ABAP language version
Supports Selection Screens, Tables, Lists, Popups, F4-Helps, MIME Editor, File
Upload/download, Chart/Graph, Side Effects, etc..
If you want to create more flexible UI with ABAP, consider using ABAP2UI5 instead of
ABAP RAP(below is a sample UI I created with ABAP2UI5).
The cheat sheets are initially curated by me so that people can use it as easy
reference, but I'd like feedbacks to help improve them in the future. This way, more
people can contribute and create better version of them. If you have topic of your
interest that should be added, or you think the information in the cheat sheet can be
better, please comment below. Feedback and suggestions are welcome.
34 of 34 5/16/2024, 6:18 PM