7
Getting Started Newsletters Store Search the Community Welcome, Guest Login Register Products Services & Support About SCN Downloads Industries Training & Education Partnership Developer Center Lines of Business University Alliances Events & Webinars Innovation We are improving! The SCN wiki will not be available for new content submission starting August 7th 6PM CET until August 10th 6PM CET. Please plan your SCN wiki tasks accordingly. Added by Kaleemullah, last edited by Manish Kumar on Jun 26, 2013 Code Gallery ABAPOOPS Interactive report with Double click & Hotspot Author:Kaleemullah Submitted:16/11/2007 ALV Interactive Report for Newbees with Hot Spot and Double click to secondary report. REPORT zcls_alv_oops MESSAGE‐ID z1. TABLES : mara. *‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ * Types Declaration.. *‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ TYPES : BEGIN OF t_mara, matnr TYPE matnr, mtart TYPE mtart, maktx TYPE maktx, END OF t_mara, BEGIN OF t_marc, matnr TYPE matnr, werks TYPE werks_d, mtart TYPE mtart, maktx TYPE maktx, END OF t_marc. *‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ * Internal Tables Declaration.. *‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ DATA : i_mara TYPE TABLE OF t_mara, i_marc TYPE TABLE OF t_marc, i_fcat1 TYPE lvc_t_fcat, i_fcat2 TYPE lvc_t_fcat. *‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ * Constants Declaration.. *‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ CONSTANTS : c_cont1 TYPE scrfname VALUE 'CONT1', c_cont2 TYPE scrfname VALUE 'CONT2'. SELECTION‐SCREEN BEGIN OF BLOCK b1 WITH FRAME. SELECTOPTIONS: s_matnr FOR mara‐matnr NO INTERVALS. SELECTION‐SCREEN SKIP 1. PARAMETERS : p_hotspt RADIOBUTTON GROUP r1 DEFAULT 'X', p_bttn RADIOBUTTON GROUP r1. SELECTION‐SCREEN END OF BLOCK b1. * Class forward referncing. CLASS lcl_rcvr_class DEFINITION DEFERRED. *‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐

ABAP-OOPS Interactive Report With Double Click & Hotspot

Embed Size (px)

DESCRIPTION

ABAP OOPs ALV

Citation preview

GettingStarted Newsletters StoreSearchtheCommunityWelcome,Guest Login RegisterProducts Services&Support AboutSCN DownloadsIndustries Training&Education Partnership DeveloperCenterLinesofBusiness UniversityAlliances Events&Webinars InnovationWeareimproving!TheSCNwikiwillnotbeavailablefornewcontentsubmissionstartingAugust7th6PMCETuntilAugust10th6PMCET.PleaseplanyourSCNwikitasksaccordingly.AddedbyKaleemullah,lasteditedbyManishKumaronJun26,2013CodeGalleryABAPOOPSInteractivereportwithDoubleclick&HotspotAuthor:KaleemullahSubmitted:16/11/2007ALVInteractiveReportforNewbeeswithHotSpotandDoubleclicktosecondaryreport.REPORTzcls_alv_oopsMESSAGEIDz1.TABLES:mara.**TypesDeclaration..*TYPES:BEGINOFt_mara,matnrTYPEmatnr,mtartTYPEmtart,maktxTYPEmaktx,ENDOFt_mara,BEGINOFt_marc,matnrTYPEmatnr,werksTYPEwerks_d,mtartTYPEmtart,maktxTYPEmaktx,ENDOFt_marc.**InternalTablesDeclaration..*DATA:i_maraTYPETABLEOFt_mara,i_marcTYPETABLEOFt_marc,i_fcat1TYPElvc_t_fcat,i_fcat2TYPElvc_t_fcat.**ConstantsDeclaration..*CONSTANTS:c_cont1TYPEscrfnameVALUE'CONT1',c_cont2TYPEscrfnameVALUE'CONT2'.SELECTIONSCREENBEGINOFBLOCKb1WITHFRAME.SELECTOPTIONS:s_matnrFORmaramatnrNOINTERVALS.SELECTIONSCREENSKIP1.PARAMETERS:p_hotsptRADIOBUTTONGROUPr1DEFAULT'X',p_bttnRADIOBUTTONGROUPr1.SELECTIONSCREENENDOFBLOCKb1.*Classforwardreferncing.CLASSlcl_rcvr_classDEFINITIONDEFERRED.**PointersDeclaration..*DATA:lp_rcvrTYPEREFTOlcl_rcvr_class,lp_cont1TYPEREFTOcl_gui_custom_container,lp_cont2TYPEREFTOcl_gui_custom_container,lp_grid1TYPEREFTOcl_gui_alv_grid,lp_grid2TYPEREFTOcl_gui_alv_grid.**LocalClassDefiniton.*CLASSlcl_rcvr_classDEFINITION.PUBLICSECTION.METHODS:hotspot_clickFOREVENThotspot_clickOFcl_gui_alv_gridIMPORTINGe_row_ide_column_ides_row_no,handle_double_clickFOREVENTdouble_clickOFcl_gui_alv_gridIMPORTINGe_rowe_column.ENDCLASS."lcl_rcvr_classDEFINITION**LocalClassImplementation.*CLASSlcl_rcvr_classIMPLEMENTATION.METHODhotspot_click.DATA:wa_maraTYPEt_mara,wa_marcTYPEt_marc.DATA:l_indexTYPEsytabix.READTABLEi_maraINTOwa_maraINDEXe_row_idindex.IFsysubrcEQ0.REFRESHi_marc.SELECTmatnrwerksINTOTABLEi_marcFROMmarcWHEREmatnrEQwa_maramatnr.IFsysubrcEQ0.LOOPATi_marcINTOwa_marc.l_index=sytabix.wa_marcmtart=wa_maramtart.wa_marcmaktx=wa_maramaktx.MODIFYi_marcFROMwa_marcINDEXl_indexTRANSPORTINGmtartmaktx.ENDLOOP.CALLSCREEN200.ELSE.MESSAGEe121WITHtext005wa_maramatnr.ENDIF.ENDIF.ENDMETHOD."hotspot_clickMETHODhandle_double_click.DATA:wa_maraTYPEt_mara,wa_marcTYPEt_marc.DATA:l_indexTYPEsytabix.READTABLEi_maraINTOwa_maraINDEXe_rowindex.IFsysubrcEQ0.REFRESHi_marc.SELECTmatnrwerksINTOTABLEi_marcFROMmarcWHEREmatnrEQwa_maramatnr.IFsysubrcEQ0.LOOPATi_marcINTOwa_marc.l_index=sytabix.wa_marcmtart=wa_maramtart.wa_marcmaktx=wa_maramaktx.MODIFYi_marcFROMwa_marcINDEXl_indexTRANSPORTINGmtartmaktx.ENDLOOP.CALLSCREEN200.ELSE.MESSAGEe121WITHtext005wa_maramatnr.ENDIF.ENDIF.ENDMETHOD."handle_double_clickENDCLASS."lcl_rcvr_classIMPLEMENTATION**StartofSelection*STARTOFSELECTION.*ExtracttheMaterialMasterdatafortheInputMaterial.SELECTa~matnra~mtartb~maktxINTOTABLEi_maraFROMmaraASaINNERJOINmaktASbONa~matnrEQb~matnrWHEREa~matnrINs_matnrANDb~sprasEQsylangu.ENDOFSELECTION.IFNOTi_mara[]ISINITIAL.*CallScreentodisplaytheMaterialMasterdata.CALLSCREEN100.ELSE.MESSAGEs121WITHtext006.ENDIF.*&**&ModuleDISP_GRIDOUTPUT*&*MODULEdisp_gridOUTPUT.*BuildtheFieldcatelogforMaterialMasterdata.PERFORMbuild_fcat.*DisplaytheMaterialMasterdatausingALV.PERFORMdisp_alv.ENDMODULE."DISP_GRIDOUTPUT*&**&ModuleUSER_COMMAND_0100INPUT*&*MODULEuser_command_0100INPUT.*whenexitorcancelisclickedprogramhastocomeoutCASEsyucomm.WHEN'EXIT'OR'CANC'.LEAVEPROGRAM.WHEN'BACK'.LEAVETOSCREEN0.ENDCASE.ENDMODULE."USER_COMMAND_0100INPUT*&**&Formbuild_fcat*&*FORMbuild_fcat.DATA:ws_fcatTYPElvc_s_fcat.ws_fcatfieldname='MATNR'.ws_fcatscrtext_m=text001.ws_fcattabname='I_MARA'.IFp_hotsptEQ'X'.ws_fcathotspot='X'.ENDIF.APPENDws_fcatTOi_fcat1.CLEARws_fcat.ws_fcatfieldname='MTART'.ws_fcatscrtext_m=text002.ws_fcattabname='I_MARA'.APPENDws_fcatTOi_fcat1.CLEARws_fcat.ws_fcatfieldname='MAKTX'.ws_fcatscrtext_m=text003.ws_fcattabname='I_MARA'.APPENDws_fcatTOi_fcat1.CLEARws_fcat.ENDFORM."build_fcat*&**&Formdisp_alv*&*FORMdisp_alv.IFlp_cont1ISINITIAL.*CreatetheContainerObjectofMaterialMaster.CREATEOBJECTlp_cont1EXPORTINGcontainer_name=c_cont1EXCEPTIONScntl_error=1cntl_system_error=2create_error=3lifetime_error=4lifetime_dynpro_dynpro_link=5OTHERS=6.IFsysubrcNE0.MESSAGEIDsymsgidTYPEsymsgtyNUMBERsymsgnoWITHsymsgv1symsgv2symsgv3symsgv4.ELSE.*CreatetheObjectforGridofMaterialMaster.CREATEOBJECTlp_grid1EXPORTINGi_parent=lp_cont1EXCEPTIONSerror_cntl_create=1error_cntl_init=2error_cntl_link=3error_dp_create=4OTHERS=5.IFsysubrcNE0.MESSAGEIDsymsgidTYPEsymsgtyNUMBERsymsgnoWITHsymsgv1symsgv2symsgv3symsgv4.ELSE.*DipslayMaterialMasterdatabycallingmethod.CALLMETHODlp_grid1>set_table_for_first_displayCHANGINGit_outtab=i_marait_fieldcatalog=i_fcat1EXCEPTIONSinvalid_parameter_combination=1program_error=2too_many_lines=3OTHERS=4.IFsysubrcNE0.MESSAGEIDsymsgidTYPEsymsgtyNUMBERsymsgnoWITHsymsgv1symsgv2symsgv3symsgv4.ELSE.*SetHandlerfortheHotSpotEvent.CREATEOBJECTlp_rcvr.IFp_hotsptEQ'X'.SETHANDLERlp_rcvr>hotspot_clickFORlp_grid1.ELSE.SETHANDLERlp_rcvr>handle_double_clickFORlp_grid1.ENDIF.ENDIF.ENDIF.ENDIF.ENDIF.ENDFORM."disp_alv*&**&ModuleSTATUS_0100OUTPUT*&*MODULEstatus_0100OUTPUT.SETPFSTATUS'MAIN_STAT'.SETTITLEBAR'T_100'.ENDMODULE."STATUS_0100OUTPUT*&**&ModuleSTATUS_0200OUTPUT*&*MODULEstatus_0200OUTPUT.SETPFSTATUS'PLANT_STAT'.SETTITLEBAR'T_200'.ENDMODULE."STATUS_0200OUTPUT*&**&ModuleDISP_GRID_plantOUTPUT*&*MODULEdisp_grid_plantOUTPUT.*BuildtheFieldcatelogforMaterialPlantdata.PERFORMbuild_fcat_plant.*DisplaytheMaterialMasterPlantdatausingALV.PERFORMdisp_alv_plant.ENDMODULE."DISP_GRID_plantOUTPUT*&**&ModuleUSER_COMMAND_0200INPUT*&*MODULEuser_command_0200INPUT.*whenexitorcancelisclickedprogramhastocomeoutCASEsyucomm.WHEN'EXIT'OR'CANC'.LEAVEPROGRAM.WHEN'BACK'.LEAVETOSCREEN0.ENDCASE.ENDMODULE."USER_COMMAND_0200INPUT*&**&Formbuild_fcat_plant*&*FORMbuild_fcat_plant.DATA:ws_fcatTYPElvc_s_fcat.ws_fcatfieldname='MATNR'.ws_fcatscrtext_m=text001.ws_fcattabname='I_MARC'.APPENDws_fcatTOi_fcat2.CLEARws_fcat.ws_fcatfieldname='WERKS'.ws_fcatscrtext_m=text004.ws_fcattabname='I_MARC'.APPENDws_fcatTOi_fcat2.CLEARws_fcat.ws_fcatfieldname='MTART'.ws_fcatscrtext_m=text002.ws_fcattabname='I_MARC'.APPENDws_fcatTOi_fcat2.CLEARws_fcat.ws_fcatfieldname='MAKTX'.ws_fcatscrtext_m=text003.ws_fcattabname='I_MARC'.APPENDws_fcatTOi_fcat2.CLEARws_fcat.ENDFORM."build_fcat_plant*&**&Formdisp_alv_plant*&*FORMdisp_alv_plant.IFlp_cont2ISINITIAL.*CreatetheContainerObjectofMaterialPlantdata.CREATEOBJECTlp_cont2EXPORTINGcontainer_name=c_cont2EXCEPTIONScntl_error=1cntl_system_error=2create_error=3lifetime_error=4lifetime_dynpro_dynpro_link=5OTHERS=6.IFsysubrcNE0.MESSAGEIDsymsgidTYPEsymsgtyNUMBERsymsgnoWITHsymsgv1symsgv2symsgv3symsgv4.ELSE.*CreatetheObjectforGridofMaterialPlantdata.CREATEOBJECTlp_grid2EXPORTINGi_parent=lp_cont2EXCEPTIONSerror_cntl_create=1error_cntl_init=2error_cntl_link=3error_dp_create=4OTHERS=5.IFsysubrcNE0.MESSAGEIDsymsgidTYPEsymsgtyNUMBERsymsgnoWITHsymsgv1symsgv2symsgv3symsgv4.ELSE.*DisplayMaterialPlantdatabycallingmethod.CALLMETHODlp_grid2>set_table_for_first_displayCHANGINGit_outtab=i_marcit_fieldcatalog=i_fcat2EXCEPTIONSinvalid_parameter_combination=1program_error=2too_many_lines=3OTHERS=4.IFsysubrcNE0.MESSAGEIDsymsgidTYPEsymsgtyNUMBERsymsgnoWITHsymsgv1symsgv2symsgv3symsgv4.ENDIF.ENDIF.ENDIF.ELSE.*Callmethod'REFRESH_TABLE_DISPLAY'torefreshthegriddata.CALLMETHODlp_grid2>refresh_table_display.ENDIF.ENDFORM."disp_alv_plantadd call screen snap shot program abap FollowSCNContactUs SAPHelpPortalPrivacy TermsofUse LegalDisclosure Copyright