on 06-22-2023 12:28 PM
Hello Experts,
I have below way to fetch UUID currently which handles exception:
TRY .
DATA(lv_uuid) = cl_system_uuid=>if_system_uuid_rfc4122_static~create_uuid_c36_by_version( version = 4 ).
CATCH cx_uuid_error INTO gx_root.
gv_msgtxt = gx_root->get_text( ).
ENDTRY.
DATA(lt_bp_gen) =
VALUE mdg_bp_bpsuiterplct_req_ms_tab( (
message_header = VALUE #( uuid-content = cl_system_uuid=>if_system_uuid_rfc4122_static~create_uuid_c36_by_version( version = 4 )
* uuid-content = lv_uuid (dont want to use this way)
sender_business_system_id = 'INFO_29_GEN' )
) ).
anyway to write TRY-CATCH in same line? TIA
I don't think there is any way to use TRY - CATCH - ENDTRY within a construction operator or procedure call.
But what You can do, is encapsulate Your code in a separate method, in which You can then use TRY - CATCH - ENDTRY.
As for true - why don't You define Your own constant? It would be S/4 and cloud ready and resistant to any simplifications. 😉
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I see Your point, sh4il3sh. I personally would however prefer a redundancy over violating the domain in this case. What I mean: sai_true comes from package SAI_PROXY_PUBLIC, which is "Proxy Generation: Public Interfaces". Does Your project have something in common with proxy generation? If not, why are You mixing the domains?!
Just a rhetorical question and my point of view.
Thanks for accepting my answer anyway.
Greetings!
Hi sh4il3sh
you can catch the exception over the VALUE statement:
TRY.
DATA(lt_bp_gen) = VALUE mdg_bp_bpsuiterplct_req_ms_tab( (
message_header = VALUE #( uuid-content = cl_system_uuid=>if_system_uuid_rfc4122_static~create_uuid_c36_by_version( version = 4 )
sender_business_system_id = 'INFO_29_GEN' )
) ).
CATCH cx_uuid_error INTO DATA(gx_root).
gv_msgtxt = gx_root->get_text( ).
ENDTRY.
Hope this will help you.
Kind regards
Julian Danho
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
104 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.