Application Development and Automation 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: 
Read only

ALV GRID REFRESH

Former Member
0 Likes
755

Haii All..

i have created a list with the fn. module <b>'reuse_alv_grid_display'</b>, and when i click on a field (say material number matnr) it would go to <b>MM02</b> and i would change the storage location for that material and after the changes were made..the control comes back to the grid..now i want the grid to be refreshed automatically..i should not create any <b>REFRESH</b> button in this case..

is it possible..??

Best Regards,

rama

4 REPLIES 4
Read only

Former Member
0 Likes
611

HI RAMA,

Dis might help u out:-

when using the function module "REUSE_ALV_GRID_DISPLAY", you have a exporting parameter called "I_CALLBACK_USER_COMMAND". This is the name of a form in your report to handle all the buttons clicked. To create your own buttons just create a GUI-Status and provide the exporting parameter "I_CALLBACK_PF_STATUS_SET" with a form in your report that sets the status.

Inside your user_command-Form you can update all the records of your internal table. To make ALV refresh the display just provide the field st_selfield-refresh with 'X'.

EXAMPLE:

=========

FORM USER_COMMAND USING RC_UCOMM LIKE SY-UCOMM

ST_SELFIELD TYPE SLIS_SELFIELD.

case rc_ucomm.

  • check which button has been pressed

  • Refresh internal table

select... into itab...

endcase.

  • Make sure, that the updated internal table itab is displayed

st_selfield-refresh = 'X'.

ENDFORM.

FORM PF_STATUS_SET USING RT_EXTAB TYPE SLIS_T_EXTAB.

SET PF-STATUS 'ALV'. " EXCLUDING RT_EXTAB.

ENDFORM.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = 'ZPXYZ'

I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_SET'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'

.....

...

IF U FIND IT USEFUL DEN DO GIVE POINTS ALSO.

Read only

0 Likes
611

yaa..i understood that logic..but it works only when i click on the refresh button..but i shouldnt click any button in the list..and it should be refreshed automatically..

i think you can get some idea seeing this code:

WHEN '&IC1'. " Auswählen

CASE rs_selfield-fieldname.

*----


Lagerplatzzuordnung ändern----


*

WHEN 'LGPLA'.

CHECK aendern = 'X'.

READ TABLE daten

INTO h_wa_it_result

INDEX rs_selfield-tabindex.

PERFORM lagerplatz.

-

-


-

-


and the code for lagerplatz is:

FORM lagerplatz.

DATA: BEGIN OF felder OCCURS 1.

INCLUDE STRUCTURE sval.

DATA: END OF felder.

DATA: textline(50),

matnr2 LIKE mara-matnr,

code(1),

meins(3).

*----


Abfrage-Popup: Felder definieren----


*

felder-tabname = 'MARA'.

felder-fieldname = 'MATNR'.

APPEND felder.

felder-tabname = 'MARA'.

felder-fieldname = 'BISMT'.

felder-fieldtext = 'Lagerplatzmenge'.

APPEND felder.

felder-tabname = 'MARA'.

felder-fieldname = 'FERTH'.

felder-fieldtext = 'Behältermenge'.

APPEND felder.

felder-tabname = 'MLGN'.

felder-fieldname = 'LETY3'.

felder-fieldtext = 'Lagereinheitentyp'.

APPEND felder.

CLEAR: textline.

textline = 'Bitte Werte für Lagerplatz'.

textline+27 = h_wa_it_result-lgpla.

textline+38 = 'eingeben:'.

CALL FUNCTION 'POPUP_GET_VALUES'

EXPORTING

popup_title = textline

IMPORTING

returncode = code

TABLES

fields = felder.

*----


Abbruch der Funktion----


*

IF code NE ' '.

EXIT.

ENDIF.

*----


Eingabe verarbeiten----


*

LOOP AT felder.

CASE felder-fieldname.

WHEN 'MATNR'.

matnr2 = felder-value.

WHEN 'BISMT'.

h_wa_it_result-lpmax = felder-value.

WHEN 'FERTH'.

h_wa_it_result-lpmin = felder-value.

WHEN 'LETY3'.

h_wa_it_result-lety3 = felder-value.

ENDCASE.

ENDLOOP.

*----


Materialnummer prüfen----


*

IF matnr2 NE ' '.

SELECT SINGLE meins FROM mara INTO meins

WHERE matnr = matnr2.

IF sy-subrc NE 0.

CLEAR: textline.

textline = 'Material'.

textline9 = matnr210(8).

textline+18 = 'nicht vorhanden.'.

CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'

EXPORTING

titel = 'Fehler'

textline1 = textline.

EXIT.

ENDIF.

ENDIF.

*----


Lagerplatz im Lagertyp vorhanden?----


*

SELECT SINGLE lgpla FROM lagp INTO lgpla

WHERE lgnum = lgnum

AND lgtyp = h_wa_it_result-lgtyp

AND lgpla = h_wa_it_result-lgpla.

IF sy-subrc = 4.

REFRESH bdc_tab.

CLEAR bdc_tab.

PERFORM dynpro USING:

'X' 'SAPML01S' '0400',

' ' 'BDC_OKCODE' '/00',

' ' 'LAGP-LGNUM' lgnum,

' ' 'LAGP-LGTYP' h_wa_it_result-lgtyp,

' ' 'LAGP-LGPLA' h_wa_it_result-lgpla,

'X' 'SAPML01S' '0400',

' ' 'BDC_OKCODE' '=BU',

' ' 'LAGP-LGBER' '001'.

CALL TRANSACTION 'LS01N' USING bdc_tab

MODE mode

UPDATE 'S'.

ENDIF.

*----


Bestehende Lagerplatzdaten im Materialstamm löschen----


*

IF h_wa_it_result-matnr NE ' ' AND h_wa_it_result-matnr NE matnr2.

REFRESH bdc_tab.

CLEAR: bdc_tab.

PERFORM dynpro USING:

'X' 'SAPLMGMM' '0060',

' ' 'BDC_OKCODE' '=ENTR',

' ' 'RMMG1-MATNR' h_wa_it_result-matnr+10(8),

'X' 'SAPLMGMM' '0070',

' ' 'BDC_OKCODE' '=ENTR',

' ' 'MSICHTAUSW-KZSEL(01)' 'X',

'X' 'SAPLMGMM' '4004',

' ' 'BDC_OKCODE' '=SP22',

'X' 'SAPLMGMM' '0081',

' ' 'BDC_OKCODE' '=ENTR',

' ' 'RMMG1-LGNUM' lgnum,

' ' 'RMMG1-LGTYP' h_wa_it_result-lgtyp,

' ' 'RMMG1-WERKS' werks,

'X' 'SAPLMGMM' '4000',

' ' 'BDC_OKCODE' '=BU',

' ' 'MLGT-LGPLA' ' ',

' ' 'MLGN-LHMG3' ' ',

' ' 'MLGN-LHME3' ' ',

' ' 'MLGN-LETY3' ' ',

' ' 'MLGT-LPMAX' ' ',

' ' 'MLGT-LPMIN' ' '.

CALL TRANSACTION 'MM02'

USING bdc_tab

MODE mode.

ENDIF.

Read only

0 Likes
611

Just put your refresh code into a FORM.

You would do a PERFORM to that form after your call MM02.

This FORM would perform the same logic that you would do if you had a refresh button. (Reload table, call ALV function module etc as noted in the previous response.)

However, instead of calling it on the press of a button, you just have it as part of you program logic following the call to MM02.

Good luck

Brian

Read only

0 Likes
611

Haii..I have done that too..problem is that when i debug i get the new values into my internal table..and surprisingly when i place a break point after i read the data again(immediately after MM02) the program works fine..as soon as i remove the breakpoint it doesnt..

Ok..when i call fn module again to display the data..it works..but again the problem is when i press F3 it goes to the old grid and then back to the selection screen..am using SLIS..and i cant destroy the old grid..is it possible?(without using LVC)

Best Regards,

rama