ALV Programming and Sapscript...

Hi,
Till date i have only worked in standard reports, now i have to work on ALV report and Sapscript, so if any one have any basic tutorial on ALV and Sapscript, pls email me.
Thanks in advance.

Hi arup,
1. This is the most simple form of alv.
2. Minimum, this much coding is required for a normal alv.
The two main FMs for any alv programming are.
<b>REUSE_ALV_LIST_DISPLAY
REUSE_ALV_FIELDCATALOG_MERGE</b>
3. just copy paste to get a taste of it.
4.
report abc.
TYPE-POOLS : slis.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvfcwa TYPE slis_fieldcat_alv.
data : begin of itab occurs 0.
        include structure usr02.
data : end of itab.
START-OF-SELECTION.
  select * from usr02
  into table itab.
  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_program_name         = sy-repid
      i_internal_tabname     = 'ITAB'
      i_inclname             = sy-repid
    CHANGING
      ct_fieldcat            = alvfc
    EXCEPTIONS
      inconsistent_interface = 1
      program_error          = 2
      OTHERS                 = 3.
IMPORTANT
  LOOP AT ALVFC INTO ALVFCWA.
    IF ALVFCWA-FIELDNAME = 'USTYP'.
      ALVFCWA-NO_CONVEXT = 'X'.
      MODIFY ALVFC FROM ALVFCWA.
    ENDIF.
  ENDLOOP.
Display
  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      it_fieldcat   = alvfc
    TABLES
      t_outtab      = itab
    EXCEPTIONS
      program_error = 1
      OTHERS        = 2.
regards,
amit m.

Similar Messages

  • Customized PO printing program and sapscript

    Hello,
    i have created a customized program and sapscript for PO printing.
    its working fine in our config client..when i moved to our training client... 2 information is not printing (ie: vendor name)
    i tried to do comparision of the program and sapscript of the 2 client and both are same..
    all setting is completed (NACE,MN04 etc) its only the one field not being display when i do my testing in the training client.
    i tried to use debug on training client and noticed that the field for vendor name is not being populated... but its working fine in the config client..same set up of vendor etc.
    anyway i can check what i have missed out ?
    thanks in advance.
    Edited by: she on Dec 28, 2009 7:03 PM
    <MOVED BY MODERATOR TO THE CORRECT FORUM>
    Edited by: Alvaro Tejada Galindo on Dec 28, 2009 2:36 PM

    Make sure the Vendor number and associated information exist in that client as well. Each client may very well have different Vendor numbers

  • Utility for Downloading Z Programs and Sapscripts.

    HI!
    I want to Down load all my Z programs to a local drive. Please help me if you know any utility?
    Thank you,
    DARSHAN
    Message was edited by: Darshankumar Kanubhai Patel

    use this program:
    PROGRAM ZDOWN.
    *========================================================================================================
    Direct Download Enterprise version 1.2.
    THIS SOFTWARE IS FOR PERSONAL USE ONLY.
    THIS PROGRAM IS FREEWARE AND IS PROVIDED ON AN AS-IS BASIS WITHOUT WARRANTY OF ANY KIND.
    THE PROVIDER SPECIFICALLY DISCLAIMS ANY OTHER WARRANTY, EXPRESS OR IMPLIED, INCLUDING ANY WARRANTY OF
    MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
    IN NO EVENT SHALL PROVIDER BE LIABLE FOR ANY CONSEQUENTIAL, INDIRECT, SPECIAL OR INCIDENTAL DAMAGES,
    EVEN IF PROVIDER HAS BEEN ADVISED BY CLIENT OF THE POSSIBILITY OF SUCH POTENTIAL LOSS OR DAMAGE.
    CLIENT AGREES TO HOLD PROVIDER HARMLESS FROM AND AGAINST ANY AND ALL CLAIMS, LOSSES, LIABILITIES AND
    EXPENSES.  BY INSTALLING OR RUNNING THIS PROGRAM YOU ARE AGREEING TO THE TERMS AND CONDITONS STATED
    ABOVE.
    PROGRAM DESCRIPTION & USE
    Allows a user to download programs, Functions, DD definitions, etc to the presentation server.  This
    version searches recursively for nested includes and function modules, and allows you to download
    the resulting code as standard text or HTML web pages within a suitable directory structure.
    You can either search by object name, using wildcards if you wish, or a combination of Author and
    object name.  If you want all objects returned for a particular author then select the author name
    and choose the most suitable radiobutton.  All objects will be returned if the fields to the right
    hand side of the radiobutton are left completely blank.
    Compatible with R/3 Enterprise only, for older versions of SAP you will need Direct Download version 5.xx.
    This version removes the programming limitations imposed by developing across SAP releases 3 to 4.6.
    This program is intended to allow a person to keep a visual representation of a program for backup
    purposes only as has not been designed to allow programs to be uploaded to SAP systems.
    AUTHOR          : E.G.Mellodew
    PROGRAM CONTACT : [email protected]
                      www.dalestech.com
    Types
    text element structure
    types: tTextTable like textpool.
    GUI titles
    types: tGUITitle like d347t.
    Message classes
    types: begin of tMessage,
             arbgb like t100-arbgb,
             stext like t100a-stext,
             msgnr like t100-msgnr,
             text  like t100-text,
           end of tMessage.
    Screen flow.
    types: begin of tScreenFlow,
             screen like d020s-dnum,
             code like d022s-line,
           end of tScreenFlow.
    Holds a table\structure definition
    types: begin of tDictTableStructure,
             fieldname like dd03l-fieldname,
             position  like dd03l-position,
             keyflag   like dd03l-keyflag,
             rollname  like dd03l-rollname,
             domname   like dd03l-domname,
             datatype  like dd03l-datatype,
             leng      like dd03l-leng,
             ddtext    like dd04t-ddtext,
           end of tdictTableStructure.
    Holds a tables attributes + its definition
    types: begin of tDictTable,
             tablename    like dd03l-tabname,
             tableTitle   like dd02t-ddtext,
             iStructure type tDictTableStructure occurs 0,
           end of tDictTable.
    Include program names
    types: begin of tInclude,
             includeName like trdir-name,
             includeTitle like tftit-stext,
           end of tInclude.
    Method
    types: begin of tMethod,
             cmpName like vseomethod-cmpname,
             descript like vseomethod-descript,
             exposure like vseomethod-exposure,
             methodKey type string,
           end of tMethod.
    Class
    types: begin of tClass,
             scanned(1),
             clsname like vseoclass-clsname,
             descript like vseoclass-descript,
             msg_id like vseoclass-msg_id,
             exposure like vseoclass-exposure,
             state like vseoclass-state,
             clsfinal like vseoclass-clsfinal,
             r3release like vseoclass-r3release,
             iMethods type tMethod occurs 0,
             iDictStruct type tDictTable occurs 0,
             iTextElements type tTextTable occurs 0,
             iMessages type tMessage occurs 0,
             textElementKey type string,
             publicClassKey type string,
             privateClassKey type string,
             protectedClassKey type string,
             typesClassKey type string,
             exceptionClass type i,
           end of tClass.
    function modules
    types: begin of tFunction,
             functionName like tfdir-funcName,
             functionGroup like enlfdir-area,
             includeNumber like tfdir-include,
             functionMainInclude like tfdir-funcName,
             functionTitle like tftit-stext,
             topIncludeName like tfdir-funcName,
             progname like tfdir-pname,
             programLinkName like tfdir-pname,
             messageClass like t100-arbgb,
             iTextElements type tTextTable occurs 0,
             iSelectiontexts type tTextTable occurs 0,
             iMessages type tMessage occurs 0,
             iIncludes type tInclude occurs 0,
             iDictStruct type tDictTable occurs 0,
             iGUITitle type tGUITitle occurs 0,
             iScreenFlow type tScreenFlow occurs 0,
           end of tFunction.
    types: begin of tProgram,
             progname like trdir-name,
             programTitle like tftit-stext,
             subc like trdir-subc,
             messageClass like t100-arbgb,
             iMessages type tMessage occurs 0,
             iTextElements type tTextTable occurs 0,
             iSelectiontexts type tTextTable occurs 0,
             iGUITitle type tGUITitle occurs 0,
             iScreenFlow type tScreenFlow occurs 0,
             iIncludes type tInclude occurs 0,
             iDictStruct type tDictTable occurs 0,
           end of tProgram.
    Internal tables
    Dictionary object
    data: iDictionary type standard table of tDictTable with header line.
    Function modules.
    data: iFunctions type standard table of tFunction with header line.
    Tree display structure.
    data: iTreeDisplay type standard table of snodetext with header line.
    Message class data
    data: iMessages type standard table of tMessage with header line.
    Holds a single message class an all of its messages
    data: iSingleMessageClass type standard table of tMessage with header line.
    Holds program related data
    data: iPrograms type standard table of tProgram with header line.
    Classes
    data: iClasses type standard table of tClass with header line.
    Table prototypes
    data: dumiDictStructure type standard table of tDictTableStructure.
    data: dumiTextTab type standard table of tTextTable.
    data: dumiIncludes type standard table of tInclude.
    data: dumiHtml type standard table of string.
    data: dumiHeader type standard table of string .
    data: dumiScreen type standard table of tScreenFlow .
    data: dumIGUITitle type standard table of tGUITitle.
    data: dumiMethods type standard table of tMethod.
      Global objects
    data: objFile type ref to cl_gui_frontend_services.
    data: objRuntimeError type ref to cx_root.
    Constants
    constants: VERSIONNO type string value '1.2'.
    constants: TABLES type string value 'TABLES'.
    constants: LIKE type string value 'LIKE'.
    constants: TYPE type string value 'TYPE'.
    constants: TYPEREFTO type string value 'TYPE REF TO'.
    constants: STRUCTURE type string value 'STRUCTURE'.
    constants: LOWSTRUCTURE type string value 'structure'.
    constants: OCCURS type string value 'OCCURS'.
    constants: FUNCTION type string value 'FUNCTION'.
    constants: CALLFUNCTION type string value ' CALL FUNCTION'.
    constants: MESSAGE type string  value 'MESSAGE'.
    constants: INCLUDE type string value 'INCLUDE'.
    constants: LOWINCLUDE type string value 'include'.
    constants: DESTINATION type string value 'DESTINATION'.
    constants: IS_TABLE type string value 'T'.
    constants: IS_PROGRAM type string value 'P'.
    constants: IS_SCREEN type string value 'S'.
    constants: IS_GUITITLE type string value 'G'.
    constants: IS_DOCUMENTATION type string value 'D'.
    constants: IS_MESSAGECLASS type string value 'MC'.
    constants: IS_FUNCTION type string value 'F'.
    constants: IS_CLASS type string value 'C'.
    constants: IS_METHOD type string value 'M'.
    constants: ASTERIX type string value '*'.
    constants: COMMA type string value ','.
    constants: PERIOD type string value '.'.
    constants: DASH type string value '-'.
    constants: TRUE type i value 1.
    constants: FALSE type i value 0.
    constants: LT type string value '&lt;'.
    constants: GT type string value '&gt;'.
    constants: UNIX type string value 'UNIX'.
    constants: NON_UNIX type string value 'not UNIX'.
    constants: BACKGROUND_COLOUR type string value '#FFFFE0'.
    constants: COLOUR_WHITE type string value '#FFFFFF'.
    constants: COLOUR_BLACK type string value '#000000'.
    constants: COLOUR_YELLOW type string value '#FFFF00'.
    constants: COMMENT_COLOUR type string value '#0000FF'.
    constants: HTMLEXTENSION type string value 'html'.
    constants: TEXTEXTENSION type string value 'txt'.
    Global variables
    data: statusBarMessage(100).
    data: forcedExit type i value 0.
    data: startTime like sy-uzeit.
    data: runTime like sy-uzeit.
    data: downloadFileExtension type string.
    data: downloadFolder type string.
    data: slashSeparator type string.
    data: frontendOpSystem type string.
    data: customerNameSpace type string.
    ranges: soProgramName for trdir-name.
    ranges: soAuthor for usr02-bname.
    ranges: soTable for dd02l-tabname.
    ranges: soFunctionName  for tfdir-funcName.
    ranges: soClassName for vseoclass-clsname.
    ranges: soFunctionGroup for enlfdir-area.
    field-symbols: <waDictStruct> type tDictTable.
    Selection screen declaration
    Author
    selection-screen: begin of block b1 with frame title tBlock1.
      selection-screen begin of line.
        selection-screen comment 5(23) tAuth.
        parameters: pAuth like usr02-bname memory id MAUTH.
      selection-screen end of line.
      selection-screen begin of line.
        selection-screen comment 5(36) tPmod.
        parameters: pMod as checkbox.
      selection-screen end of line.
    *--- Local objects
      selection-screen begin of line.
        selection-screen comment 5(36) t$tmp.
        parameters: p$tmp as checkbox default ''.
      selection-screen end of line.
    selection-screen: end of block b1.
    selection-screen begin of block b2 with frame title tBlock2.
    Tables
      selection-screen begin of line.
        parameters: rTable radiobutton group r1.
        selection-screen comment 5(20) tRtable.
      selection-screen end of line.
      selection-screen begin of line.
        selection-screen comment 10(18) tPtable.
        parameters: pTable like dd02l-tabname memory id MTABLE.
      selection-screen end of line.
      selection-screen begin of line.
        selection-screen comment 10(79) tTnote.
      selection-screen end of line.
      selection-screen begin of line.
        selection-screen comment 10(79) tTnote1.
      selection-screen end of line.
    Message classes
      selection-screen begin of line.
        parameters: rMess radiobutton group r1.
        selection-screen comment 5(18) tPMes.
      selection-screen end of line.
      selection-screen begin of line.
        selection-screen comment 10(18) tMname.
        parameters: pMname like t100-arbgb memory id MMNAME.
      selection-screen end of line.
    Function modules
      selection-screen begin of line.
        parameters: rFunc radiobutton group r1.
        selection-screen comment 5(30) tRfunc.
      selection-screen end of line.
      selection-screen begin of line.
        selection-screen comment 10(18) tPfname.
        parameters: pFname like tfdir-funcName memory id MFNAME.
      selection-screen end of line.
      selection-screen begin of line.
        selection-screen comment 10(18) tFgroup.
        parameters: pFgroup like enlfdir-area memory id MFGROUP.
      selection-screen end of line.
    Classes
      selection-screen begin of line.
        parameters: rClass radiobutton group r1.
        selection-screen comment 5(30) tRClass.
      selection-screen end of line.
      selection-screen begin of line.
        selection-screen comment 10(18) tPcName.
        parameters: pClname like seoclass-clsname memory id MCNAME.
      selection-screen end of line.
    Programs / includes
      selection-screen begin of line.
        parameters: rProg radiobutton group r1 default 'X'.
        selection-screen comment 5(18) tProg.
      selection-screen end of line.
      selection-screen begin of line.
        selection-screen comment 10(18) tRpname.
        parameters: pProg like trdir-name memory id MPROG.
      selection-screen end of line.
      selection-screen skip.
    Language
      selection-screen begin of line.
        selection-screen comment 1(18) tMLang.
        parameters: pMLang like t100-sprsl default 'EN'.
      selection-screen end of line.
    Package
      selection-screen begin of line.
        selection-screen comment 1(18) tPack.
        parameters: pPack like tadiv-devclass memory id MPACK.
      selection-screen end of line.
    Customer objects
      selection-screen begin of line.
        selection-screen comment 1(27) tCust.
        parameters: pCust as checkbox default 'X'.
        selection-screen comment 32(25) tNRange.
        parameters: pCName type namespace memory id MNAMESPACE.
      selection-screen end of line.
    selection-screen: end of block b2.
    Additional things to download.
    selection-screen: begin of block b3 with frame title tBlock3.
      selection-screen begin of line.
        selection-screen comment 1(33) tPtext.
        parameters: pText as checkbox default 'X' memory id MTEXT.
      selection-screen end of line.
      selection-screen begin of line.
        selection-screen comment 1(33) tMess.
        parameters: pMess as checkbox default 'X' memory id MMESS.
      selection-screen end of line.
      selection-screen begin of line.
        selection-screen comment 1(33) tPinc.
        parameters: pInc as checkbox default 'X' memory id MINC.
        selection-screen comment 40(20) tRecc.
        parameters: pReci as checkbox default 'X' memory id MRECI.
      selection-screen end of line.
      selection-screen begin of line.
        selection-screen comment 1(33) tPfunc.
        parameters: pFunc as checkbox default 'X' memory id MFUNC.
        selection-screen comment 40(20) tRecf.
        parameters: pRecf as checkbox default 'X' memory id MRECF.
      selection-screen end of line.
      selection-screen begin of line.
        selection-screen comment 1(33) tDoc.
        parameters: pDoc as checkbox default 'X' memory id MDOC.
      selection-screen end of line.
      selection-screen begin of line.
        selection-screen comment 1(33) tPscr.
        parameters: pScr as checkbox default 'X' memory id MSCR.
      selection-screen end of line.
      selection-screen begin of line.
        selection-screen comment 1(33) tPdict.
        parameters: pDict as checkbox default 'X' memory id MDICT.
      selection-screen end of line.
      selection-screen begin of line.
        selection-screen comment 1(33) tSortT.
        parameters: pSortT as checkbox default ' ' memory id MSORTT.
      selection-screen end of line.
    selection-screen: end of block b3.
    File details
    selection-screen: begin of block b4 with frame title tBlock4.
      selection-screen begin of line.
        selection-screen comment 1(20) tPhtml.
        parameters: pHtml radiobutton group g1 default 'X'.
      selection-screen end of line.
      selection-screen begin of line.
        selection-screen comment 5(25) tComm.
        parameters: pComm as checkbox default 'X'.
      selection-screen end of line.
      selection-screen begin of line.
        selection-screen comment 5(25) tBack.
        parameters: pBack as checkbox default 'X'.
      selection-screen end of line.
      selection-screen begin of line.
        selection-screen comment 1(20) tPtxt.
        parameters: pTxt radiobutton group g1.
      selection-screen end of line.
      selection-screen skip.
      selection-screen begin of line.
        selection-screen comment 1(20) tPpath.
        parameters: pFolder like rlgrap-filename obligatory memory id MFOLDER.
      selection-screen end of line.
    selection-screen: end of block b4.
    Display a directory picker window
    at selection-screen on value-request for pFolder.
    data: objFile type ref to cl_gui_frontend_services.
    data: pickedFolder type string.
    data: initialFolder type string.
      create object objFile.
      if not pFolder is initial.
        initialFolder = pFolder.
      else.
        objFile->get_temp_directory( changing temp_dir = initialFolder
                                     exceptions cntl_error = 1
                                               error_no_gui = 2
                                               not_supported_by_gui = 3 ).
      endif.
      objFile->directory_browse( exporting initial_folder = initialFolder
                                 changing selected_folder = pickedFolder
                                 exceptions cntl_error = 1
                                            error_no_gui = 2
                                            not_supported_by_gui = 3 ).
      if sy-subrc = 0.
        pFolder = pickedFolder.
      else.
        write: / 'An error has occured picking a folder'.
      endif.
    initialisation
    Initialization.
    Parameter screen texts.
      tBlock1 = 'Author (Optional)'.
      t$tmp   = 'Programs only: include local objects'.
      tBlock2 = 'Objects to download'.
      tBlock3 = 'Additional downloads for programs, function modules and classes'.
      tBlock4 = 'Download parameters'.
      tAuth   = 'Author name'.
      tPmod   = 'Include programs modified by author'.
      tCust   = 'Only customer objects'.
      tNRange = 'Alt customer name range'.
      tRtable = 'Tables / Structures'.
      tPtable = 'Table name'.
      tTnote  = 'Please note: tables are stored under the username of the'.
      tTnote1 = 'last person who modified them.'.
      tRfunc  = 'Function modules'.
      tPfname = 'Function name'.
      tFgroup = 'Function group'.
      tRClass  = 'Classes'.
      tPcname = 'Class name'.
      tMess   = 'Message class'.
      tMName  = 'Class name'.
      tMLang  = 'Language'.
      tProg   = 'Programs'.
      tRpname = 'Program name'.
      tPack   = 'Package'.
      tPtxt   = 'Text document'.
      tPhtml  = 'HTML document'.
      tComm   = 'Highlight comments'.
      tBack   = 'Include background colour'.
      tPtext  = 'Text elements'.
      tPinc   = 'Include programs'.
      tRecc   = 'Recursive search'.
      tPpath  = 'File path'.
      tPmes   = 'Message classes'.
      tPfunc  = 'Function modules'.
      tDoc    = 'Function module documentation'.
      tRecf   = 'Recursive search'.
      tPscr   = 'Screens'.
      tPdict  = 'Dictionary structures'.
      tSortT  = 'Sort table fields alphabetically'.
    Determine the frontend operating system type.
      perform determineFrontendOPSystem using slashSeparator.
    start-of-selection.
    start-of-selection.
      perform checkComboBoxes.
      perform fillSelectionRanges.
      downloadFolder = pFolder.
      startTime = sy-uzeit.
    Fool the HTML routines to stop them hyperlinking anything with a space in them
      if pCName is initial.
        customerNameSpace  = '^'.
      else.
        customerNameSpace = pCName.
      endif.
    Main program flow.
      case 'X'.
      Select tables
        when rTable.
          perform retrieveTables using iDictionary[]
                                       soTable[]
                                       soAuthor[].
      Select message classes tables
        when rMess.
          perform retrieveMessageClass using iMessages[]
                                             soAuthor[]      "Author
                                             pMname          "Message class name
                                             pMLang          "Message class language
                                             pMod.           "Modified by author
      Select function modules
        when rFunc.
          if pFName+0(1) ca ASTERIX.
          Restrict the search to customer objects only.
            pCust = 'X'.
          endif.
          if pFGroup+0(1) ca ASTERIX.
          Restrict the search to customer objects only.
            pCust = 'X'.
          endif.
          perform retrieveFunctions using soFunctionName[]   "Function name
                                          soFunctionGroup[]  "Function group
                                          iFunctions[]       "Found functions
                                          pAuth              "Author
                                          pText              "Get text elements
                                          pScr               "Get screens
                                          pCust              "Customer data only
                                          customerNameSpace. "Customer name range
          loop at iFunctions.
          Find Dict structures, messages, functions, includes etc.
            perform scanForAdditionalFuncStuff using iFunctions[]
                                                     pRecI                   "Search for includes recursively
                                                     pRecF                   "Search for functions recursively
                                                     pInc                    "Search for includes
                                                     pFunc                   "Search for functions
                                                     pDict                   "search for dictionary objects
                                                     pMess                   "Search for messages
                                                     pCust                   "Customer data only
                                                     customerNameSpace.      "Customer name range
          endloop.
      Select Classes
        when rClass.
          if pClName+0(1) ca ASTERIX.
          Restrict the search to customer objects only.
            pCust = 'X'.
          endif.
          perform retrieveClasses using iClasses[]
                                        iFunctions[]
                                        soClassName[]       "Class name
                                        soAuthor[]          "Author
                                        customerNameSpace   "Customer name range
                                        pMod                "Also modified by author
                                        pCust               "Customer object only
                                        pMess               "Find messages
                                        pText               "Text Elements
                                        pDict               "Dictionary structures
                                        pFunc               "Get functions
                                        pInc                "Get includes
                                        pRecF               "Search recursively for functions
                                        pRecI               "Search recursively for includes
                                        'X'                 "Search recursively for classes
                                        pMLang.             "Language
          loop at iFunctions.
          Find Dict structures, messages, functions, includes etc.
            perform scanForAdditionalFuncStuff using iFunctions[]
                                                     pRecI                   "Search for includes recursively
                                                     pRecF                   "Search for functions recursively
                                                     pInc                    "Search for includes
                                                     pFunc                   "Search for functions
                                                     pDict                   "search for dictionary objects
                                                     pMess                   "Search for messages
                                                     pCust                   "Customer data only
                                                     customerNameSpace.      "Customer name range
          endloop.
      Select programs
        when rProg.
          if pProg+0(1) ca ASTERIX.
          Restrict the search to customer objects only.
            pCust = 'X'.
          endif.
          perform retrievePrograms using iPrograms[]
                                         iFunctions[]
                                         soProgramName[]    "Program name
                                         soAuthor[]         "Author
                                         customerNamespace  "Customer name range
                                         pMod               "Also modified by author
                                         pCust              "Customer object only
                                         pMess              "Find messages
                                         pText              "Text Elements
                                         pDict              "Dictionay structures
                                         pFunc              "Get functions
                                         pInc               "Get includes
                                         pScr               "Get screens
                                         pRecF              "Search recursively for functions
                                         pRecI              "Search recursively for includes
                                         p$Tmp              "local objects
                                         pPack.             "Package
      endcase.
    end-of-selection
    end-of-selection.
      if forcedExit = 0.
      Set the file extension and output type of the file
        if pTxt is initial.
          downloadFileExtension = HTMLEXTENSION.
        else.
          downloadFileExtension = TEXTEXTENSION.
        endif.
      Decide what to download
        case 'X'.
        Download tables
          when rTable.
            if not ( iDictionary[] is initial ).
              perform downloadDDStructures using iDictionary[]
                                                 pFolder
                                                 HTMLEXtension
                                                 space
                                                 pSortT.
            Free up any memory used for caching HTML versions of tables
              loop at iDictionary.
                free memory id iDictionary-tablename.
              endloop.
              get time.
              runTime = sy-uzeit - startTime.
              perform fillTreeNodeTables using iDictionary[]
                                               iTreeDisplay[]
                                               runTime.
              clear iDictionary[].
            endif.
        Download message class
          when rMess.
            if not ( iMessages[] is initial ).
              sort iMessages ascending by arbgb msgnr.
              loop at iMessages.
                append iMessages to iSingleMessageClass.
                at end of arbgb.
                  perform downloadMessageClass using iSingleMessageClass[]
                                                     iMessages-arbgb
                                                     pFolder
                                                     downloadFileExtension
                                                     pHtml
                                                     space
                                                     pComm
                                                     customerNameSpace
                                                     pInc
                                                     pDict
                                                     pMess.
                   clear iSingleMessageClass[].
                 endat.
               endloop.
               get time.
               runTime = sy-uzeit - startTime.
               perform fillTreeNodeMessages using iMessages[]
                                                  iTreeDisplay[]
                                                  runTime.
               clear iMessages[].
           endif.
        Download functions
          when rFunc.
            if not ( iFunctions[] is initial ).
               perform downloadFunctions using iFunctions[]
                                               pFolder
                                               downloadFileExtension
                                               space
                                               pDoc
                                               pHtml
                                               pComm
                                               customerNameSpace
                                               pInc
                                               pDict
                                               TEXTEXTENSION
                                               HTMLEXTENSION
                                               pSortT.
            Free up any memory used for caching HTML versions of tables
              loop at iFunctions.
                loop at iFunctions-iDictStruct assigning <waDictStruct>.
                  free memory id <waDictStruct>-tablename.
                endloop.
              endloop.
              get time.
              runTime = sy-uzeit - startTime.
              perform fillTreeNodeFunctions using iFunctions[]
                                                  iTreeDisplay[]
                                                  runTime.
              clear iFunctions[].
            endif.
        Download Classes
          when rClass.
            if not ( iClasses[] is initial ).
              perform downloadClasses using iClasses[]
                                            iFunctions[]
                                            pFolder
                                            downloadFileExtension
                                            HTMLEXTENSION
                                            TEXTEXTENSION
                                            pHtml
                                            pComm
                                            customerNameSpace
                                            pInc
                                            pDict
                                            pDoc
                                            pSortT.
            Free up any memory used for caching HTML versions of tables
              loop at iFunctions.
                loop at iFunctions-iDictStruct assigning <waDictStruct>..
                  free memory id <waDictStruct>-tablename.
                endloop.
              endloop.
            Free up any memory used for caching HTML versions of tables
              loop at iPrograms.
                loop at iPrograms-iDictStruct assigning <waDictStruct>..
                  free memory id <waDictStruct>-tablename.
                endloop.
              endloop.
               get time.
               runTime = sy-uzeit - startTime.
               perform fillTreeNodeClasses using iClasses[]
                                                 iFunctions[]
                                                 iTreeDisplay[]
                                                 runTime.
               clear iClasses[].
               clear iFunctions[].
            endif.
        Download programs
          when rProg.
            if not ( iPrograms[] is initial ).
              perform downloadPrograms using iPrograms[]
                                             iFunctions[]
                                             pFolder
                                             downloadFileExtension
                                             HTMLEXTENSION
                                             TEXTEXTENSION
                                             pHtml
                                             pComm
                                             customerNameSpace
                                             pInc
                                             pDict
                                             pDoc
                                             pSortT.
            Free up any memory used for caching HTML versions of tables
              loop at iFunctions.
                loop at iFunctions-iDictStruct assigning <waDictStruct>..
                  free memory id <waDictStruct>-tablename.
                endloop.
              endloop.
            Free up any memory used for caching HTML versions of tables
              loop at iPrograms.
                loop at iPrograms-iDictStruct assigning <waDictStruct>..
                  free memory id <waDictStruct>-tablename.
                endloop.
              endloop.
               get time.
               runTime = sy-uzeit - startTime.
               perform fillTreeNodePrograms using iPrograms[]
                                                  iFunctions[]
                                                  iTreeDisplay[]
                                                  runTime.
               clear iPrograms[].
               clear iFunctions[].
            endif.
        endcase.
        if not ( iTreeDisplay[] is initial ).
          perform displayTree using iTreeDisplay[].
        else.
          statusBarMessage = 'No items found matching selection criteria'.
          perform displayStatus using statusBarMessage 1.
        endif.
      endif.
    *--- Memory IDs
    User name
      set parameter id 'MAUTH' field pAuth.
    Table name
      set parameter id 'MTABLE' field pTable.
    Message class
      set parameter id 'MMNAME' field pMname.
    Function
      set parameter id 'MFNAME' field pFName.
    Function group
      set parameter id 'MFGROUP' field pFgroup.
    Class
      set parameter id 'MCNAME' field pClName.
    Program
      set parameter id 'MPROG' field pProg.
    Customer namespace
      set parameter id 'MNAMESPACE' field pCName.
    Folder
      set parameter id 'MFOLDER' field pFolder.
    Package
      set parameter id 'MPACK' field pPack.
    Text element checkbox
      set parameter id 'MTEXT' field pText.
    Messages checkbox
      set parameter id 'MMESS' field pMess.
    Includes checkbox
      set parameter id 'MINC' field pInc.
    Recursive includes checkbox.
      set parameter id 'MRECI' field pReci.
    Functions checkbox
      set parameter id 'MFUNC' field pFunc.
    Recursive functions checkbox
      set parameter id 'MRECF' field pRecf.
    Function module documntation checkbox
      set parameter id 'MDOC' field pDoc.
    Screens checkbox
      set parameter id 'MSCR' field pScr.
    Dictionary checkbox
      set parameter id 'MDICT' field pDict.
    Sort table ascending checkBox
      set parameter id 'MSORTT' field pSortT.
    ****************************************SUBROUTINES***************************************************
    checkComboBoxes...  Check input parameters
    form checkComboBoxes.
      if pAuth is initial.
        case 'X'.
          when rTable.
            if pTable is initial.
              statusBarMessage = 'You must enter either a table name or author.'.
            endif.
          when rFunc.
            if ( pFName is initial ) and ( pFGroup is initial ).
              if pFName is initial.
                statusBarMessage = 'You must enter either a function name or author.'.
              else.
                if pFGroup is initial.
                  statusBarMessage = 'You must enter either a function group, or an author name.'.
                endif.
              endif.
            endif.
          when rProg.
            if pProg is initial.
                statusBarMessage = 'You must enter either a program name or author name.'.
            endif.
        endcase.
    Check the user name of the person objects are to be downloaded for
      else.
        if pAuth = 'SAP*' or pauth = 'SAP'.
          statusBarMessage = 'Sorry cannot download all objects for SAP standard user'.
        endif.
      endif.
      if not statusBarMessage is initial.
        perform displayStatus using statusBarMessage 3.
        forcedExit = 1.
        stop.
      endif.
    endform.                                                                                "checkComboBoxes
    fillSelectionRanges...      for selection routines
    form fillSelectionRanges.
    data: valueToFind type string.
      if not pAuth is initial.
        soAuthor-sign = 'I'.
        soAuthor-option = 'EQ'.
        soAuthor-low = pAuth.
        append soAuthor.
      endif.
      if not pTable is initial.
        if not pcName is initial and not pTable+0(1) = '/'.
          concatenate pcName pTable into valueToFind.
        else.
          valueTofind = pTable.
        endif.
        soTable-sign = 'I'.
        soTable-option = 'EQ'.
        soTable-low = valueToFind.
        append soTable.
      endif.
      if not pFName is initial.
        if not pcName is initial and not pFName+0(1) = '/'.
          concatenate pcName pFName into valueToFind.
        else.
          valueTofind = pFName.
        endif.
        soFunctionName-sign = 'I'.
        perform addOption using valueToFind soFunctionName-option.
        soFunctionName-low = valueToFind.
        append soFunctionName.
      endif.
      if not pFGroup is initial.
        if not pcName is initial and not pFGroup+0(1) = '/'.
          concatenate pcName pFGroup into valueToFind.
        else.
          valueTofind = pFGroup.
        endif.
        soFunctionGroup-sign = 'I'.
        perform addOption using valueToFind sofunctionGroup-option.
        soFunctionGroup-low = valueToFind.
        append soFunctionGroup.
      endif.
      if not pClName is initial.
        if not pcName is initial and not pClname+0(1) = '/'.
          concatenate pcName pClname into valueToFind.
        else.
          valueTofind = pClname.
        endif.
        soClassName-sign = 'I'.
        perform addOption using valueToFind soClassName-option.
        soClassName-low = valueToFind.
        append soClassName.
      endif.
      if not pProg is initial.
        if not pcName is initial and not pProg+0(1) = '/'.
          concatenate pcName pProg into valueToFind.
        else.
          valueTofind = pProg.
        endif.
        soProgramName-sign = 'I'.
        perform addOption using valueToFind soProgramName-option.
        soProgramName-low = valueTofind.
        append soProgramName.
      endif.
    endfo

  • How to place header and footer  in OO-ALV program using class

    How to place header and footer  in OO-ALV program using class tell me wat r the class we shold use and their attributes as well

    Hi Venkatesh,
    Take a look at this how to [ABAP Objects - ALV Model - Using Header and Footer|https://wiki.sdn.sap.com/wiki/x/xdw]
    it's explaining how to define the classes and use it for display an ALV with Header and Footer.
    Regards,
    Marcelo Ramos

  • How to write code  for totals and subtotals in alv programing?

    how to write code  for totals and subtotals in alv programing?

    hi,
    1. <u><b>TOTAL.</b></u>
    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_basic.htm
    2. <u><b>How do I add subtotals</b></u>
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    Regards
    Anver

  • Call tcode from alv report and passing  group of values

    hi all .
    i want to call tcode from alv report and passing an internal table or group of values to a selection option of that t code ? how
    ex. passing group of GL to fbl3n and display the detials of all .
    thank you

    Dear,
    You have done a small mistake
    --> rspar_line-option = 'EQ'.
         rspar_line-HIGH = PDATE-HIGH.
    u r passing "high" value and in "option u r passing "EQ" so how it will work!!!
    So if u r passing only 1 date or more dates like 01.01.2010 , 15.02.2010 , 10.03.2010 then pass
    rspar_line-selname = 'SO_BUDAT'.
    rspar_line-kind = 'S'.
    rspar_line-sign = 'I'.
    rspar_line-option = 'EQ'.
    rspar_line-LOW = PDATE-HIGH.
    APPEND rspar_line TO rspar_tab.
    or if u r passing low & high date means in range like 01.01.2010 to 30.01.2010, then pass
    rspar_line-selname = 'SO_BUDAT'.
    rspar_line-kind = 'S'.
    rspar_line-sign = 'I'.
    rspar_line-option = 'BT''.
    rspar_line-LOW = PDATE-LOW.
    rspar_line-HIGH = PDATE-HIGH.
    APPEND rspar_line TO rspar_tab.
    try above code , hope it helps...
    i think u cannot use "call transaction using bdcdata" in ur case bcoz as u said in ur 1st post u want to display the details of all but still if u want to use then u should pass all parameters in  loop.
    PROGRAM
    DYNPRO
    DYNBEGIN
    FNAM
    FVAL
    ex:-
    LOOP AT GT_TEMP INTO GS_TEMP.
    CLEAR bdcdata_wa.
    bdcdata_PROGRAM = 'SAPXXXX'.
    bdcdata_DYNPRO = '1000'.
    bdcdata_DYNBEGIN = 'X'.
    bdcdata_wa-fnam = '''.
    bdcdata_wa-fval = ''.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_PROGRAM = ''.
    bdcdata_DYNPRO = ''.
    bdcdata_DYNBEGIN = ''.
    bdcdata_wa-fnam = 'SD_SAKNR'.
    bdcdata_wa-fval = GS_TEMP-GLACCOUNT.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_PROGRAM = ''.
    bdcdata_DYNPRO = ''.
    bdcdata_DYNBEGIN = ''.
    bdcdata_wa-fnam = 'BDC_OKCODE'.
    bdcdata_wa-fval = 'XXX'.
    APPEND bdcdata_wa TO bdcdata_tab.
    ENDLOOP.
    try above code if u r using call transaction...
    Edited by: mihir6666 on Jul 9, 2011 3:10 PM
    Edited by: mihir6666 on Jul 9, 2011 3:11 PM
    Edited by: mihir6666 on Jul 9, 2011 3:13 PM

  • To set HOTSPOT for a field in ALV-oops and when clecked should call transac

    Hi,
    I need to set HOTSPOT for a field in O/P list using ALV-oops and when clecked should take me to Transaction VA01. Please help....
    Thanks,
    Prabhu

    Hi,
         Please go through this code it may help u.
    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.
    SELECT-OPTIONS:
    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.
    \* Pointers Declaration..
    DATA :
    lp_rcvr TYPE REF TO lcl_rcvr_class,
    lp_cont1 TYPE REF TO cl_gui_custom_container,
    lp_cont2 TYPE REF TO cl_gui_custom_container,
    lp_grid1 TYPE REF TO cl_gui_alv_grid,
    lp_grid2 TYPE REF TO cl_gui_alv_grid.
    \* Local Class Definiton.
    CLASS lcl_rcvr_class DEFINITION.
    PUBLIC SECTION.
    METHODS :
    hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
    IMPORTING e_row_id e_column_id es_row_no,
    handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
    IMPORTING e_row e_column.
    ENDCLASS.
    \* Local Class Implementation.
    CLASS lcl_rcvr_class IMPLEMENTATION.
    METHOD hotspot_click.
    DATA :
    wa_mara TYPE t_mara,
    wa_marc TYPE t_marc.
    DATA :
    l_index TYPE sy-tabix.
    READ TABLE i_mara INTO wa_mara INDEX e_row_id-index.
    IF sy-subrc EQ 0.
    REFRESH i_marc.
    SELECT matnr
    werks
    INTO TABLE i_marc
    FROM marc
    WHERE matnr EQ wa_mara-matnr.
    IF sy-subrc EQ 0.
    LOOP AT i_marc INTO wa_marc.
    l_index = sy-tabix.
    wa_marc-mtart = wa_mara-mtart.
    wa_marc-maktx = wa_mara-maktx.
    MODIFY i_marc FROM wa_marc INDEX l_index
    TRANSPORTING mtart maktx.
    ENDLOOP.
    CALL SCREEN 200.
    ELSE.
    MESSAGE e121 WITH text-005 wa_mara-matnr.
    ENDIF.
    ENDIF.
    ENDMETHOD.
    METHOD handle_double_click.
    DATA :
    wa_mara TYPE t_mara,
    wa_marc TYPE t_marc.
    DATA :
    l_index TYPE sy-tabix.
    READ TABLE i_mara INTO wa_mara INDEX e_row-index.
    IF sy-subrc EQ 0.
    REFRESH i_marc.
    SELECT matnr
    werks
    INTO TABLE i_marc
    FROM marc
    WHERE matnr EQ wa_mara-matnr.
    IF sy-subrc EQ 0.
    LOOP AT i_marc INTO wa_marc.
    l_index = sy-tabix.
    wa_marc-mtart = wa_mara-mtart.
    wa_marc-maktx = wa_mara-maktx.
    MODIFY i_marc FROM wa_marc INDEX l_index
    TRANSPORTING mtart maktx.
    ENDLOOP.
    CALL SCREEN 200.
    ELSE.
    MESSAGE e121 WITH text-005 wa_mara-matnr.
    ENDIF.
    ENDIF.
    ENDMETHOD.
    ENDCLASS.
    \* Start of Selection
    START-OF-SELECTION.
    \* Extract the Material Master data for the Input Material.
    SELECT a~matnr
    a~mtart
    b~maktx
    INTO TABLE i_mara
    FROM mara AS a
    INNER JOIN makt AS b
    ON a~matnr EQ b~matnr
    WHERE a~matnr IN s_matnr
    AND b~spras EQ sy-langu.
    END-OF-SELECTION.
    IF NOT i_mara\[\] IS INITIAL.
    \* Call Screen to display the Material Master data.
    CALL SCREEN 100.
    ELSE.
    MESSAGE s121 WITH text-006.
    ENDIF.
    \*& Module DISP_GRID OUTPUT
    \* text
    MODULE disp_grid OUTPUT.
    \* Build the Field catelog for Material Master data.
    PERFORM build_fcat.
    \* Display the Material Master data using ALV.
    PERFORM disp_alv.
    ENDMODULE. " DISP_GRID OUTPUT
    \*& Module USER_COMMAND_0100 INPUT
    \* text
    MODULE user_command_0100 INPUT.
    \*when exit or cancel is clicked program has to come out
    CASE sy-ucomm.
    WHEN 'EXIT' OR 'CANC'.
    LEAVE PROGRAM.
    WHEN 'BACK'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    \*& Form build_fcat
    \* text
    \* \--> p1 text
    \* <-\- p2 text
    FORM build_fcat.
    DATA : ws_fcat TYPE lvc_s_fcat.
    ws_fcat-fieldname = 'MATNR'.
    ws_fcat-scrtext_m = text-001.
    ws_fcat-tabname = 'I_MARA'.
    IF p_hotspt EQ 'X'.
    ws_fcat-hotspot = 'X'.
    ENDIF.
    APPEND ws_fcat TO i_fcat1.
    CLEAR ws_fcat.
    ws_fcat-fieldname = 'MTART'.
    ws_fcat-scrtext_m = text-002.
    ws_fcat-tabname = 'I_MARA'.
    APPEND ws_fcat TO i_fcat1.
    CLEAR ws_fcat.
    ws_fcat-fieldname = 'MAKTX'.
    ws_fcat-scrtext_m = text-003.
    ws_fcat-tabname = 'I_MARA'.
    APPEND ws_fcat TO i_fcat1.
    CLEAR ws_fcat.
    ENDFORM. " build_fcat
    \*& Form disp_alv
    \* text
    \* \--> p1 text
    \* <-\- p2 text
    FORM disp_alv.
    IF lp_cont1 IS INITIAL.
    \* Create the Container Object of Material Master.
    CREATE OBJECT lp_cont1
    EXPORTING
    container_name = c_cont1
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    create_error = 3
    lifetime_error = 4
    lifetime_dynpro_dynpro_link = 5
    others = 6 .
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    \* Create the Object for Grid of Material Master.
    CREATE OBJECT lp_grid1
    EXPORTING
    i_parent = lp_cont1
    EXCEPTIONS
    error_cntl_create = 1
    error_cntl_init = 2
    error_cntl_link = 3
    error_dp_create = 4
    others = 5.
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    \* Dipslay Material Master data by calling method.
    CALL METHOD lp_grid1->set_table_for_first_display
    CHANGING
    it_outtab = i_mara
    it_fieldcatalog = i_fcat1
    EXCEPTIONS
    invalid_parameter_combination = 1
    program_error = 2
    too_many_lines = 3
    OTHERS = 4.
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    \* Set Handler for the Hot Spot Event.
    CREATE OBJECT lp_rcvr.
    IF p_hotspt EQ 'X'.
    SET HANDLER lp_rcvr->hotspot_click FOR lp_grid1.
    ELSE.
    SET HANDLER lp_rcvr->handle_double_click FOR lp_grid1.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDFORM. " disp_alv
    \*& Module STATUS_0100 OUTPUT
    \* text
    MODULE status_0100 OUTPUT.
    SET PF-STATUS 'MAIN_STAT'.
    SET TITLEBAR 'T_100'.
    ENDMODULE. " STATUS_0100 OUTPUT
    \*& Module STATUS_0200 OUTPUT
    \* text
    MODULE status_0200 OUTPUT.
    SET PF-STATUS 'PLANT_STAT'.
    SET TITLEBAR 'T_200'.
    ENDMODULE. " STATUS_0200 OUTPUT
    \*& Module DISP_GRID_plant OUTPUT
    \* text
    MODULE disp_grid_plant OUTPUT.
    \* Build the Field catelog for Material Plant data.
    PERFORM build_fcat_plant.
    \* Display the Material Master Plant data using ALV.
    PERFORM disp_alv_plant.
    ENDMODULE. " DISP_GRID_plant OUTPUT
    \*& Module USER_COMMAND_0200 INPUT
    \* text
    MODULE user_command_0200 INPUT.
    \*when exit or cancel is clicked program has to come out
    CASE sy-ucomm.
    WHEN 'EXIT' OR 'CANC'.
    LEAVE PROGRAM.
    WHEN 'BACK'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0200 INPUT
    \*& Form build_fcat_plant
    \* text
    \* \--> p1 text
    \* <-\- p2 text
    FORM build_fcat_plant.
    DATA : ws_fcat TYPE lvc_s_fcat.
    ws_fcat-fieldname = 'MATNR'.
    ws_fcat-scrtext_m = text-001.
    ws_fcat-tabname = 'I_MARC'.
    APPEND ws_fcat TO i_fcat2.
    CLEAR ws_fcat.
    ws_fcat-fieldname = 'WERKS'.
    ws_fcat-scrtext_m = text-004.
    ws_fcat-tabname = 'I_MARC'.
    APPEND ws_fcat TO i_fcat2.
    CLEAR ws_fcat.
    ws_fcat-fieldname = 'MTART'.
    ws_fcat-scrtext_m = text-002.
    ws_fcat-tabname = 'I_MARC'.
    APPEND ws_fcat TO i_fcat2.
    CLEAR ws_fcat.
    ws_fcat-fieldname = 'MAKTX'.
    ws_fcat-scrtext_m = text-003.
    ws_fcat-tabname = 'I_MARC'.
    APPEND ws_fcat TO i_fcat2.
    CLEAR ws_fcat.
    ENDFORM. " build_fcat_plant
    \*& Form disp_alv_plant
    \* text
    \* \--> p1 text
    \* <-\- p2 text
    FORM disp_alv_plant.
    IF lp_cont2 IS INITIAL.
    \* Create the Container Object of Material Plant data.
    CREATE OBJECT lp_cont2
    EXPORTING
    container_name = c_cont2
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    create_error = 3
    lifetime_error = 4
    lifetime_dynpro_dynpro_link = 5
    others = 6.
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    \* Create the Object for Grid of Material Plant data.
    CREATE OBJECT lp_grid2
    EXPORTING
    i_parent = lp_cont2
    EXCEPTIONS
    error_cntl_create = 1
    error_cntl_init = 2
    error_cntl_link = 3
    error_dp_create = 4
    others = 5.
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    \* Dipslay Material Plant data by calling method.
    CALL METHOD lp_grid2->set_table_for_first_display
    CHANGING
    it_outtab = i_marc
    it_fieldcatalog = i_fcat2
    EXCEPTIONS
    invalid_parameter_combination = 1
    program_error = 2
    too_many_lines = 3
    OTHERS = 4.
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDIF.
    ENDIF.
    ELSE.
    \* Call method 'REFRESH_TABLE_DISPLAY' to refresh the grid data.
    CALL METHOD lp_grid2->refresh_table_display.
    ENDIF.
    ENDFORM. " disp_alv_plant

  • Report with ALV tree and ALV list?

    I need to create a report with layout as same as this one
    [http://trangiegie.com/MyFile/output.JPG]
    It looks like a report with combination of ALV tree and list. The tree works like a navigation bar. Wonder if there are any demo programs like this. Will appreciate any help.

    For Tree alone - You can check program : BCALV_TREE_02
    Program Name                   Report title
    BCALV_GRID_DND_TREE            ALV Grid: Drag and Drop with ALV Tree
    BCALV_GRID_DND_TREE_SIMPLE     ALV GRID: Drag and drop with ALV tree (simple)
    BCALV_TEST_COLUMN_TREE         Program BCALV_TEST_COLUMN_TREE
    BCALV_TEST_SIMPLE_TREE         Program BCALV_TEST_SIMPLE_TREE
    BCALV_TREE_01                  ALV Tree Control: Build Up the Hierarchy Tree
    BCALV_TREE_02                  ALV Tree Control: Event Handling
    BCALV_TREE_03                  ALV Tree Control: Use an Own Context Menu
    BCALV_TREE_04                  ALV Tree Control: Add a Button to the Toolbar
    BCALV_TREE_05                  ALV Tree Control: Add a Menu to the Toolbar
    BCALV_TREE_06                  ALV tree control: Icon column and icon for nodes/items
    BCALV_TREE_DEMO                Demo for ALV tree control
    BCALV_TREE_DND                 ALV tree control: Drag & Drop within a hierarchy tree
    BCALV_TREE_DND_MULTIPLE        ALV tree control: Drag & Drop within a hierarchy tree
    BCALV_TREE_EVENT_RECEIVER      Include BCALV_TREE_EVENT_RECEIVER
    BCALV_TREE_EVENT_RECEIVER01
    BCALV_TREE_ITEMLAYOUT          ALV Tree: Change Item Layouts at Runtime
    BCALV_TREE_MOVE_NODE_TEST      Demo for ALV tree control
    BCALV_TREE_SIMPLE_DEMO         Program BCALV_TREE_SIMPLE_DEMO
    BCALV_TREE_VERIFY              Verifier for ALV Tree and Simple ALV Tree

  • ALV Grid and return to selection screen

    Hello
    I have an ALV Grid and when I push a buttom that I program appears another ALV Grid. In this second ALV I try to program different buttoms. When I program the BACK buttom I want to go to selection screen.
    I try with CALL SELECTION SCREEN but when I stay in selection screen and push the execute buttom the ALV that I see is the second, not the first. It seems that we don't catch the news selections.
    I put rs_selfied-refresh = 'X' after the CALL SELECTION SCREEN but is wrong again.
    What can I do????

    Hello Silvia
    There is a simple trick to return from the second ALV list directly back to the selection screen:
    *& Report  ZUS_SDN_REUSE_ALV_GRID_DISPLAY
    REPORT  zus_sdn_reuse_alv_grid_display.
    TYPE-POOLS: slis.
    DATA:
      gt_t001        TYPE STANDARD TABLE OF t001,
      gt_knb1        TYPE STANDARD TABLE OF knb1.
    DATA:
      gs_fcat        TYPE slis_fieldcat_alv,
      gt_fcat_t001   TYPE slis_t_fieldcat_alv,
      gt_fcat_knb1   TYPE slis_t_fieldcat_alv.
    PARAMETERS:
      p_bukrs        TYPE bukrs  DEFAULT '1000'.
    START-OF-SELECTION.
      SELECT * FROM  t001 INTO TABLE gt_t001.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_PROGRAM_NAME               =
    *     I_INTERNAL_TABNAME           =
          i_structure_name             = 'T001'
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
    *     I_INCLNAME                   =
    *     I_BYPASSING_BUFFER           =
    *     I_BUFFER_ACTIVE              =
        CHANGING
          ct_fieldcat                  = gt_fcat_t001
        EXCEPTIONS
          inconsistent_interface       = 1
          program_error                = 2
          OTHERS                       = 3.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
    *     I_INTERFACE_CHECK                 = ' '
    *     I_BYPASSING_BUFFER                = ' '
    *     I_BUFFER_ACTIVE                   = ' '
          i_callback_program                = syst-cprog
          i_callback_pf_status_set          = 'ALV_SET_PF_STATUS'
          i_callback_user_command           = 'ALV_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                         =
          it_fieldcat                       = gt_fcat_t001
    *   IMPORTING
    *     E_EXIT_CAUSED_BY_CALLER           =
    *     ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = gt_t001
    *   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.
    END-OF-SELECTION.
    *&      Form  set_pf_status
    *       text
    *      -->RT_EXTAB   text
    FORM alv_set_pf_status USING rt_extab TYPE slis_t_extab.
    * NOTE: identical to STANDARD_FULLSCREEN with additional button
    *       for detail list ('DETAILLIST')
      SET PF-STATUS 'STANDARD_FULLSCREEN'.
    ENDFORM.                    "set_pf_status
    *&      Form  alv_user_command
    *       text
    *      -->R_UCOMM    text
    *      -->RS_SELFIELDtext
    FORM alv_user_command  USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
      CASE r_ucomm.
    *   Display detail list: all customers for selected company code
        WHEN 'DETAILLIST'.
          IF ( rs_selfield-fieldname = 'BUKRS' ).
            SELECT        * FROM  knb1 INTO TABLE gt_knb1
                   WHERE  bukrs  = rs_selfield-value.
            CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
              EXPORTING
    *         I_INTERFACE_CHECK                 = ' '
    *         I_BYPASSING_BUFFER                = ' '
    *         I_BUFFER_ACTIVE                   = ' '
                i_callback_program                = syst-cprog
                i_callback_pf_status_set          = 'ALV_SET_PF_STATUS'
                i_callback_user_command           = 'ALV_USER_COMMAND'
    *         I_CALLBACK_TOP_OF_PAGE            = ' '
    *         I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *         I_CALLBACK_HTML_END_OF_LIST       = ' '
                i_structure_name                  = 'KNB1'
    *       IMPORTING
    *         E_EXIT_CAUSED_BY_CALLER           =
    *         ES_EXIT_CAUSED_BY_USER            =
              TABLES
                t_outtab                          = gt_knb1
              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.
    <b>*       NOTE: when the program logic returns from the 2nd ALV list
    *             and exit = 'X' then the program leaves the
    *       1st ALV list, too, and returns to the selection screen.</b>
            rs_selfield-exit = 'X'.
          ENDIF.
        WHEN OTHERS.
      ENDCASE.
    ENDFORM.                    "alv_user_command
    Regards
      Uwe

  • Can we change the value of a variable in the driver program from sapscript?

    Hello Experts,
    I am currently developing a form wherein I need to change the value of a variable defined in the standard
    driver program through the sapscript form. Unfortunately, I cannot customize this standard program since this is used by many other
    subsidiaries. So, is there anyway that I can change a variable defined in the driver program via sapscript?
    I tried to use a PERFORM to change its value but it is not working.
    I hope you can help me guys. Thank you and take care!

    SAP SCRIPT:
    /: PERFORM GET_ATTNDEE_INFO IN PROGRAM ZHR_TRNG
    /: USING &PPVAR-EOBJD&
    /: CHANGING &ATTND&
    /: ENDPERFORM
    Executable Prog.:
    REPORT ZHR_TRNG.
    FORM GET_ATTNDEE_INFO TABLES IN_PAR STRUCTURE ITCSY
    OUT_PAR STRUCTURE ITCSY.
    DATA : LOC_CODE(8),
    WF_NAME LIKE PA0001-ENAME, "----Location Code
    WF_SOBID LIKE HRP1001-SOBID. "----Business Event Code
    DATA: BEGIN OF ITAB_ECODE OCCURS 0,
    ECODE(8),
    END OF ITAB_ECODE.
    DATA: NAME1 TYPE STRING.
    READ TABLE IN_PAR INDEX 1.
    LOC_CODE = IN_PAR-VALUE.
    SELECT SOBID FROM HRP1001 INTO WF_SOBID
    WHERE OBJID = LOC_CODE AND OTYPE ='E' AND PLVAR = '01' AND SCLAS = 'P'.
    APPEND WF_SOBID TO ITAB_ECODE .
    ENDSELECT.
    IF SY-SUBRC = 0.
    LOOP AT ITAB_ECODE.
    SELECT SINGLE ENAME FROM PA0001 INTO WF_NAME
    WHERE PERNR = ITAB_ECODE-ECODE ." AND ENDDA >= '31.12.9999' .
    CONCATENATE 'Mr ' WF_NAME ',' NAME1 INTO NAME1.
    IF SY-SUBRC = 0 .
    OUT_PAR-NAME = 'ATTND'.
    OUT_PAR-VALUE = NAME1.
    APPEND OUT_PAR.
    ENDIF.
    ENDLOOP.
    ENDIF.
    ENDFORM. "GET_USR_INFO

  • Hyperlink in ALV output and when downloaded to Excel, maintain that hyperli

    Hi SAP Friends,
    I want to know if this is possible. My requirement is, display a column with Invoice # and hyperlink (or you can call it as Hotspot in SAP language). When clicked on the hyperlink, it should open a webpage, giving details of Invoice. I tried testing BCALV_GRID_VERIFY program. I can see hyperlink in ALV output and when I click, it opens a webpage. However, when I down load data to Excel using Excel inplace, hyperlink is gone. Only data is down loaded. How can we make it happen that hyperlink is maintained even after downloading data from ALV ?
    Any ideas ?
    Niranjan

    Waiting for any suggestions from users.
    Niranjan

  • What are different function modules used in alv?and their usage?

    helo experts can u please explain what are the different function modules that are used in alv reports and what is the exact use of each and every function module?

    Hi,
    Well everybody gives good explanation to you.
    The commonly used ALV functions used are;
    1. REUSE_ALV_VARIANT_DEFAULT_GET
    2. REUSE_ALV_VARIANT_F4
    3. REUSE_ALV_VARIANT_EXISTENCE
    4. REUSE_ALV_EVENTS_GET
    5. REUSE_ALV_COMMENTARY_WRITE
    6. REUSE_ALV_FIELDCATALOG_MERGE
    7. REUSE_ALV_LIST_DISPLAY
    8. REUSE_ALV_GRID_DISPLAY
    9. REUSE_ALV_POPUP_TO_SELECT
    Purpose of the above Functions are differ, not all the functions are required in all the ALV Report. 
    But either no.7 or No.8 is there in the Programs. 
    For further information, visit this link
    http://www.abapcode.info/2007/06/alv-function-module.html
    May this helps you.
    Thanks.
    Deepak Sharma

  • U00BFCan I use a function module as a driver program for sapscript?

    Hi,
    I have to use a function module as driver program for sapscript and there is no any value in the form (the data are not transferred)...
    but if I call the sapcript from a report with the same code as in my function module all the data are transferred OK.
    please, can you tell me if there is any problem in use of a function module in this case? is it impossible at all or is there any tip to apply?
    thank you all in advance.

    Hi,
    first of all it is possible to use a function module to process a SapScript form.
    The mistake on your side is probably the definition of the variables that you want to pass to the form. Please make sure they are defined as global (via SE37 --> Goto --> Global Data) then it should be working.
    In addition you could take a look at e.g. function module "PRINT_DUNNING_NOTICE". This is SAP standard and they are using it to print a SapScript form.
    Best regards
    Arno Speitkamp

  • Differences between the alv's and alv grid dispaly

    hi guys
    .........please send the  differences between the alv's and alv grid display.
                    thanks....

    Hi Midathala,
    Plz go through the links might be useful to you.
    Simple ALV report
    http://www.sapgenie.com/abap/controls/alvgrid.htm
    http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    Check the program in the following link:
    http://sap-img.com/abap/display-secondary-list-using-alv-grid.htm
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_basic.htm
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    13. Top-of-page in ALV
    selection-screen and top-of-page in ALV
    14. ALV Group Heading
    http://www.sap-img.com/fu037.htm
    How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    15. ALV output to PDF conversion
    It has an example code for PDF Conversion.
    http://www.erpgenie.com/abap/code/abap51.htm
    converting the output of alv in pdf
    Thanks
    Mohinder Singh Chauhan

  • How to check the layout defined for an ALV program

    Hi All,
    I have an ALV-program which uses radio buttons to display the list either in an Hierarchical format or in a Simple list format. In the selection screen there is a field for specifying the layout.
    Now the problem is, if a layout is created for Hierachical display and that layout is used to display the list in a simple list format the program doesn't give the desired output and vice versa.
    So i need to put a check in the program, to check whether the layout given in the selection screen is meant for a Simple List display or for an Hierarchical display and accordingly throw an error message regarding the mismatch if any.
    Is there any standard Function Module to check whether the layout is defined for a Simple List display or an Hieracrchical List display? Or is there any other way to do this checking????
    Thanks in Advance!!!
    Anindya

    Hi Venkat,
    The problem is:
    I need to know whether the LAYOUT(given in the selection screen) is defined for a SIMPLE LIST DISPLAY or an HIERARCHICAL LIST DISPLAY. Now say for example user has selected a layout which has been defined for a Hierarchical List display but by mistake he has selected the radio button for a Simple List display. So, here is a mismatch and the program should detect this and throw some error message. Instead it is now displaying a wrong output which is resulting from the mismatch.

Maybe you are looking for

  • Automatic creation of PO in supplying plant

    Hi , There are three plants A,B and C. Plant A procures from B and plant B procures from plant C. Note ::: A cannot procure from C due to some financial matters. i.e, A<B<C . A plant to plant purchase order will be created in plant A for plant B. Thu

  • Message no. F5A047 in FB60

    i have created a tax code S5 .  but when i  post the document  Error messages still exist -> see error log Message no. F5A047 automatic posting & suplliment option not tick in all three g/l accounts.field status variant group is G011 (clearning a/c's

  • Removing Commas and Spaces from Field

    I have a table called TableD1 in a database with a field called "Range". The ranges are like 1-1000; 1001-2000; etc. up to like 1000000-200000. That is how they are supposed to look, they are not numeric fields, just general, containing a low, a dash

  • Calibration Grid in Talent Management !!!

    Dear All, I am working on EHP4 system and via SPRO, I have check the calibration grid configuration as I am working on CSP module.. However, I want to know about the functionality of calibration grid and how to use it. Please give your input here Wit

  • Can't get selectOneChoice to pick up default value

    I have this selectOneChoice below and the enum also shown below, but no matter what I do, it won't leave the drop down intact. It just replaces it with a text field that says "Regular" which is the proper value for the first enum value but what I wan