Re: Alv report grouped under certain fixed field

Hello,
My problem is : I have to display an ALV report under grouped format like :-
PLANT     
MRP Controller
Material Group     ABC
Material  12345      Delinquent  WEEK 1     WEEK 2     WEEK 3     WEEK 4
Stock Level
Open PO
Sales Forecast
Actual Sales Orders
Shortage/Overage
Material  23456      Delinquent  WEEK 1     WEEK 2     WEEK 3     WEEK 4
Stock Level
Open PO
Sales Forecast
Actual Sales Orders
Shortage/Overage
PLANT     
MRP Controller
Material Group     BCD
Material  55345      Delinquent  WEEK 1     WEEK 2     WEEK 3     WEEK 4
Stock Level
Open PO
Sales Forecast
Actual Sales Orders
Shortage/Overage
Material  55456      Delinquent  WEEK 1     WEEK 2     WEEK 3     WEEK 4
Stock Level
Open PO
Sales Forecast
Actual Sales Orders
Shortage/Overage
and so on....
Please help me to solve this problem. Points sure.

It is possible , But i never tried it.
Supporting Transaction: FBL1N

Similar Messages

  • Subtotal in alv report based on the particular field value

    Hi,
    As per my requirement, i need to do subtotal of quntity field based on the material number field value in alv report.
    Ex:  if material number falls 1 to 10 then i need to be calculate and display subtotal qty amount with text " total of the mat1" and if material number falls 11 to 20 then again i need to be claculate and display subtotal qty amount with text "total of the mat2". similarily i need to display the details.
    <removed_by_moderator>
    Regards
    Nagendra

    Hi,
    Ex: if material number falls 1 to 10 then i need to be calculate and display subtotal qty amount with text " total of the mat1" and if material number falls 11 to 20 then again i need to be claculate and display subtotal qty amount with text "total of the mat2". similarily i need to display the details.
    What you can do is in your output table, you will have to create an auxilary field, lets call it as material group (groupid). Now you can do a subtotal on the material group. However the logic to determine what materials belong to which group should be coded. I guess you might be having some logic for that.
    So lets say that material 1 to 10 as G1 ( group 1 ) and material 11 to 20 as G2 ( group 2 )
    The output of the internal table would be
    Groupid  matnr ...
    1  1
    1  2
    1  3.....and so on
    2  11
    2  12
    2  13....upto 20.
    Now in the fieldcatalog assign an 'X' to the 'dosum' parameter to the field Groupid
    In the sort info do the following :
    gs_sort-fieldname = 'GROUPID'.
    gs_sort-spos = 1.
    gs_sort-up = 'X'.
    gs_sort-subtot = 'X'. ***CRUCIAL STATEMENT****
    append gs_sort to gt_sort.
    Now pass all this data to the alv grid function. And you are done.
    regards,
    Advait

  • OOPs ALV report Fieldcatalog Editing a currency field

    Hi all,
    I have created an OOP's ALV report. I have made one of the currency field editable. when I am changing the value in any cell and go out of the cell(or move to other cell using arrow keys or click some were in the grid) it is taking '.' after 2 digits from the right.
    for example if I take 10 it is converting to 0.10, if I take 100 it is becomnig 1.00, if I take 100.00 it is becoming 1.00. If I take 123.45 I am getting a pop up box with message "Too many decimal places"
    the fieldcatalog values are as follows
      WA_FIELDCAT-FIELDNAME   = 'ORD_VAL'.
      WA_FIELDCAT-SCRTEXT_M   = 'Ord Value'.
      WA_FIELDCAT-COL_POS     = 11.
    wa_fieldcat-no_zero     = 'X'.
      WA_FIELDCAT-OUTPUTLEN = 14.
       WA_FIELDCAT-CURRENCY  = 'INR'.
      wa_fieldcat-decimals_o = '2'.
      wa_fieldcat-no_zero = 'X'.
      WA_FIELDCAT-EDIT   = 'X'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR  WA_FIELDCAT.
    Can anybody please help me. As If I edit the field it should take the values what I input.
    Thanks in Advance.

    Hi ,
    The CURR field is the currency unit field in the table ITAB.
    I am just confused with your answer. in my case the final internal table is T_CHKQTY1 shall I take that or anything else. I have taken WA_FIELDCAT-CTABNAME = 'CURR'. but the system is thrownig an error as The data object has no component with CTABNAME but there is a component called TABNAME.
    Can you please currect me.

  • To develope an alv report or module pool and field link.. and effor require

    HI,
    I want to display the fields with sort functionality with fields
    kunnr  kna1 table
    name1 kna1
    and email id from table ADR6 field SMTP_ADDR
    my question ison mapping
    from kna1 we can get field kunnr and name1
    and adrnr
    to put in adr6 to fetch email id
    can anyoe suggest on select statements link as table kna1 has one unique kunnr
    but it can have multiple name1 and adrnr
    so how to pick the kunnr ,name 1 and adrnr from table kna1 and map to
    adr6 table
    as witinn the table kna1 there can be multiple name1 related to one single kunnr
    so wil it be like
    select kunnr from kna1..into it_kunnr
    then select nam1 from table kna2 for all entrirs in It_kunnr
    or firse selet kunnr name1 from kna1 into table it_kunnr
    pls suggest an appropiat select statament
    and i suppose this can be achevied by alv report no need for moudle pool
    regards
    Arora

    opened  a new thread with changes subject

  • Alv Reports grouping doubt

    Hi all
    I have some data in ITAB like this,
    AAAAAA          1     1
    AAAAAA          1     2
    AAAAAA          2     8
    BBBBBB          6     7
    BBBBBB          7     9
    BBBBBB          1     0
    BBBBBB          2     2
    BBBBBB          3     1
    CCCCCC          5     8
    CCCCCC          7     0
    CCCCCC          8     3
    CCCCCC          9     3
    I want to get the alv list like this.
    Some heading for  "AAAAAA"
    AAAAAA          1     1
    < space >                     1     2
    < space >                          2     8
    Some heading for  "BBBBBB"
    BBBBBB          6     7
    < space >                          7     9
    < space >                          1     0
    < space >                          2     2
    < space >                          3     1
    Some heading for  "CCCCCC"
    CCCCCC          5     8
    < space >                          7     0
    < space >                          8     3
    < space >                          9     3
    anyone know how to do using field catelog or anyhow....
    thanks and regards
    Jose
    Edited by: Jijo Jose on Feb 20, 2008 3:57 PM
    Edited by: Jijo Jose on Feb 20, 2008 3:58 PM

    Hi all
    I have some data in ITAB like this,
    AAAAAA          1     1
    AAAAAA          1     2
    AAAAAA          2     8
    BBBBBB          6     7
    BBBBBB          7     9
    BBBBBB          1     0
    BBBBBB          2     2
    BBBBBB          3     1
    CCCCCC          5     8
    CCCCCC          7     0
    CCCCCC          8     3
    CCCCCC          9     3
    I want to get the alv list like this.
    Some heading for  "AAAAAA"
    AAAAAA          1     1
    < space >                     1     2
    < space >                          2     8
    Some heading for  "BBBBBB"
    BBBBBB          6     7
    < space >                          7     9
    < space >                          1     0
    < space >                          2     2
    < space >                          3     1
    Some heading for  "CCCCCC"
    CCCCCC          5     8
    < space >                          7     0
    < space >                          8     3
    < space >                          9     3
    anyone know how to do using field catelog or anyhow....
    thanks and regards
    Jose
    Edited by: Jijo Jose on Feb 20, 2008 3:57 PM
    Edited by: Jijo Jose on Feb 20, 2008 3:58 PM

  • Hiding some fields from ALV report

    Hi All,
    I want to know if there is way to hide certain fields in ALV for some users only and not for others?
    If I use the option NO_OUT = 'X'  it will not be displayed in the list but the user can see the in the Layout option fields but if use NO_OUT = 'X' and TECH = 'X' the field will not be in the list and in the layout also but other users will miss that field.
    If I create user specific variant, but once the user is in the report he can change the layout so certain fields cannot be hidden.
    So, is there any way to hide some fields for certain users and not for others without hard coding user ids in program and restricting the fields from display??
    Thanks in Advance.
    Sonali.

    Thank You Vijay for the reply.
    I knew that Authorization object was the final solution but before using it I wanted to find out if there was a way in the ALV report to restrict certain fields.
    Sonali.

  • Subtotals in ALV report for ALPHA-NUMERIC field

    Hi Experts,
    I have problem while subtotalling values in ALV report.
    I have 8 fields in my fieldcatalog. Now, I have to do the subtotal based on 3rd field having name 'ABC'. This field is having type CHAR & having lenght 3.
    Now I wanted to do subtotalling for field 7 & 8 as 'NETWR' & 'MENGE' based on 3rd field.
    How we can do the subtotal?

    Hi,
    Refer this code
    *&      Form  sub_display_data
          text
    FORM sub_display_data .
    *--To sort the output through material number
      DATA : lwa_sort TYPE slis_sortinfo_alv.
      DATA : lit_sort TYPE slis_t_sortinfo_alv.
    *--Pass the values to the table
      lwa_sort-fieldname = 'PERNR'.             "Field name in o/p inttable
      lwa_sort-tabname   = 'it_final2'.         "Output Internal table
      lwa_sort-spos      = '1'.                 "Sort  sequence
      lwa_sort-up        = 'X'.                 "Sort in ascending order
      lwa_sort-down      = ' '.                 "Sort in descending order
      lwa_sort-subtot    = 'X'.                 "Subtotal
      APPEND lwa_sort TO lit_sort.
    *--Pass the values to the table
      lwa_sort-fieldname = 'WORKDATE'.          "Field name in o/p inttable
      lwa_sort-tabname   = 'it_final2'.         "Output Internal table
      lwa_sort-spos      = '2'.                 "Sort  sequence
      lwa_sort-up        = 'X'.                 "Sort in ascending order
      lwa_sort-down      = ' '.                 "Sort in descending order
      lwa_sort-subtot    = ' '.                 "Subtotal
      APPEND lwa_sort TO lit_sort.
    *--Pass the values to the table
      lwa_sort-fieldname = 'WEKLY'.             "Field name in o/p inttable
      lwa_sort-tabname   = 'it_final2'.         "Output Internal table
      lwa_sort-spos      = '3'.                 "Sort  sequence
      lwa_sort-up        = 'X'.                 "Sort in ascending order
      lwa_sort-down      = ' '.                 "Sort in descending order
      lwa_sort-subtot    = ' '.                 "Subtotal
      APPEND lwa_sort TO lit_sort.
      wa_layout-colwidth_optimize = 'X'.
      IF NOT it_final2[] IS INITIAL.
    *--Call the function module to display the ALV report
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            is_layout          = wa_layout
            i_callback_program = v_repid
            it_fieldcat        = it_fieldcat1[]
            i_default          = c_chk
            i_save             = c_save
            it_sort            = lit_sort
          TABLES
            t_outtab           = it_final2
          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.
      ELSE.
    *--Message No data found
        MESSAGE i888 WITH text-017.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " sub_display_data
    Regards,
    Prashant

  • Sub Total Field to be bold in a ALV report

    Dear Experts,
    Thanks for your help till date.
    I have an issue with an ALV report where the sub total field is coming, it is highlited and showing in Bold. But when I take the print of that particular report, the sub total field is not coming in bold. Is there any way to make the sub total field bold in an ALV report and the print also the same.
    Regards
    OP

    Hello Experts,
    Any replies for the above Scenarios...
    Waiting for your's valuable Feedback
    Regards
    Om Prakash gupta

  • To add new characterstics to a report group

    Hi,
    We have created a report group under 601 library. Structure used is CCSS. But we need the field currency type to be added as a characterstic. Since it is not avialable in CCSS we are unable to do that.Please suggest a way.
    Thanks,
    Seema.

    Hi Shamia,
    Check these Tcode for Report painter,
    Report painter....
    GRR1, grr2, grr3
    GS11, 12, 13 for variable
    GS01, 01, 03 for sets
    GR51, 52, 53 for report group
    GR21, 22, 23 for library
    for export-import:
    -Any new variables (GS17 - Export ,GS18 - Import )
    -new sets (GS07 - Export ,GS08 - Import )
    -new report (GR37 - Export ,GR38 - Import )
    -new report group (GR57 - Export , GR58 - Import )
    -new library (GR27 - Export , GR28 - Import )
    [Report Painter|http://www.virtuosollc.com/PDF/Get_Reporter.pdf]
    Hope your problem solves.
    Thanks & regards,
    Dileep .C

  • Some doubts in alv report

    how can i page breakin alv report ?
    what are the types of variants and events in alv report?
    how to hide field in alv?
    how to change standard pf status in alv reports?
    plz give me sample program for how to use variants in alv?
    <THREAD LOCKED. Please stop asking interview questions. There is already a lot of information out there, refer to the [Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement] on how to ask a good question and learn to search>
    Edited by: Mike Pokraka on Oct 15, 2008 4:52 PM

    how can i page breakin alv report ?
    - Yes... using NEW-PAGE
    what are the types of variants and events in alv report?
    - DATA: g_variant LIKE disvariant.
    - DATA: gt_eventos          TYPE slis_t_event.
    how to hide field in alv?
    - When you define the field catalog mark this field ls_fieldcat-no_out = 'X'.
    how to change standard pf status in alv reports?
    CLEAR ls_extab.
    ls_extab-fcode = 'ZASSIG'.
    APPEND ls_extab TO extab.
    SET PF-STATUS 'Z09_STATUS' EXCLUDING extab.

  • ALV Report - Production Scheduling Report

    Hello Gurus,
    I need to write an ALV report of open production order operations per selection criteria.  If the production orders are linked to any sales order, then the result of ALV should also contain the sales order data.
    Selection screen should contain -
    Plant(required), Production order number(optional), Material number (optional), Work center (optional).
    If the system statuses of the production orders are not TECO, CLSD, DV then they are considered as open.
    The ALV report should contain the following fields.
    SO Number, PO Nbr, Ship-to-address, Material availability date, Req ship date, Last confirmed date, Ship via, Sales order line item, Pro Ord Nr, Plant, Pro ord cre date, Material Nbr, Material desc, Order qty, UOM, Sch Start date, Sche finish date, user status, MRP ctrler, Remaining hrs etc.
    Please guide me how to proceed to achieve the required report.
    Regards,
    B

    Why can't you proceed with your previous thread,,
    Re: Production Order Statuses - Open production orders
    call function 'STATUS_TEXT_EDIT'.
    exporting
       objnr     = w_objnr
    importing
       line       = line
    if line CS 'TECO' or
      line CS 'CLSD' or
      line CS 'DV'.
    " closed orders
    else.
    "open orders
    endif.

  • Decimal point  for Price value in  ALV Report

    HI,
    I have created ALV report,
    I have 2 price fields in ALV report
    For first field i have to display  in the below format.
    If the value of the field is 3601152 then I have to display it as 36011.52 
    For second field I have to display in the below format
    if the  value is 2494 then I have to display it as 2495.00
    else if the value is 3498.73,then I need not to do anything.
    that means If there is no decimal point, then I have to keep decimal point.
    Thanks&Regards
    RamaDevi

    HI,
    you can work with search and concatenate.
    value1 = 3601152
    search value1 for '.' .
    if sy-subrc eq 0.
      concatenate value1(5) '.' value1(2)+5 into text.
    Or value1 = value1 / 100.
    endif.
    Regards
    Nicole

  • ALV Avoid repeated values for a field

    I have developed an ALV report. In that 1 field say Company Code along with its details are getting displayed. I dont want the same Company Code to get printed repeatedly. It is sorted by Company Code.
    Company code should get printed only once when it gets changed ..
    eg:
    Comp1 sdf ghj
    Comp1 bvc asd
    Comp2 qqq ert
    Comp2 www rrr
    Comp2 tyu iop
    I want a report like this:
    Comp1 sdf ghj
          bvc asd
    Comp2 qqq ert
          www rrr
          tyu iop
    Can anyone help me ? Its urgent ..
    Thanking you in advance,
    Shankar

    Hi,
    Check the sample code.
    REPORT  Z_TEST_HERSEQ_LIST_DISPLAY.
    type-pools : slis.
    *--Data declaration
    data : itab_ekko like standard table of ekko with header line,
           itab_ekpo like standard table of ekpo with header line.
    data : it_fldcat_ekko type SLIS_T_FIELDCAT_ALV,
           it_fldcat_ekpo type slis_t_fieldcat_alv.
    data : v_repid type sy-repid.
    DATA : IS_KEYINFO TYPE SLIS_KEYINFO_ALV.
    data : header type slis_tabname,
           item   type slis_tabname,
           layout type slis_layout_alv.
    **--Table declaration
    tables : ekko.
    **--selection screen
    select-options: s_ebeln for ekko-ebeln.
    initialization.
      v_repid = sy-repid.
    **--Start of selection
    start-of-selection.
    select * from ekko
      into table itab_ekko
      where ebeln in s_ebeln.
    if not itab_ekko[] is initial.
      select * from ekpo
        into table itab_ekpo
        for all entries in itab_ekko
        where ebeln = itab_ekko-ebeln.
    endif.
    perform fldcat.
    *perform set_layout.
    perform herseq_list.
    *&      Form  fldcat
    *       text
    * Form to populating fieldcat
    form fldcat .
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = v_repid
       I_INTERNAL_TABNAME           = 'ITAB_EKKO'
       I_STRUCTURE_NAME             = 'EKKO'
    *   I_CLIENT_NEVER_DISPLAY       = 'X'
    *   I_INCLNAME                   =
    *   I_BYPASSING_BUFFER           =
    *   I_BUFFER_ACTIVE              =
      CHANGING
        ct_fieldcat                  = it_fldcat_ekko
    * 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_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = v_repid
       I_INTERNAL_TABNAME           = 'ITAB_EKPO'
       I_STRUCTURE_NAME             = 'EKPO'
    *   I_CLIENT_NEVER_DISPLAY       = 'X'
    *   I_INCLNAME                   =
    *   I_BYPASSING_BUFFER           =
    *   I_BUFFER_ACTIVE              =
      CHANGING
        ct_fieldcat                  = it_fldcat_ekKo
    * 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.
    endform.                    " fldcat
    *&      Form  herseq_list
    *       text
    *her list
    form herseq_list .
    IS_KEYINFO-HEADER01 ='EBELN' .
    IS_KEYINFO-ITEM01 = 'EBELN'.
    header = 'ITAB_EKKO'.
    item = 'ITAB_EKPO'.
    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
      EXPORTING
    *   I_INTERFACE_CHECK              = ' '
    *   I_CALLBACK_PROGRAM             =
    *   I_CALLBACK_PF_STATUS_SET       = ' '
    *   I_CALLBACK_USER_COMMAND        = ' '
    *   IS_LAYOUT                      = layout
       IT_FIELDCAT                    =  IT_FLDCAT_EKKO
    *   IT_EXCLUDING                   =
    *   IT_SPECIAL_GROUPS              =
    *   IT_SORT                        =
    *   IT_FILTER                      =
    *   IS_SEL_HIDE                    =
    *   I_SCREEN_START_COLUMN          = 0
    *   I_SCREEN_START_LINE            = 0
    *   I_SCREEN_END_COLUMN            = 0
    *   I_SCREEN_END_LINE              = 0
    *   I_DEFAULT                      = 'X'
    *   I_SAVE                         = ' '
    *   IS_VARIANT                     =
    *   IT_EVENTS                      =
    *   IT_EVENT_EXIT                  =
        i_tabname_header               = HEADER
        i_tabname_item                 = ITEM
    *   I_STRUCTURE_NAME_HEADER        =
    *   I_STRUCTURE_NAME_ITEM          =
        is_keyinfo                     = is_keyinfo
    *   IS_PRINT                       =
    *   IS_REPREP_ID                   =
    *   I_BYPASSING_BUFFER             =
    *   I_BUFFER_ACTIVE                =
    *   IR_SALV_HIERSEQ_ADAPTER        =
    *   IT_EXCEPT_QINFO                =
    *   I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER        =
    *   ES_EXIT_CAUSED_BY_USER         =
      tables
        t_outtab_header                =   itab_ekko
        t_outtab_item                  =   itab_ekpo
    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.
    endform.                    " herseq_list
    Regards
    vijay

  • ALV Report output as per selection screen

    Hi,
    I got a requirement. In selection screen there is field where i can entered 1 to 12 numbers. When i entered a number,  so that in output of an alv report should display that many fields
    for eg.
    if  i entered 5 in selection screen
    in out put 5 fields of alv report should display.
    Thanks....
    Moderator message : Spec dumping / Outsourcing is not allowed. Thread locked.
    Edited by: Vinod Kumar on Jul 15, 2011 11:34 AM

    hi,
    u sort the internal table by the materials in our variant.
    like sort itab by jtab
    itab consists of all materials
    jtab cosists of materials in variant.
    hope it may helpful,
    regards,
    chandu

  • Alv reports 2

    plz how to add logo to alvreports.how to give end of page ain alv reports.how to change a field in output in alv grid.

    hi
    check this piece of code
    at selection-screen.
    PERFORM TO FETCH DATA
    case sscrfields.
    when 'UCOM'.
            perform dataselection.
    endcase.
    *&      Form  user_command
          text
         -->R_UCOMM    text
         -->SELFIELD   text
    form user_command using r_ucomm type sy-ucomm
    selfield type slis_selfield .
    on the basis of the button clicked, execution of a code
      case r_ucomm.
      when 'SAVE'.
        data: t_spopli like spopli occurs 0 with header line.
    t_spopli-varoption = 'PDF'.
    append t_spopli.
    t_spopli-varoption = 'EXCEL'.
    append t_spopli .
           call function 'POPUP_TO_DECIDE_LIST'
             exporting
             CURSORLINE               = 1
             MARK_FLAG                = ' '
             MARK_MAX                 = 1
             START_COL                = 0
             START_ROW                = 0
               textline1                = 'SELECT THE FORMAT OF THE OUTPUT'
             TEXTLINE2                = ' '
             TEXTLINE3                = ' '
               titel                    = 'SAVE AS'
             DISPLAY_ONLY             = ' '
            importing
              answer                   =  l_answer
             tables
               t_spopli                 = t_spopli
            exceptions
              not_enough_answers       = 1
              too_much_answers         = 2
              too_much_marks           = 3
              others                   = 4  .
           if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
           endif.
           perform download.
    exit when back or exit button is pressed
        when 'BACK'.
          leave program .
        when 'EXIT'.
          leave program .
      endcase.
    endform.                    " user_command
    end-of-selection.
    *&      Form  dataselection
          text
    -->  p1        text
    <--  p2        text
    form dataselection .
    fetching details from database table on the basis of material number fetched.
      if mtr = 'X' and sloc = 'X'.
        select banfn
               bnfpo
               loekz
               statu
               ekgrp
               matnr
               werks
               lgort
               preis
               peinh
               from eban into table it_pr where matnr = p_matnr and lgort = str_loc .
               elseif mtr = 'X'.
               select banfn
               bnfpo
               loekz
               statu
               ekgrp
               matnr
               werks
               lgort
               preis
               peinh
               from eban into table it_pr where matnr = p_matnr.
               elseif sloc = 'X'.
               select banfn
               bnfpo
               loekz
               statu
               ekgrp
               matnr
               werks
               lgort
               preis
               peinh
               from eban into table it_pr where lgort = str_loc.
               else.
               message e002(zpurreq_msg).
            endif.
    flag to check single access of the database
        if iflag = 0.
       perform build_catalog.
        endif.
    perform build_events
      perform build_events.
    *break-point .
        call function 'REUSE_ALV_GRID_DISPLAY'
         exporting
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                 = 'X'
      I_BUFFER_ACTIVE                   = ' '
           i_callback_program                = pr_id
          i_callback_pf_status_set          = 'SET_PF_STATUS'
           i_callback_user_command           = '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                       = 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
      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
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
          tables
            t_outtab                          = it_pr
         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.
        perform set_pf_status using rt_extab.
      endform.                    " dataselection
    *&      Form  set_pf_status
          text
         -->P_RT_EXTAB  text
         -->P_TYPE  text
         -->P_SLIS_EXTAB  text
    form set_pf_status  using p_rt_extab.
    break-point.
      set pf-status 'Z_71945_STATUS'.
      endform.
      form
      build_events .
    call function 'REUSE_ALV_EVENTS_GET'
        exporting
          i_list_type     = 0
        importing
          et_events       = it_event
        exceptions
          list_type_wrong = 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.
    read contents of table it_event into work area*
      read table it_event with key name = slis_ev_top_of_page
      into wa_event.
      if sy-subrc eq 0.
        move 'ALV_TOP_OF_PAGE' to wa_event-form.
        modify it_event from wa_event index sy-tabix.
      endif.
      read table it_event with key name = slis_ev_end_of_list
      into wa_event.
      if sy-subrc eq 0.
        move 'ALV_END_OF_LIST' to wa_event-form.
        modify it_event from wa_event index sy-tabix.
      endif.
    endform.                    " build_events
    *&      Form  ALV_TOP_OF_PAGE
          text*
    form alv_top_of_page.
      data:h_header type slis_t_listheader,
            wa_header type slis_listheader.
    building the header of the list*
    *break-point.
      wa_header-typ = 'H'.
      concatenate 'Purchase'
                  'Requisition'
      into wa_header-info separated by space.
      append wa_header to h_header.
      clear wa_header.
      wa_header-typ = 'S'.
      wa_header-key = 'Name:'.
      wa_header-info = 'Infosys technologies limited'.
      append wa_header to h_header.
      clear wa_header.
      wa_header-typ = 'S'.
      wa_header-key = 'Address:'.
      wa_header-info = 'IT PARK Chandigarh'.
      append wa_header to h_header.
      clear wa_header.
      wa_header-typ = 'S'.
      wa_header-key = 'DATE:'.
      concatenate sy-datum+6(2)'-'
                  sy-datum+4(2)'-'
                  sy-datum(4)
      into wa_header-info.
      append wa_header to h_header.
      clear wa_header.
      wa_header-typ = 'S'.
      wa_header-key = 'TIME:'.
      concatenate  sy-uzeit(2)':'
                   sy-uzeit+2(2)':'
                   sy-uzeit+4(2)
      into wa_header-info.
      append wa_header to h_header.
      clear wa_header.
      wa_header-typ = 'S'.
      wa_header-key = 'Material Number:'.
      wa_header-info = p_matnr.
      append wa_header to h_header.
      clear wa_header.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
        exporting
          it_list_commentary = h_header
          i_logo             = 'INFY1'.
    endform.                    "ALV_TOP_OF_PAGE
    *&      Form  ALV_END_OF_LIST
          text*
    form alv_end_of_list.
    building the footer*
      data: f_footer type slis_t_listheader,
            wa_footer type slis_listheader.
      wa_footer-typ = 'A'.
      concatenate 'Authorized'
                   'Signature'
                   into wa_footer-info separated by space.
      append wa_footer to f_footer.
      clear wa_footer.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
        exporting
          it_list_commentary = f_footer.
    endform.                    "ALV_END_OF_LIST&----
    *&      Form  build_catalog
          text
    -->  p1        text
    <--  p2        text
    form build_catalog .
    building the catalog.
      wa_fieldcat-col_pos = 1.
      wa_fieldcat-fieldname =  'BANFN'.
      wa_fieldcat-tabname  = 'eban'.
      wa_fieldcat-outputlen = '10'.
      wa_fieldcat-seltext_l = 'PUR_REQ'.
      wa_fieldcat-datatype  = 'C'.
      wa_fieldcat-emphasize = 'C511'.
      append wa_fieldcat to it_fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-col_pos = 2.
      wa_fieldcat-fieldname =  'BNFPO'.
      wa_fieldcat-tabname  = 'eban'.
      wa_fieldcat-outputlen = '9'.
      wa_fieldcat-seltext_l = 'ITEM_REQ'.
      wa_fieldcat-datatype  = 'C'.
      wa_fieldcat-emphasize = 'C611'.
      append wa_fieldcat to it_fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-col_pos = 3.
      wa_fieldcat-fieldname =  'LOEKZ'.
      wa_fieldcat-tabname  = 'eban'.
      wa_fieldcat-outputlen = '7'.
      wa_fieldcat-seltext_l = 'DEL_IND'.
      wa_fieldcat-datatype  = 'C'.
      wa_fieldcat-emphasize = 'C511'.
      append wa_fieldcat to it_fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-col_pos = 4.
      wa_fieldcat-fieldname =  'STATU'.
      wa_fieldcat-tabname  = 'eban'.
      wa_fieldcat-outputlen = '10'.
      wa_fieldcat-seltext_l = 'PROC_STAT'.
      wa_fieldcat-datatype  = 'C'.
      wa_fieldcat-emphasize = 'C611'.
      append wa_fieldcat to it_fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-col_pos = 5.
      wa_fieldcat-fieldname =  'EKGRP'.
      wa_fieldcat-tabname  = 'eban'.
      wa_fieldcat-outputlen = '10'.
      wa_fieldcat-seltext_l = 'PUR_GRP'.
      wa_fieldcat-datatype  = 'C'.
      wa_fieldcat-emphasize = 'C511'.
      append wa_fieldcat to it_fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-col_pos = 6.
      wa_fieldcat-fieldname =  'MATNR'.
      wa_fieldcat-tabname  = 'eban'.
      wa_fieldcat-outputlen = '18'.
      wa_fieldcat-seltext_l = 'MATERIAL NO'.
      wa_fieldcat-datatype  = 'C'.
      wa_fieldcat-emphasize = 'C611'.
      append wa_fieldcat to it_fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-col_pos = 7.
      wa_fieldcat-fieldname =  'WERKS'.
      wa_fieldcat-tabname  = 'eban'.
      wa_fieldcat-outputlen = '8'.
      wa_fieldcat-seltext_l = 'PLANT'.
      wa_fieldcat-datatype  = 'C'.
      wa_fieldcat-emphasize = 'C511'.
      append wa_fieldcat to it_fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-col_pos = 8.
      wa_fieldcat-fieldname =  'LGORT'.
      wa_fieldcat-tabname  = 'eban'.
      wa_fieldcat-outputlen = '10'.
      wa_fieldcat-seltext_l = 'STRG_LOC'.
      wa_fieldcat-datatype  = 'C'.
      wa_fieldcat-emphasize = 'C611'.
      append wa_fieldcat to it_fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-col_pos = 9.
      wa_fieldcat-fieldname =  'PREIS'.
      wa_fieldcat-tabname  = 'eban'.
      wa_fieldcat-outputlen = '10'.
      wa_fieldcat-seltext_l = 'VAL_PRICE'.
      wa_fieldcat-datatype  = 'C'.
      wa_fieldcat-emphasize = 'C511'.
      append wa_fieldcat to it_fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-col_pos = 10.
      wa_fieldcat-fieldname =  'PEINH'.
      wa_fieldcat-tabname  = 'eban'.
      wa_fieldcat-outputlen = '10'.
      wa_fieldcat-seltext_l = 'PRICE_UNIT'.
      wa_fieldcat-datatype  = 'C'.
      wa_fieldcat-emphasize = 'C611'.
      append wa_fieldcat to it_fieldcat.
      clear wa_fieldcat.
      iflag = 1.
    endform.                    " build_catalog
    *&      Form  DOWNLOAD
          text
    -->  p1        text
    <--  p2        text
    form download .
    if l_answer = '2'.
    call function 'GUI_DOWNLOAD'
      exporting
      BIN_FILESIZE                    =
        filename                        = 'C:\REPORT.XLS'
      FILETYPE                        = 'ASC'
       append                          = ' '
       write_field_separator           = 'X'
       header                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
    IMPORTING
      FILELENGTH                      =
      tables
        data_tab                        = it_pr
      FIELDNAMES                      =
    exceptions
       file_write_error                = 1
       no_batch                        = 2
       gui_refuse_filetransfer         = 3
       invalid_type                    = 4
       no_authority                    = 5
       unknown_error                   = 6
       header_not_allowed              = 7
       separator_not_allowed           = 8
       filesize_not_allowed            = 9
       header_too_long                 = 10
       dp_error_create                 = 11
       dp_error_send                   = 12
       dp_error_write                  = 13
       unknown_dp_error                = 14
       access_denied                   = 15
       dp_out_of_memory                = 16
       disk_full                       = 17
       dp_timeout                      = 18
       file_not_found                  = 19
       dataprovider_exception          = 20
       control_flush_error             = 21
       others                          = 22
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    endif.
    endform.                    " DOWNLOAD
    regards
    vijay
    reward points if helpful

Maybe you are looking for

  • I WANT TICKETS WHICH COME DURING SUPPORT PROJECT IN SD

    HI I WANT TICKETS WHICH COME DURING SUPPORT PROJECT FOR SD AND ALSO I WANT THE PPT.TRAINING GUIDE FOR SD , IF ANYBODY HAVING REGARDS PRADEEP

  • Brush adjustment jpg?

    I've downloaded Aperture from the App Store and am just learning basics. Previously I've edited photos in PSE. All my images are .jpg as my current camera RAW output is not supported by Aperture. I would like advice please re use of brushes. With all

  • Trying to update Photoshop 5 Camera Raw. Get message installation failed. No other information. Please advise.

    Trying to update Photoshop 5 Camera Raw. Get message installation failed. No other information. Please advise. Running Windows 7 64 bit on Dell Precision m4500. 8G 500G. Is there an alternative way to update the camera profiles in ACR. I am trying to

  • IPhone Scare.

    This morning I went to back up my iPhone (haven't in a couple weeks.) It just hung up in "Updating Contacts" Yesterday, waiting on girlfriend, I did go through my contacts (deleting some, editing others, etc.)--but still it seemed like it was stuck i

  • CIS UK Scheme

    When we reversed a logistics invoice the withholding tax figure on the invoice was not deducted. We use version 4.6C. I cannot find any configuration setting, so is it a bug, or is there a setting somewhere I have not switched on? Thanks Pete