Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

PAI cl_gui_splitter_container - change splitter position

uwe_isenmann2
Participant
0 Kudos

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                =   " 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                =   " 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

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor
0 Kudos

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).

3 REPLIES 3

Sandra_Rossi
Active Contributor
0 Kudos

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).

0 Kudos

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                " 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                " 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                " 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                " 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.     

0 Kudos

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 ).