CALL FUNCTION 'SAPGUI_SET_FUNCTIONCODE' EXPORTING functioncode = 'BACK' EXCEPTIONS function_not_supported = 1 OTHERS = 2. |
Tuesday, December 10, 2019
Set Ok-code and init new PAI-PBO-cycle
Tuesday, June 4, 2019
SALV get selected rows
Sometimes the backend doesn't return the selected rows of an SALV. For my case get_metadata( ) was the solution:
go_salv->get_metadata( ).
lt_row = go_salv->get_selections( )->get_selected_rows( ).
go_salv TYPE REF TO cl_salv_table.
FORM dialog_select_peg CHANGING ct_pegging.
...
CALL SCREEN 0200 STARTING AT 40 8.
...
ENDFORM.
FORM dynp_0200_pbo_alv.
CHECK go_cc IS NOT BOUND. " run only once per dynpro live-cycle
go_cc = NEW cl_gui_custom_container( 'CC' ).
TRY.
cl_salv_table=>factory(
EXPORTING r_container = go_cc
IMPORTING r_salv_table = go_salv
CHANGING t_table = gt_dynp_0200_peg
).
" setup alv
go_salv->get_columns( )->set_optimize( abap_true ).
go_salv->get_selections( )->set_selection_mode( if_salv_c_selection_mode=>cell ). " if_salv_c_selection_mode=>multiple
go_salv->get_functions( )->set_all( ). " activate toolbar
" display alv
go_salv->display( ).
CATCH cx_salv_msg
cx_salv_not_found
cx_salv_data_error
cx_salv_existing
cx_salv_wrong_call INTO DATA(lo_x).
MESSAGE lo_x TYPE 'E'.
ENDTRY.
ENDFORM.
FORM dynp_0200_handle_selection.
DATA:
lt_row TYPE salv_t_row.
" get indexes of selected rows
go_salv->get_metadata( ).
lt_row = go_salv->get_selections( )->get_selected_rows( ).
...
ENDFORM.
FORM dynp_0200_exit.
IF go_cc IS BOUND.
go_cc->free( ).
FREE go_cc.
ENDIF.
ENDFORM.
MODULE status_0200 OUTPUT.
SET PF-STATUS '0100'.
SET TITLEBAR '0200'.
PERFORM dynp_0200_pbo_alv.
ENDMODULE.
MODULE user_command_0200 INPUT.
CASE sy-ucomm.
WHEN 'OK'.
PERFORM dynp_0200_handle_selection.
PERFORM dynp_0200_exit.
LEAVE TO SCREEN 0.
WHEN 'CANCEL'.
CLEAR gt_dynp_0200_peg.
PERFORM dynp_0200_exit.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE.
go_salv->get_metadata( ).
lt_row = go_salv->get_selections( )->get_selected_rows( ).
The complete Dynpro Logic:
go_cc TYPE REF TO cl_gui_custom_container,go_salv TYPE REF TO cl_salv_table.
FORM dialog_select_peg CHANGING ct_pegging.
...
CALL SCREEN 0200 STARTING AT 40 8.
...
ENDFORM.
FORM dynp_0200_pbo_alv.
CHECK go_cc IS NOT BOUND. " run only once per dynpro live-cycle
go_cc = NEW cl_gui_custom_container( 'CC' ).
TRY.
cl_salv_table=>factory(
EXPORTING r_container = go_cc
IMPORTING r_salv_table = go_salv
CHANGING t_table = gt_dynp_0200_peg
).
" setup alv
go_salv->get_columns( )->set_optimize( abap_true ).
go_salv->get_selections( )->set_selection_mode( if_salv_c_selection_mode=>cell ). " if_salv_c_selection_mode=>multiple
go_salv->get_functions( )->set_all( ). " activate toolbar
" display alv
go_salv->display( ).
CATCH cx_salv_msg
cx_salv_not_found
cx_salv_data_error
cx_salv_existing
cx_salv_wrong_call INTO DATA(lo_x).
MESSAGE lo_x TYPE 'E'.
ENDTRY.
ENDFORM.
FORM dynp_0200_handle_selection.
DATA:
lt_row TYPE salv_t_row.
" get indexes of selected rows
go_salv->get_metadata( ).
lt_row = go_salv->get_selections( )->get_selected_rows( ).
...
ENDFORM.
FORM dynp_0200_exit.
IF go_cc IS BOUND.
go_cc->free( ).
FREE go_cc.
ENDIF.
ENDFORM.
MODULE status_0200 OUTPUT.
SET PF-STATUS '0100'.
SET TITLEBAR '0200'.
PERFORM dynp_0200_pbo_alv.
ENDMODULE.
MODULE user_command_0200 INPUT.
CASE sy-ucomm.
WHEN 'OK'.
PERFORM dynp_0200_handle_selection.
PERFORM dynp_0200_exit.
LEAVE TO SCREEN 0.
WHEN 'CANCEL'.
CLEAR gt_dynp_0200_peg.
PERFORM dynp_0200_exit.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE.
Tuesday, March 5, 2019
Usage of the ABAP REST Library
Warum sehe ich das erst jetzt?
https://blogs.sap.com/2013/05/16/usage-of-the-abap-rest-library-sapbasis-740/
Sieht so aus, als könnte man hier direkt programmieren, ohne viel overhead.
Monday, March 4, 2019
Partial Pritty Print
Especially in AMS you often don't want to pretty print the whole include, but only a part of it.
Select the section to pretty print
right click and select "Format" --> "Selektion formatieren"
Select the section to pretty print
right click and select "Format" --> "Selektion formatieren"
Saturday, March 2, 2019
Debugging remote nodejs applications
If you want to debug a nodejs application that runs on a remote Linux server from a local Windows machine with Chrome, do the following:
Go to the Linux machine and make sure that the debugging port is opened in the firewall
ufw status
ufw allow 9229
start the nodejs application in debug mode
node --inspect app.js
Alternatives:
use node --inspect-brk app.js to start it with a breakpoint at the beginning
use node --inspect=linuxserver.com:9229 app.js to make a debugger listen on a public port. Don't do this.
Open Chrome and go to chrome:inspect
Your application doesn't appear because Chrome is only looking on local ports
Since node --inspect app.js makes the remote debugger listen on 127.0.0.1 it doesn't make sense to add the Linux server to your configuration in chrome:inspect. Instead configure a tunnel: open cmd and type
ssh -nNT -L 9229:127.0.0.1:9229 user@linuxserver.com
if you have an rsa key to logon to your remote server
ssh -nNT -L 9229:127.0.0.1:9229 user@linuxserver.com -i keyfile
Port 9229 of your local Windows machine is now forwared to the remote Linux server. In chrome:inspect under Remote Target #LOCALHOST a link apears that you can use to debug your application running on the remote Linux server in Chrome on your local machine.
(What has that to do with SAP? Cloud is comming for ABAPers)
Go to the Linux machine and make sure that the debugging port is opened in the firewall
ufw status
ufw allow 9229
start the nodejs application in debug mode
node --inspect app.js
Alternatives:
use node --inspect-brk app.js to start it with a breakpoint at the beginning
use node --inspect=linuxserver.com:9229 app.js to make a debugger listen on a public port. Don't do this.
Open Chrome and go to chrome:inspect
Your application doesn't appear because Chrome is only looking on local ports
Since node --inspect app.js makes the remote debugger listen on 127.0.0.1 it doesn't make sense to add the Linux server to your configuration in chrome:inspect. Instead configure a tunnel: open cmd and type
ssh -nNT -L 9229:127.0.0.1:9229 user@linuxserver.com
if you have an rsa key to logon to your remote server
ssh -nNT -L 9229:127.0.0.1:9229 user@linuxserver.com -i keyfile
Port 9229 of your local Windows machine is now forwared to the remote Linux server. In chrome:inspect under Remote Target #LOCALHOST a link apears that you can use to debug your application running on the remote Linux server in Chrome on your local machine.
(What has that to do with SAP? Cloud is comming for ABAPers)
Friday, February 15, 2019
Setup and Access SAP Fiori launchpad
from https://wiki.scn.sap.com/wiki/display/Fiori/SAP+Fiori+-+SAP+Fiori+launchpad
URL launchpad: https: //<host>.<domain>:<port>/sap/bc/ui5_ui5/ui2/ushell/shells/abap/Fiorilaunchpad.html?sap-client=<client>&sap-language=EN
URL launchpad designer: https: //<host>.<domain>:<port>/sap/bc/ui5_ui5/sap/arsrvc_upb_admn/main.html?sap-client=<Client>?scope=CUST
Transaction codes:
LPD_CUST - launchpad Customizing
/UI2/SEMOBJ - Custom semantic objects
/UI2/SEMOBJ_SAP - Semantic objects delivered
Find Host:
Transaction SMICM, Goto --> Parameters --> Display, look for key "icm/host_name_full" and "icm/server_port"
or Transaction SICF, F8, Navigate to Service /sap/bc/ui5_ui5/ui2/ushell right-click and select TEST from context menu. A browser opens an you see the complete URI
Thursday, January 24, 2019
base64 encoding decoding in ABAP
SAP's standard class cl_http_utility provides methods to encode and decode base64, i.e. encode_base64 and decode_base64.
l_result = new cl_http_utility( )->encode_base64( l_input ).
l_result = new cl_http_utility( )->decode_base64( l_input ).
parameters pa_enc type text120.
parameters pa_dec type text120.
start-of-selection.
if pa_enc is not initial.
perform encode_base64 using pa_enc.
endif.
if pa_dec is not initial.
perform decode_base64 using pa_dec.
endif.
form encode_base64 using i_char type char120.
write: / |{ i_char } { 'base64-encoded is' } { new cl_http_utility( )->encode_base64( conv #( i_char ) ) }|.
endform.
form decode_base64 using i_char type char120.
write: / |{ i_char } { 'base64-decoded is' } { new cl_http_utility( )->decode_base64( conv #( i_char ) ) }|.
endform.
l_result = new cl_http_utility( )->encode_base64( l_input ).
l_result = new cl_http_utility( )->decode_base64( l_input ).
Example Report
report zjso_base64.parameters pa_enc type text120.
parameters pa_dec type text120.
start-of-selection.
if pa_enc is not initial.
perform encode_base64 using pa_enc.
endif.
if pa_dec is not initial.
perform decode_base64 using pa_dec.
endif.
form encode_base64 using i_char type char120.
write: / |{ i_char } { 'base64-encoded is' } { new cl_http_utility( )->encode_base64( conv #( i_char ) ) }|.
endform.
form decode_base64 using i_char type char120.
write: / |{ i_char } { 'base64-decoded is' } { new cl_http_utility( )->decode_base64( conv #( i_char ) ) }|.
endform.
Subscribe to:
Posts (Atom)
SAP ABAP: Determine Timezone for Plant
DATA: lt_tzone TYPE STANDARD TABLE OF tznzone WITH DEFAULT KEY, l_tzone TYPE tznzone. " get time zone for plant ...
-
Sometimes the backend doesn't return the selected rows of an SALV. For my case get_metadata( ) was the solution: go_salv-> get_met...
-
GUIDs or UUIDs can be created with the class cl_system_uuid . try . data (lv_uuid) = cl_system_uuid => if_system_uuid_static...
-
AA PR-AUF(E) Prozessauftrag (eröffnet) AB PR-AUF(F) Prozessauftrag (freigegeben) AC FE...