Problem while setting PF_status in ALV Grid Display
Hi,
i have a final internal table with first field as a check box. I have delete button on application tool-bar, with usercommand and pf status defined for it.
Once the output is displayed i should have the option of checking the line (check box) and delete then records from the list.
problem here is once i check the box and click on delete button is not getting deleted. but instead if i check the box and double click on the line(ie f2 fuctionality) and then click on refresh, then the records are getting deleted.
i have not provided and pf status for f2 functionality, by default its getting activated before the delete fuctionality is called.
i have attached my code below.
DATA : fk_events TYPE slis_t_event,
f_user_command TYPE slis_formname VALUE 'USER_COMMAND',
f_status TYPE slis_formname VALUE 'STANDARD_SP01',
fieldnam(10) TYPE c.
DATA: gs_layout TYPE slis_layout_alv.
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = fk_events.
READ TABLE fk_events INTO ls_event WITH KEY name = slis_ev_user_command
IF sy-subrc = 0.
MOVE f_user_command TO ls_event-form.
MODIFY fk_events FROM ls_event TRANSPORTING form WHERE name =
ls_event-name.
ENDIF.
READ TABLE fk_events INTO ls_event WITH KEY name =
slis_ev_pf_status_set
IF sy-subrc = 0.
MOVE f_status TO ls_event-form.
MODIFY fk_events FROM ls_event TRANSPORTING form WHERE name =
ls_event-name.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZWR_SECOND_TO_CREATION1'
i_callback_pf_status_set = f_status
i_callback_user_command = f_user_command
it_fieldcat = gt_fieldcat[]
it_events = fk_events[]
TABLES
t_outtab = gt_final[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
FORM user_command USING r_comm TYPE sy-ucomm
rs_selfield TYPE slis_selfield.
fieldnam = rs_selfield-fieldname.
CASE r_comm.
WHEN 'DELETE''.
LOOP AT gt_final INTO gk_final.
IF gk_final-del_sat = 'X'.
DELETE gt_final WHERE vbeln = gk_final-vbeln.
ENDIF.
rs_selfield-refresh = 'X'.
ENDLOOP.
WHEN OTHERS.
EXIT.
ENDCASE.
FORM standard_sp01 USING extab TYPE slis_t_extab.
SET PF-STATUS 'RAM' EXCLUDING extab. " For PF-Status
ENDFORM. "STANDARD_SP01
i wud be very thankful if someone cud help me
thanx
ram
Hi,
i have a final internal table with first field as a check box. I have delete button on application tool-bar, with usercommand and pf status defined for it.
Once the output is displayed i should have the option of checking the line (check box) and delete then records from the list.
problem here is once i check the box and click on delete button is not getting deleted. but instead if i check the box and double click on the line(ie f2 fuctionality) and then click on refresh, then the records are getting deleted.
i have not provided and pf status for f2 functionality, by default its getting activated before the delete fuctionality is called.
i have attached my code below.
DATA : fk_events TYPE slis_t_event,
f_user_command TYPE slis_formname VALUE 'USER_COMMAND',
f_status TYPE slis_formname VALUE 'STANDARD_SP01',
fieldnam(10) TYPE c.
DATA: gs_layout TYPE slis_layout_alv.
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = fk_events.
READ TABLE fk_events INTO ls_event WITH KEY name = slis_ev_user_command
IF sy-subrc = 0.
MOVE f_user_command TO ls_event-form.
MODIFY fk_events FROM ls_event TRANSPORTING form WHERE name =
ls_event-name.
ENDIF.
READ TABLE fk_events INTO ls_event WITH KEY name =
slis_ev_pf_status_set
IF sy-subrc = 0.
MOVE f_status TO ls_event-form.
MODIFY fk_events FROM ls_event TRANSPORTING form WHERE name =
ls_event-name.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZWR_SECOND_TO_CREATION1'
i_callback_pf_status_set = f_status
i_callback_user_command = f_user_command
it_fieldcat = gt_fieldcat[]
it_events = fk_events[]
TABLES
t_outtab = gt_final[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
FORM user_command USING r_comm TYPE sy-ucomm
rs_selfield TYPE slis_selfield.
fieldnam = rs_selfield-fieldname.
CASE r_comm.
WHEN 'DELETE''.
LOOP AT gt_final INTO gk_final.
IF gk_final-del_sat = 'X'.
DELETE gt_final WHERE vbeln = gk_final-vbeln.
ENDIF.
rs_selfield-refresh = 'X'.
ENDLOOP.
WHEN OTHERS.
EXIT.
ENDCASE.
FORM standard_sp01 USING extab TYPE slis_t_extab.
SET PF-STATUS 'RAM' EXCLUDING extab. " For PF-Status
ENDFORM. "STANDARD_SP01
i wud be very thankful if someone cud help me
thanx
ram
Similar Messages
-
Problem with check box in ALV Grid Display
I am Displaying Material Master Data in ALV Grid Display with Check Box for each record and if i checked check box then i am processing Update operation in Database, my question is after perform update operation check box should be clear.
Kindly help me!!!!Hello Raj
Given the fact that you do not tell us the most important piece of information (namely whether you are using OO-based ALV or not) I assume you are using fm-based ALV lists.
In this case you probably have defined a USER_COMMAND routine as described in the documentation of the fm.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
* define local data
DATA: ls_outtab LIKE LINE OF gt_outtab,
ld_idx TYPE i.
LOOP AT gt_outtab INTO ls_outtab
WHERE ( chkbox = 'X' ).
ld_idx = syst-tabix.
" Call your update function / method / perform
ls_outtab-chkbox = space.
MODIFY gt_outtab FROM ls_outtab INDEX ld_Idx
TRANSPORTING chkbox.
ENDLOOP.
" And now trigger refresh of the ALV display:
rs_selfield-refresh = 'X'. " <<< !!!
ENDFORM.
Regards
Uwe -
Problem While Saving the editable ALV GRID
Dear Experts,
I have a scenario in which i am display the ALV(using class) with some data in the custom container of module pool screen in the non-editable mode.Also i have save and edit buttons.If i click the edit button i have written the code to edit the some columns in the ALV grid, it is working fine.After editing it,when i click the save button then ALV has to refreshed with edited data and then it should go to non editable mode but it is not working.I have written the code for changing the editable ALv to non editable mode as follows :
call method c_alvgd->set_ready_for_input
exporting
i_ready_for_input = 0.
*****Row and column of the alv are refreshed after changing values
stable-row = 'X'.
stable-col = 'X'.
*REfreshed ALV display with the changed values
*This ALV is non editable and contains new values
call method c_alvgd->refresh_table_display
exporting
is_stable = stable
exceptions
finished = 1
others = 2.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Could you Suggest me solution for this issue ?
Thanks & Regards,
R.Dhineshraj.Dhinesh,
I suppose that you are able to get your changes values on screen but not able to get your field in DISPLAY mode from editable mode, let me know if this is not your problem.
When you press SAVE, after the PAI, again PBO will run and hence the editable code for that field will overwrite which will keep it editable.
So, do something like this.
data: gv_edit value 'X'..... "global variable in TOP include
PBO....
loop at ...
if gv_edit = 'X'.
CALL METHOD lo_alv->set_ready_for_input
EXPORTING
i_ready_for_input = 1.
else.
CALL METHOD lo_alv->set_ready_for_input
EXPORTING
i_ready_for_input = 0.
endif.
endloop.
PAI.
when 'SAVE'.
gv_edit = space.
When 'EDIT'.
gv_edit = 'X'.
Regards,
Diwakar -
How to find the check box selected while using Class in ALV grid display
hi,
I am displaying the ALV report using Class
For Example: CALL METHOD MYGRID->SET_TABLE_FOR_FIRST_DISPLAY EXPORTING I_STRUCTURE_NAME = 'ACC1'
IS_VARIANT = GS_VARIANT
I_SAVE = 'A' "XSAVE
IS_LAYOUT = LOUT
CHANGING IT_FIELDCATALOG = IT_FIELD
IT_OUTTAB = ACC_NO[].
In output i am getting 10 customer with check box, how do i find that customer number is selected.HI,
Once user selects a check box, he would CLICK on a button ( say PROCESS )inorder to do the processing for the selected records. So in the PAI, under the EVENT ( OK CODE ) of the Button ( say PROCESS ), write the following code.
CALL METHOD MYGRID->check_changed_data.
Now,
Loop at acc_no where check = `X`.
Do the processing.
endloop.
Best regards,
Prashant -
Problem while alv grid display exporting to excel sheet
Hi,
I have done an ALV report using reuse_alv_grid _display , out put is fine , but when i click on excel view icon i could only see an excel sheet without any data ., but when i use export to local file and choose spread sheet its giving the data in excel, but the user wants to click only the excel view icon.
Best RegardsHi,
Check this link
[Problem with Excel button in ALV Grid...URGENT;
Regards,
Sathish Reddy. -
Hi,
I have developed ALV Grid Report. It is working fine.
But while i am coming from alv grid display to program
by pressing BACK button it is showing one more screen
which is empty. Again I press back button it is coming to
selection screen. I don't want that empty screen.What is
the problem. Can u help me in this regard.?
Thanks
Narasimhahi
under the usercommand of back button use Exit Statement
like
At user-comand
IF sy-ucom = 'Back'
EXIT
ENdif.
Cheers
Snehi -
ALV GRID Display Column Width problem when filtering
Hello All,
When i displaying ALV Grid Display ,i selected one column and set filter for that.
the problem is column width at display is 12 charecters but in filter it is allowing only 10 charecters to enter which is wrong. i am unable to set filter.please give solution.
Thanks
Sandeep.Ghello i am calling perform, ineed to set OUTPUTLEN according to field length how can i do that.
FORM fill_fieldcat USING p_field TYPE slis_fieldcat_alv-fieldname
p_text TYPE slis_fieldcat_alv-seltext_l
p_flag TYPE c.
wa_fieldcat-fieldname = p_field.
wa_fieldcat-seltext_l = p_text.
wa_fieldcat-no_out = p_flag.
wa_fieldcat-outputlen = 20.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat. -
Problem with ALV Grid Display screen Back Button
Dear Friends ,
I have an ALV Grid Display,Here am facing a problem for my 'Back' button,i haven't defined any PF Status and is using the standard one.But after the Display when i press Back Button a blank Screen is appearing n then again i have to press back button to go to my Selection Screen.
Please Suggest if i have to take care of something else.
I want my Selection Screen when i press Back on my Display Screen.
DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT TYPE SLIS_FIELDCAT_ALV.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = 'ZRMMPD01A'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_FINAL
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
Thanks and Regards,
AshwiniHi Vijay ,
No i dont have any write statement in my proggram.
Here it is
REPORT ZRMMPD01A NO STANDARD PAGE HEADING.
TABLES : EQUI,SER03,MKPF,OBJK.
TYPE-POOLS : SLIS.
DATA IT_EQUI LIKE EQUI OCCURS 0 WITH HEADER LINE.
DATA IT_OBJK LIKE OBJK OCCURS 0 WITH HEADER LINE..
DATA IT_SER03 LIKE SER03 OCCURS 0 WITH HEADER LINE.
DATA IT_MKPF LIKE MKPF OCCURS 0 WITH HEADER LINE .
DATA : BEGIN OF IT_DISPLAY OCCURS 0,
MATNR LIKE EQUI-MATNR,
SERNR LIKE EQUI-SERNR,
BWART LIKE SER03-BWART,
WERK LIKE SER03-WERK,
CHARGE LIKE SER03-CHARGE,
LAGERORT LIKE SER03-LAGERORT,
MBLNR LIKE SER03-MBLNR,
MJAHR LIKE SER03-MJAHR,
ZEILE LIKE SER03-ZEILE,
BUDAT LIKE MKPF-BUDAT,
BKTXT LIKE MKPF-BKTXT,
USNAM LIKE MKPF-USNAM,
XBLNR LIKE MKPF-XBLNR,
END OF IT_DISPLAY.
DATA : WA_DISPLAY LIKE IT_DISPLAY.
DATA IT_FINAL LIKE IT_DISPLAY OCCURS 0 WITH HEADER LINE.
DATA IT_TEMP LIKE IT_DISPLAY OCCURS 0 WITH HEADER LINE.
DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA :I_LAYOUT TYPE SLIS_LAYOUT_ALV,
I_EVENTS TYPE SLIS_T_EVENT.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_MATNR FOR EQUI-MATNR MATCHCODE OBJECT MCD,"OBLIGATORY
S_SERNR FOR EQUI-SERNR, "MATCHCODE OBJECT MCD OBLIGATORY
S_MBLNR FOR SER03-MBLNR MATCHCODE OBJECT MCD,
S_BWART FOR SER03-BWART MATCHCODE OBJECT MCD,
S_WERK FOR SER03-WERK MATCHCODE OBJECT MCD,
S_LAGET FOR SER03-LAGERORT MATCHCODE OBJECT MCD,
S_BUDAT FOR MKPF-BUDAT MATCHCODE OBJECT MCD,
S_XBLNR FOR MKPF-XBLNR MATCHCODE OBJECT MCD.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
PARAMETERS : R1 RADIOBUTTON GROUP G1 DEFAULT 'X',
R2 RADIOBUTTON GROUP G1.
SELECTION-SCREEN END OF BLOCK B2.
START-OF-SELECTION.
*Fetch Data.
PERFORM GET_DATA.
*Fill Display Fields.
PERFORM FILL_TABLE.
*Segregate data according to radio button selection.
PERFORM SELECT_CONDITION.
*Fill The Feild catalog.
PERFORM FIELD_CATALOG.
*Display Output.
PERFORM OUTPUT_DISPLAY..
*& Form GET_DATA
text
--> p1 text
<-- p2 text
FORM GET_DATA.
SELECT * FROM EQUI INTO TABLE IT_EQUI
WHERE MATNR IN S_MATNR
AND SERNR IN S_SERNR.
SELECT * FROM OBJK INTO TABLE IT_OBJK
FOR ALL ENTRIES IN IT_EQUI
WHERE EQUNR = IT_EQUI-EQUNR.
SELECT * FROM SER03 INTO TABLE IT_SER03
FOR ALL ENTRIES IN IT_OBJK
WHERE OBKNR = IT_OBJK-OBKNR
AND MBLNR IN S_MBLNR
AND BWART IN S_BWART
AND WERK IN S_WERK
AND LAGERORT IN S_LAGET.
SELECT * FROM MKPF INTO TABLE IT_MKPF
FOR ALL ENTRIES IN IT_SER03
WHERE MBLNR = IT_SER03-MBLNR
AND BUDAT IN S_BUDAT
AND XBLNR IN S_XBLNR.
ENDFORM. " GET_DATA
*& Form FILL_TABLE
text
--> p1 text
<-- p2 text
FORM FILL_TABLE.
LOOP AT IT_EQUI.
LOOP AT IT_OBJK.
IF IT_OBJK-EQUNR <> IT_EQUI-EQUNR.
SKIP.
ELSE.
READ TABLE IT_SER03 WITH KEY OBKNR = IT_OBJK-OBKNR.
IF SY-SUBRC = 0.
WA_DISPLAY-MATNR = IT_EQUI-MATNR.
WA_DISPLAY-SERNR = IT_EQUI-SERNR.
WA_DISPLAY-BWART = IT_SER03-BWART.
WA_DISPLAY-WERK = IT_SER03-WERK.
WA_DISPLAY-CHARGE = IT_SER03-CHARGE.
WA_DISPLAY-LAGERORT = IT_SER03-LAGERORT.
WA_DISPLAY-MBLNR = IT_SER03-MBLNR.
WA_DISPLAY-MJAHR = IT_SER03-MJAHR.
WA_DISPLAY-ZEILE = IT_SER03-ZEILE.
READ TABLE IT_MKPF WITH KEY MBLNR = IT_SER03-MBLNR.
IF SY-SUBRC = 0.
WA_DISPLAY-BUDAT = IT_MKPF-BUDAT.
WA_DISPLAY-BKTXT = IT_MKPF-BKTXT.
WA_DISPLAY-USNAM = IT_MKPF-USNAM.
WA_DISPLAY-XBLNR = IT_MKPF-XBLNR.
ENDIF.
ENDIF.
ENDIF.
IF NOT WA_DISPLAY IS INITIAL.
APPEND WA_DISPLAY TO IT_DISPLAY.
CLEAR WA_DISPLAY.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDFORM. " FILL_TABLE
*& Form FIELD_CATALOG
text
--> p1 text
<-- p2 text
FORM FIELD_CATALOG.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'MATNR'.
FIELDCAT-SELTEXT_M = 'Material Number'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'SERNR'.
FIELDCAT-SELTEXT_M = 'Serial number'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'MBLNR'.
FIELDCAT-SELTEXT_L = 'Number of material document'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'BWART'.
FIELDCAT-SELTEXT_M = 'Movement type'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'WERK'.
FIELDCAT-SELTEXT_M = 'Plant'.
FIELDCAT-OUTPUTLEN = 5.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'CHARGE'.
FIELDCAT-SELTEXT_M = 'Batch number'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'LAGERORT'.
FIELDCAT-SELTEXT_M = 'Storage Location'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'MJAHR'.
FIELDCAT-SELTEXT_M = 'Material doc. year'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'ZEILE'.
FIELDCAT-SELTEXT_L = 'Item in material document'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'BUDAT'.
FIELDCAT-SELTEXT_L = 'Posting date in the document'.
FIELDCAT-OUTPUTLEN = 10.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'BKTXT'.
FIELDCAT-SELTEXT_L = 'Document header text'.
FIELDCAT-OUTPUTLEN = 25.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'USNAM'.
FIELDCAT-SELTEXT_M = 'User name'.
FIELDCAT-OUTPUTLEN = 15.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'XBLNR'.
FIELDCAT-SELTEXT_L = 'Reference document number'.
FIELDCAT-OUTPUTLEN = 25.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
ENDFORM. " FIELD_CATALOG
*& Form DISPLAY_OUTPUT
text
--> p1 text
<-- p2 text
FORM OUTPUT_DISPLAY.
IF R1 = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'ZRMMPD01A'
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = IT_DISPLAY
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH IT_DISPLAY.
CLEAR IT_DISPLAY.
ELSEIF R2 = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'ZRMMPD01A'
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = IT_FINAL
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH IT_DISPLAY.
CLEAR IT_DISPLAY.
ENDIF.
ENDFORM. " DISPLAY_OUTPUT
*& Form SELECT_CONDITION
text
--> p1 text
<-- p2 text
FORM SELECT_CONDITION.
IF R2 = 'X'.
CLEAR WA_DISPLAY.
SORT IT_DISPLAY BY MATNR SERNR MBLNR ZEILE.
DELETE ADJACENT DUPLICATES FROM IT_DISPLAY.
LOOP AT IT_DISPLAY WHERE ZEILE = '0002'.
READ TABLE IT_DISPLAY WITH KEY MATNR = IT_DISPLAY-MATNR
SERNR = IT_DISPLAY-SERNR ZEILE = '0001'.
IF SY-SUBRC = 0.
DELETE IT_DISPLAY.
ENDIF.
ENDLOOP.
SORT IT_DISPLAY BY MATNR SERNR BWART MBLNR.
DELETE ADJACENT DUPLICATES FROM IT_DISPLAY.
LOOP AT IT_DISPLAY.
IF WA_DISPLAY IS INITIAL.
WA_DISPLAY = IT_DISPLAY.
ENDIF.
LOOP AT IT_DISPLAY WHERE MATNR = WA_DISPLAY-MATNR
AND SERNR = WA_DISPLAY-SERNR.
IF IT_DISPLAY-BUDAT > WA_DISPLAY-BUDAT.
WA_DISPLAY = IT_DISPLAY.
ELSE.
DELETE IT_DISPLAY.
ENDIF.
ENDLOOP.
APPEND WA_DISPLAY TO IT_TEMP.
CLEAR WA_DISPLAY.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM IT_TEMP.
IF NOT IT_TEMP[] IS INITIAL.
IT_FINAL[] = IT_TEMP[].
ENDIF.
ENDIF.
ENDFORM. " SELECT_CONDITION
Regards,
Ashwini -
ALV GRID DISPLAY -Problem with Layout
Hi,
I'm using ALV GRID DISPLAY. I ran the program and in the output i created a layout Test1.Later i created a layout Test2. Now when i run the report, when i select layout Test1, the display is not as selected for the layout. but when i manualy select the layout throu change layout-->Test1, the display is working good. Can someone tell me what the problem can be?
Thanks
Challahi,
in the FM have you filled the structure IS_VARIANT.
is_variant-report = sy-repid.
is_variant-variant = <variant name>.
Regards,
Leo -
Problem in placing the background in ALV Grid display
I have created one image of the business flow, and it have to be displayed in the background of ALV grid display.
For this I have gone to T.Code <b>OAER</b> , Given class name as <b>PICTURES</b> , Class type as <b>OT</b> , Object Key <b>BACKGROUND</b>, clicked on the triangle of Standard Doc , then double click on screen, and finally uploaded the background into SAP.
In the function module <b>REUSE_ALV_GRID_DISPLAY</b> I passed this background to the parameter I_BACKGROUND_ID.
It is working fine, and I was able to see the back ground in my program.
(developed in IDES)
But the same is not working in my development client, will some one suggest be the reason for the problem. Please kindly help me out from this problem.hello Dinesh,
I have created the object key in the development client itself and used in the grid display of the same client. i am not understanding where the problem is, any how thank you very much for your responce. if you have any other solution please let me know.
Thank you -
Disabling "Default layout setting" in ALV grid display
Hello,
We have a requirement where we need to disable layout default settings in ALV grid display.
Only certain users should be able to save the report layout as default.
We would be creating an authorization group for this and then based on the Authority check we would need to enable or disable Default layout save option.
I found that using I_SAVE in the FM "REUSE_ALV_GRID_DISPLAY", we can either enable or disable layout save option.
But our requirement is to disable Default layout save option based on the authority check.
We will find this option next to User specific option when we save the report layout.
Can anyone guide me on this?
Thanks,
Regards,
AnidHi Anid,
First of all check if you can do this excluding the buttons from the ALV with the excluding tab. If not, here is the code for the ALV OO to exclude the buttons.
FORM F_DISPLAY_ALV.
* Layout
PERFORM f_layout.
* Exclude Buttons
DATA: gt_excl TYPE ttb_button
REFRESH gt_excl.
* Append those you want to exclude. These are some of them. Check Class in SE24 -> Atributes of class cl_gui_alv_grid.
APPEND: cl_gui_alv_grid=>mc_fc_loc_cut TO gt_excl,
cl_gui_alv_grid=>mc_fc_loc_undo TO gt_excl,
cl_gui_alv_grid=>mc_fc_loc_copy TO gt_excl,
cl_gui_alv_grid=>mc_fc_loc_paste TO gt_excl,
cl_gui_alv_grid=>mc_fc_loc_copy_row TO gt_excl,
cl_gui_alv_grid=>mc_fc_loc_move_row TO gt_excl,
cl_gui_alv_grid=>mc_fc_loc_delete_row TO gt_excl,
cl_gui_alv_grid=>mc_fc_loc_insert_row TO gt_excl,
cl_gui_alv_grid=>mc_fc_loc_append_row TO gt_excl,
cl_gui_alv_grid=>mc_fc_loc_paste_new_row TO gt_excl,
cl_gui_alv_grid=>mc_fc_to_office TO gt_excl,
cl_gui_alv_grid=>mc_fc_expcrdesig TO gt_excl.
CALL METHOD gv_alv_grid->set_table_for_first_display
EXPORTING
it_toolbar_excluding = gt_excl[]
is_layout = wa_layout_main
is_variant = wa_variant
i_save = 'A'
CHANGING
it_outtab = gt_alv[]
it_fieldcatalog = gt_fieldcat[]
it_sort = gt_sort[].
Edited by: Ernesto Caballero on Mar 11, 2010 5:59 PM
Edited by: Ernesto Caballero on Mar 11, 2010 6:03 PM -
Custom buttons in ALV grid display
I want to add custom buttons on application toolbar while displaying an ALV report using grid display.
how can it be done?Hi
In order to add user command functioality to the ALV grid you need to perform the following steps:
1. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include 'USER_COMMAND' FORM
2. Create 'USER_COMMAND' FORM
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE'
I_callback_user_command = 'USER_COMMAND' "see FORM
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
FORM USER_COMMAND *
--> R_UCOMM *
--> RS_SELFIELD *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
Check function code
CASE r_ucomm.
WHEN '&IC1'.
Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'EBELN'.
Read data table, using index of row user clicked on
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
Set parameter ID for transaction screen field
SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
Sxecute transaction ME23N, and skip initial data entry screen
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM.
In order modify PF_STATUS of ALV grid report you need to perform the following steps:
1. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include:
i_callback_pf_status_set = 'SET_PF_STATUS' statement.
2. Create 'SET_PF_STATUS' FORM
3. Create pf_status (i.e. 'ZNEWSTATUS').
- It is recommend that you copy standard status'STANDARD' from function group SALV
and modify it accordingly. ALV standard function codes always start with '&'.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE'
i_callback_pf_status_set = 'SET_PF_STATUS' "see FORM
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
FORM SET_PF_STATUS *
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZNEWSTATUS'.
"Copy of 'STANDARD' pf_status from fgroup SALV
ENDFORM. -
Field symbol has not yet been defined-ALV Grid Display in Report
Hi all,
Iam calling a Function module for ALV grid display in Report programming. Its throwing the Error message Field Symbol has not yet defined. Can any one suggest what i have to do regarding it?Hi,
<li> This is problem with fieldcatalog.
<li> Check field names or table name in small letters in quotes while building fieldcatalog internal table
<li> Check the fieldcatalog internal table , whether it has same fields as in data table which is shown using GRID_DISPLAY function module.
Thanks
Venkat.O -
How to color a row in ALV grid display
Hi,
A few rows in the output of ALV grid display should be shown in different color.How can I achieve this?Hi,
Try out this code
DATA : BEGIN OF G_T_CASH OCCURS 0,
PARTICULARS TYPE CHAR120,
AMOUNT1 TYPE CHAR20,
AMOUNT2 TYPE CHAR20,
AMOUNT3 TYPE CHAR20,
ROW_COLOR TYPE CHAR4,----
add this in the internal table for alv
END OF G_T_CASH.
CLEAR G_WA_CASH.
G_WA_CASH-PARTICULARS = 'Opening Cash Balance'.
G_WA_CASH-AMOUNT1 = G_DMBTR.
G_WA_CASH-AMOUNT2 = ''.
G_WA_CASH-AMOUNT3 = ''.
while appending other values also add the following code
G_WA_CASH-ROW_COLOR = 'C200'.----- C200 depicts light gray color
APPEND G_WA_CASH TO G_T_CASH.
add the following code in layout
MOVE 'ROW_COLOR' TO WA_LS_LAYOUT-INFO_FIELDNAME.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_BYPASSING_BUFFER = ' '
I_SAVE = 'A'
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = WA_LS_LAYOUT
IT_FIELDCAT = G_T_CATALOG
IT_EVENTS = GT_EVENTS
TABLES
T_OUTTAB = G_T_CASH[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Let me know if the problem still persist.
Regards,
Janaki -
TO enable the menu button in ALV Grid Display
Hi Mates,
I have a peculiar problem while doing ALV Grid display for screens.
In the main Screen i have Three coloumns.The 1st coloum will interacted
next screen 101 and 2nd coloum will interacted to screen 102.
Now the problem is in the menu of ALV Grid display,the Total button was enabled for screen
101 and same button is disabled in screen 102.
But the code semms to be fine .
Below i have pasted the code and please have a look and help to come out of this cris.
My Code :
FORM CREATE_ALV_GRID USING R_SCREEN.
DATA: LS_LAYOUT TYPE LVC_S_LAYO,
ITAB_FUNCTIONS TYPE UI_FUNCTIONS. "MHTK903257(+)(add)
CASE R_SCREEN.
*--> SCREEN 9000
WHEN C_SCREEN_9000.
*-- Build the field catalog for the ALV grid.
PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000
USING:
*ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
'ITAB_OVERVIEW' 'WADAT' 'Due date'(004) 'X' 'D' ' ' ' ' ' ' 'C100',
*'ITAB_OVERVIEW' 'HU_UNLOAD' 'Unloaded HU'(005) 'X' 'I' '15' ' ' ' ' 'C500', "MHTK903257(-)
'ITAB_OVERVIEW' 'TOT_TO' 'Total TO'(006) 'X' 'I' ' ' ' ' ' ' 'C30',
GMTK901103: REMOVE HOTSPOT ON ESTIMATED TO:
'ITAB_OVERVIEW' 'EST_TO' 'Estim TO'(030) ' ' 'I' ' ' ' ' ' ' 'C500'.
LOOP AT ITAB_INB_LOC WHERE OUTPUT = 'X'.
PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000
USING:
ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
'ITAB_OVERVIEW' ITAB_INB_LOC-FIELDNAME
ITAB_INB_LOC-Z_INBND_LOC 'X' '' ' ' ' ' 'R' 'C500'. "MHTK903418
ENDLOOP.
LOOP AT ITAB_STORAGE_TYPE WHERE OUTPUT = 'X'.
PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000
USING:
*ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
'ITAB_OVERVIEW' ITAB_STORAGE_TYPE-FIELDNAME
ITAB_STORAGE_TYPE-LGTYP 'X' 'I' ' ' ' ' 'R' 'C500'.
ENDLOOP.
*-- Create the ALV grid object.
CREATE OBJECT PT_ALV_1000
EXPORTING
I_PARENT = PT_DOCK_1000.
PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS "MHTK903257(+)(add)
USING R_SCREEN.
*-- Get the title of the ALV grid.
PERFORM GET_ALV_GRID_TITLE USING C_SCREEN_1000
CHANGING LS_LAYOUT-GRID_TITLE.
*-- Display the ALV grid.
CALL METHOD PT_ALV_1000->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = LS_LAYOUT
IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
CHANGING
IT_OUTTAB = ITAB_OVERVIEW
IT_FIELDCATALOG = ITAB_FIELDCAT_9000.
*--> SCREEN 9100
WHEN C_SCREEN_1100.
*-- Build the field catalog for the ALV grid.
PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100
USING:
*ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
'ITAB_DETIAL' 'WAUHR' 'Due time'(007) ' ' 'T' ' ' 'X' ' ' 'C100',
'ITAB_DETAIL' 'TOT_TO' 'Total TO'(006) 'X' 'I' ' ' ' ' ' ' 'C30',
'ITAB_DETAIL' 'EST_TO' 'Estim TO'(030) ' ' 'I' ' ' ' ' ' ' 'C500'.
CLEAR ITAB_INB_LOC.
LOOP AT ITAB_INB_LOC WHERE SELECTED = 'X'.
CHECK SY-SUBRC EQ 0.
PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100
USING:
ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
'ITAB_DETAIL' ITAB_INB_LOC-FIELDNAME
ITAB_INB_LOC-Z_INBND_LOC '' '' ' ' ' ' 'R' 'C500'.
ENDLOOP.
CLEAR: ITAB_STORAGE_TYPE.
LOOP AT ITAB_STORAGE_TYPE WHERE SELECTED = 'X'.
CHECK SY-SUBRC EQ 0.
PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100
USING:
*ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
'ITAB_DETAIL' ITAB_STORAGE_TYPE-FIELDNAME
ITAB_STORAGE_TYPE-LGTYP 'X' 'I' ' ' ' ' 'R' 'C500'.
ENDLOOP.
*-- Create the ALV grid object.
CREATE OBJECT PT_ALV_1100
EXPORTING
I_PARENT = PT_DOCK_1100.
PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS "MHTK903257(+)(add)
USING R_SCREEN.
*-- Get the title of the ALV grid.
PERFORM GET_ALV_GRID_TITLE USING C_SCREEN_1100
CHANGING LS_LAYOUT-GRID_TITLE.
*-- Display the ALV grid.
CALL METHOD PT_ALV_1100->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = LS_LAYOUT
IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
CHANGING
IT_OUTTAB = ITAB_DETAIL
IT_FIELDCATALOG = ITAB_FIELDCAT_1100.
screen 1300 TO detail.
*--> SCREEN 9300
WHEN C_SCREEN_1300.
*-- Build the field catalog for the ALV grid.
PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1300
USING:
*ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
'ITAB_TO2' 'TANUM' 'TO'(020) ' ' 'C' ' ' ' ' ' ' 'C100',
'ITAB_TO2' 'NLPLA' 'Location'(021) ' ' 'C' ' ' ' ' ' ' 'C500',
'ITAB_TO2' 'LETY1' 'SUT'(013) ' ' 'C' ' ' ' ' ' ' 'C500',
'ITAB_TO2' 'MATNR' 'Material'(016) ' ' 'C' ' ' ' ' ' ' 'C500',
'ITAB_TO2' 'NSOLM' 'Quantity'(017) ' ' 'I' ' ' ' ' ' ' 'C500',
'ITAB_TO2' 'NLTYP' 'Storage type'(014) ' ' '' ' ' ' ' ' ' 'C500'. "MHTK903257(-)
*'ITAB_TO2' 'POSNR' 'Line'(015) ' ' 'C' ' ' ' ' ' ' 'C500'. "MHTK903257(-)
*-- Create the ALV grid object.
CREATE OBJECT PT_ALV_1300
EXPORTING
I_PARENT = PT_DOCK_1300.
*-- Exclude the non-applicable functions from the ALV grid.
PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS
USING R_SCREEN.
*-- Get the title of the ALV grid.
PERFORM GET_ALV_GRID_TITLE USING C_SCREEN_1300
CHANGING LS_LAYOUT-GRID_TITLE.
SORT ITAB_TO2 BY TANUM VBELN POSNR.
*-- Display the ALV grid.
CALL METHOD PT_ALV_1300->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = LS_LAYOUT
IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
CHANGING
IT_OUTTAB = ITAB_TO2
IT_FIELDCATALOG = ITAB_FIELDCAT_1300.
screen 9400 Pre Processing detail.
*--> SCREEN 9400
WHEN C_SCREEN_9400. "MHTK903418(BEgin Of change)
*-- Build the field catalog for the ALV grid.
PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1400
USING:
*ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
'ITAB_PRE_PROC2' 'Z_PRE_PROC' 'Pre Processing Number'(030) ' ' 'C' ' ' ' ' ' ' 'C100',
'ITAB_PRE_PROC2' 'Z_PRE_PROC_LN' 'Pre Processing Number'(035) ' ' 'C' ' ' ' ' ' ' 'C100',
'ITAB_PRE_PROC2' 'MATNR' 'Material'(035) ' ' 'C' ' ' ' ' ' ' 'C500',
'ITAB_PRE_PROC2' 'Z_PSH_QTY' 'Quantity'(035) ' ' 'C' ' ' ' ' ' ' 'C500'.
*'ITAB_TO2' 'MATNR' 'Material'(016) ' ' 'C' ' ' ' ' ' ' 'C500',
*'ITAB_TO2' 'NSOLM' 'Quantity'(017) ' ' 'I' ' ' ' ' ' ' 'C500',
*'ITAB_TO2' 'NLTYP' 'Storage type'(014) ' ' '' ' ' ' ' ' ' 'C500'. "MHTK903257(-)
**'ITAB_TO2' 'POSNR' 'Line'(015) ' ' 'C' ' ' ' ' ' ' 'C500'. "MHTK903257(-)
*-- Create the ALV grid object.
CREATE OBJECT PT_ALV_1400
EXPORTING
I_PARENT = PT_DOCK_1400.
*-- Exclude the non-applicable functions from the ALV grid.
PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS
USING R_SCREEN.
*-- Get the title of the ALV grid.
PERFORM GET_ALV_GRID_TITLE USING C_SCREEN_1400
CHANGING LS_LAYOUT-GRID_TITLE.
SORT ITAB_PRE_PROC2 BY Z_PRE_PROC.
*-- Display the ALV grid.
CALL METHOD PT_ALV_1400->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = LS_LAYOUT
IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
CHANGING
IT_OUTTAB = ITAB_PRE_PROC2
IT_FIELDCATALOG = ITAB_FIELDCAT_1400. "MHTK903418(End of change)
ENDCASE.Hi
U copy from standard program and paste ur report ...It will work..'
Regards:
Prabu
Maybe you are looking for
-
Can you change the color of a row in a SUD
Is it possible to change the color in a selected row in a SUD? I have multiple tables in my SUD were the user can select multiple rows from each table. The problem is that when the user selects rows in another table the last one selected in the previ
-
Problems with DSLR Footage in CS 5.5
I am using Premiere CS 5.5. I have no trouble editing AVCHD footage, but a new client is giving me footage shot with various DSLR cameras and this is causing me problems. First, my specs. Windows 7 i7-2600 processor GTX 460 card (1 GB memory, 336 CU
-
How to create a PDF file to power point
I have to chage a PDF file to a power point . How do I do this.Isn't there a real person I can talk to/ I am under pressure to get this done now.
-
Greetings! I run Firefox on Windows XP3 Home, and I would appreciate your advice on some problems I have. When I click on Bookmarks, nothing happens for about 30 secs, then the following message appears; "Script: chrome://browser/content/places/brows
-
hi, Working on oracle 10g is just like a mirage for me. I have installed and uninstalled it many times on my new laptop, but not been able to work on it, because of many oracle problems. my OS is windows xp prof. sp2. i have cracked my brain on acces