09-30-2016 9:29 AM
Hello together,
I'm trying to Change a splitter Position in the PAI Event. But it's not working fine. I think the reason is, that at PAI time the object is not synchronized to backend. I have found some hints to use: cl_gui_cfw=>flush( ). Can anyone see what im doing wrong?
MODULE pai INPUT.
DATA:
lv_i TYPE i,
lv_j TYPE i.
CASE sy-ucomm.
WHEN 'TEST'.
cl_gui_cfw=>flush( ).
splitter1->get_column_width(
EXPORTING
id = 1 " Id der Spalte
IMPORTING
result = lv_i " Ergebniscode
).
splitter1->get_column_width(
EXPORTING
id = 2 " Id der Spalte
IMPORTING
result = lv_j " Ergebniscode
).
splitter1->set_column_width(
EXPORTING
id = 1 " Id der Spalte
width = lv_j " Ergebniscode
).
splitter1->set_column_width(
EXPORTING
id = 2 " Id der Spalte
width = lv_i " Ergebniscode
).
cl_gui_cfw=>flush( ).
ENDCASE.
ENDMODULE.
Best Regards Uwe
09-30-2016 10:15 AM
If you debug,don't you see something weird when you get the widths of both columns? I think you may get 0, because possibly you need to flush, to get your variables filled. You don't need to flush before and after as you did. (the flush is implicit at the end of the PAI, the flush is never needed at the beginning of the PAI).
09-30-2016 10:15 AM
If you debug,don't you see something weird when you get the widths of both columns? I think you may get 0, because possibly you need to flush, to get your variables filled. You don't need to flush before and after as you did. (the flush is implicit at the end of the PAI, the flush is never needed at the beginning of the PAI).
09-30-2016 3:39 PM
Thanks for your hint.
Now I have working Code - but I don't understand it.
It is necessesary to make a flush at the end of PAI. But I also have to set the width in PAI and PBO. Maybe someone can explain why.
MODULE PBO_0100 OUTPUT.
DATA:
lv_i TYPE i,
lv_j TYPE i,
lv_test TYPE boolean.
IF lv_test = abap_true.
splitter1->get_column_width(
EXPORTING
id = 1 " Id der Spalte
IMPORTING
result = lv_i " Ergebniscode
).
splitter1->get_column_width(
EXPORTING
id = 2 " Id der Spalte
IMPORTING
result = lv_j " Ergebniscode
).
splitter1->set_column_width(
EXPORTING
id = 1 " Id der Spalte
width = lv_j " Ergebniscode
).
splitter1->set_column_width(
EXPORTING
id = 2 " Id der Spalte
width = lv_i " Ergebniscode
).
ENDIF.
ENDMODULE.
MODULE pai INPUT.
CASE sy-ucomm.
WHEN 'TEST'.
splitter1->get_column_width(
EXPORTING
id = 1 " Id der Spalte
IMPORTING
result = lv_i " Ergebniscode
).
splitter1->get_column_width(
EXPORTING
id = 2 " Id der Spalte
IMPORTING
result = lv_j " Ergebniscode
).
splitter1->set_column_width(
EXPORTING
id = 1 " Id der Spalte
width = lv_j " Ergebniscode
).
splitter1->set_column_width(
EXPORTING
id = 2 " Id der Spalte
width = lv_i " Ergebniscode
).
lv_test = abap_true.
ENDCASE.
cl_gui_cfw=>flush( ).
ENDMODULE.
09-30-2016 4:11 PM
You didn't understand what I meant. You don't need the code in the PBO, I think it's more logic in the PAI (is it?). I meant something like that:
splitter1->get_column_width( exporting id = 1 importing result = lv_j ).
cl_gui_cfw=>flush( ). " to fill LV_J
splitter1->set_column_width( exporting id = 2 width = lv_j ).