quarta-feira, 16 de junho de 2021

SM30 - Customer button updating screen in runtime

 I always have been problem with customers modification in SM30, to save I use some specific events to change simple fields like user/date/time, but to update the fields in runtime it is not so easy because the specific standard controls and tables.

In my example I created a button in the maintanaince view ( making a copy from standard user interface ) to update a specific field in the view. 

The button "Atualiza NF" to update de column "Document number"



I created a module PAI to system recognize the function code.


the form code

I use de loop in table EXTRACT where it is used the field symbol <vim_extract_struc>.

When the structure <vim_extract_struc> is move to field symbol <table1> automatically the field symbol <f1_x> is set with the values as a key to table  TOTAL 


....

  LOOP AT extract.

    DATA(l_tabixsy-tabix.

    "When the structure <vim_extract_struc> is move to field symbol <table1> automatically the field
       "
symbol <f1_x> is set with the values as a key to table  TOTAL as you can see in below in the               "READ TABLE total

    MOVE <vim_extract_struc> TO <table1>.


    ASSIGN COMPONENT 'CD_CARREGAMENTO' OF STRUCTURE <vim_extract_struc>
                                       TO FIELD-SYMBOL(<l_cd_carr>).
    CHECK sy-subrc 0.

.....

    MOVE <table1> TO <vim_extract_struc>.
    MODIFY extract INDEX l_tabix.
   

    READ TABLE total WITH KEY <f1_x> BINARY SEARCH.
    MOVE <table1> TO <vim_total_struc>.

    "As the <table1> in the right line, the field symbol <ACTION> have to be filled

    "with "U"(update) to when you click the button "SAVE" the modified data be "posted.

    <action> 'U'.
    MODIFY total INDEX sy-tabix.

ENDLOOP.

......