cancel
Showing results for 
Search instead for 
Did you mean: 

Error messages in ABAP Cloud

Former Member
0 Kudos

Hello Folks,

I am trying out some transaction app coding on SAP ABAP CP. Could you plese help in the new model how do we send messages and how do we now handle the old BOPF actions in the new RESTful model?

Thanks in advance.

Update on 17/08/2019-

Okay so no more traditional BOPF like code, great!!

Add annotaion in CDS for the button-

@UI: { lineItem: [ { position: 10, label: 'Booking ID', importance: #HIGH }, { type: #FOR_ACTION, dataAction: 'SET_STATUS', label: 'Set Status'} ], identification:[ { position: 10, label: 'Booking ID' } ] } 

the BDL code will look like

implementation unmanaged;define behavior for YI_BOOKING_xxx implementation in class y_i_booking_xxxlock master etagLastChangedAt{ field(mandatory)CustomerName, DateOfBooking, DateOfTravel, EmailAddress;create; update; delete; action set_status result[1] $self; }

The implementation looks like-

CLASS lhc_YI_BOOKING_xxx DEFINITION FINAL INHERITING FROM cl_abap_behavior_handler. PRIVATE SECTION. METHODS create FOR MODIFY IMPORTING entities FOR CREATE YI_BOOKING_xxx. METHODS delete FOR MODIFY IMPORTING keys FOR DELETE YI_BOOKING_xxx. METHODS update FOR MODIFY IMPORTING entities FOR UPDATE YI_BOOKING_xxx. METHODS lock FOR LOCK IMPORTING keys FOR LOCK YI_BOOKING_xxx. METHODS read FOR READ IMPORTING keys FOR READ YI_BOOKING_xxx RESULT result. METHODS modify FOR BEHAVIOR importing keys for ACTION YI_BOOKING_xxx~set_status RESULT result. ENDCLASS.CLASS lhc_YI_BOOKING_xxx IMPLEMENTATION. METHOD modify. ENDMETHOD

But wait on clicking on the button on my Fiori UI, I get a new error-

Precondition required for action in entity CDS~YI_BOOKING_XXX - use "If-Match" header

Can any kind hearted gentle man or woman help me ?

Update: This UI error is because of ETag mismatch. The only question is how to how my own custom messges?

Former Member
* Solved on my own :)
* If anyone needs any help, reach out to me. Thx

CLASS lcl_behaviour_handler IMPLEMENTATION.


  METHOD create.
    DATA: lt_data  TYPE STANDARD TABLE OF zpsb_cust_info,
          lv_index TYPE int2 VALUE 0.
    CLEAR lcl_data_buffer=>mt_create.
    lt_data = CORRESPONDING #(  entities ).


    failed-customer = VALUE #( ( %key = entities[ 1 ]-%key
                                 %cid = entities[ 1 ]-%cid ) )  .


    reported-customer =  VALUE #( ( %cid = entities[ 1 ]-%cid
                                    %key =  entities[ 1 ]-%key
                                    %msg = new_message( id       = lcl_data_buffer=>mc_zpsb_msg
                                                        number   = '001'
                                                        severity = if_abap_behv_message=>severity-error ) ) ).


*    LOOP AT lt_data ASSIGNING FIELD-SYMBOL(<ls_entity>).
*      lv_index = lv_index + 1.
*      TRY.
*          <ls_entity>-cust_id = entities[ lv_index ]-Customer.
*        CATCH cx_sy_itab_line_not_found.
*      ENDTRY.
*    ENDLOOP.
*
*    lcl_data_buffer=>mt_create = lt_data.


  ENDMETHOD.



Accepted Solutions (0)

Answers (0)