ALV Output - Need to show count of line items based on 1 key field.

Hi All,
       In my prog i need to show an ALV ouput which is having Matnr,Material type and Division . MATNR is the key field. I need to show how many line items are present against a  particular MATNR in that ALV ouput itself. Not in the top of page. I think there might be some field in SLIS which can be use for the same. If any one has come across such a requirement then please revert back.
thanx,
Shyam.
PS: Useful answers will be rewarded.

Ok, so we are back to using the COUNT field and now using the SORT functionaity, the SORT will allow us to subtotal by MATNR.
REPORT  zrich_0001.
* Global ALV Data Declarations
TYPE-POOLS: slis.
* Internal Tables
TYPES: BEGIN OF talv ,
       matnr TYPE mara-matnr,
       mtart TYPE mara-mtart,
       spart TYPE mara-spart,
       count TYPE i,
       END OF talv.
DATA: ialv TYPE TABLE OF talv WITH HEADER LINE.
DATA: fieldcat  TYPE slis_t_fieldcat_alv.
DATA: sort     TYPE slis_t_sortinfo_alv.
DATA: layout    TYPE slis_layout_alv.
START-OF-SELECTION.
  PERFORM get_data.
  PERFORM call_alv.
*      Form  GET_DATA
FORM get_data.
  SELECT matnr mtart spart INTO TABLE ialv
            FROM mara UP TO 500 ROWS.
ENDFORM.                    "GET_DATA
*  CALL_ALV
FORM call_alv.
  PERFORM build_field_catalog.
  PERFORM build_sort.
  layout-countfname = 'COUNT'.              "<-----  HERE
* Call ABAP List Viewer (ALV)
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      it_sort     = sort
      is_layout   = layout
      it_fieldcat = fieldcat
    TABLES
      t_outtab    = ialv.
ENDFORM.                    "CALL_ALV
* BUILD_FIELD_CATALOG
FORM build_field_catalog.
  CLEAR: fieldcat. REFRESH: fieldcat.
  DATA: tmp_fc TYPE slis_fieldcat_alv.
  tmp_fc-reptext_ddic = 'Material'.
  tmp_fc-fieldname    = 'MATNR'.
  tmp_fc-tabname      = 'IALV'.
  tmp_fc-outputlen    = '18'.
  APPEND tmp_fc TO fieldcat.
  tmp_fc-reptext_ddic = 'Material Type'.
  tmp_fc-fieldname    = 'MTART'.
  tmp_fc-tabname      = 'IALV'.
  tmp_fc-outputlen    = '4'.
  APPEND tmp_fc TO fieldcat.
  tmp_fc-reptext_ddic = 'Division'.
  tmp_fc-fieldname    = 'SPART'.
  tmp_fc-tabname      = 'IALV'.
  tmp_fc-outputlen    = '2'.
  APPEND tmp_fc TO fieldcat.
  tmp_fc-reptext_ddic = 'Count'.
  tmp_fc-fieldname    = 'COUNT'.
  tmp_fc-tabname      = 'IALV'.
  tmp_fc-outputlen    = '5'.
  tmp_fc-do_Sum       = 'X'.
  append tmp_fc to fieldcat.
ENDFORM.                    "build_field_catalog
*&      Form  build_sort
*       text
FORM build_sort.
  DATA: tmp_sort TYPE LINE OF slis_t_sortinfo_alv.
  CLEAR sort. REFRESH sort.
  CLEAR tmp_sort.
  tmp_sort-fieldname = 'MATNR'.
  tmp_sort-tabname   = 'IALV'.
  tmp_sort-up        = 'X'.
  tmp_sort-subtot    = 'X'.
  APPEND tmp_sort TO sort.
ENDFORM.                    "build_sort
Regards,
Rich Heilman

Similar Messages

  • Need to show Counter at report level based on Position

    Chaps,
    one of my HR report requires a counter value based on Position. exactly what i required is want to show the no. of positions count based on Resource type. ( Resource type is a navig. attr of Position). How to define counter for this?
    Thanks.
    Rgds,
    ST.

    Hi Sathish,
       Create a formula variable with replacement with position and attribute resource type. Here write formula.
       Example: (formula variable >= 0)*1+0
    Regards
    Prasad

  • How to add new line item based on main item using crm_order_maintain

    Hi All,
    can you please provide a way to create a new line item based on main line item and save in crm transaction( in house repair order) by using crm_order_maintain(from SAP GUI).
    Thanks,
    vinod.

    Hi Vinod,
    The relationship with main item is stored with CRMD_ORDERADM_I- Parent.
    You need to pass the guid of main item to orderadm_i-parent. This will keep the relationship with main item.
    Thanks
    Ajay

  • MIRO Split out line item based on different tax amounts

    Hello Friends,
    We have a scenario where we get different tax rates related to the same line item quoted on the invoice which we receive from the vendor. The split out of the line item amount into different tax rates is not known at the time of booking the PO. For example, the PO line item is enter with value 1000Eur. This now shows as one line item in MIRO.
    However, when the paper invoice is received fom the vendor, the 1000Eur may be split between delivery cost of 800Eur with tax rate of 10% and legal fees of 200Eur with tax rate of 5%. These tax rates are not always 10% and 5%, they can vary depending on whatever the itme on the PO is.
    Is there any way in MIRO to split out the single line item into separate line items to allow us book a part of the line item with tax rate of 10% and the other part with tax rate of 5%?
    Or suggestions of how to handle this scenario in SAP (apart from going backwards and altering the PO to split into 2 separate line items which is later in the process and involves alot of overhead etc)?
    We tried to activate the Amount Split functionality but (1) this does not seem to allow a split out by tax code and (2) it seems limited only to the Finanl Invoice amount.
    Thanks for any help.
    Regards
    Mik

    No feedback so closing

  • Completion and approval workflows in line item based SC approval scenario

    Hi SRM experts,
    We are on SRM 7 ECS , support pack SAPKIBKV08
    We are designing line item based SC approval workflow. We also have completion workflow. i.e after requester creates a shopping cart, it goes to buyer as per completion workflow( if the SC does not have price , vendor or has a free text)  , and then after the completion workflow, it goes to main SC approval workflow.
    My questions are :
    1. If a requester creates 2 line items in SC , and 1 line item does not have price/vendor/or material , whereas 2nd line item has price/vendor/ and material , can we send onlt the 1st line item  to completion workflow and not send the 2nd line item in the completion workflow but directly to SC approval workflow  ?  OR we have to send the entire cart to the completion workflow ?
    2. After the completion and the approval workflow , if line item 1 is approved, can it create a PO , whereas the 2nd line be still in approval . i.e  do all the cart items need to be approved before creating POs or as and when individual line items get approved , they can create thier own POs
    Rgds
    Sumendra

    Hi Sumedra,
    Which workflow are you using - application or process contrlled workflow?
    Assuming you are using process-controlled workflow - I will answer following questions -
    1. Can offline approval be used for item based shopping cart approval workflow?
    - Yes, it can be used !
    2. Can different line items be sent by mail to different mail boxes?
    Yes
    3. Will 1 manager see all the 10 line items OR only the 1 line item for which he is responsible?
    1 manager can 'see' all the items but he can only approve or reject the item that he is suppose to act on. All other item will be grayed out. However, this behaviour is configuarable !
    4. If he will get only line for which he is responsible , and once he clicks on approve , will this approval apply to his line item only , OR it will apply to all the 10 line items ?
    - see above
    Regards,
    Amit

  • Offline approval for line item based Shopping carts

    Hi ,
    We are planning to  use offline approval and line item based approval (item based approval workflow) for shopping carts.
    For e.g. 10 line items in a cart can have 10 different  cost centres, and a line each need to go to respective cost centre managers for approval.
    have few clarifications:
    1. Can offline approval be used for item based shopping cart approval workflow?
    2. Can different line items be sent by mail to different mail boxes?
    3.  Will 1 manager see all the 10 line items OR only the 1  line item for which he is responsible?
    4. If he will get only line for which he is responsible , and once he clicks on approve , will this approval apply to his line item only , OR it will apply to all the 10 line items ?
    Rgds
    Sumendra

    Hi Sumedra,
    Which workflow are you using - application or process contrlled workflow?
    Assuming you are using process-controlled workflow - I will answer following questions -
    1. Can offline approval be used for item based shopping cart approval workflow?
    - Yes, it can be used !
    2. Can different line items be sent by mail to different mail boxes?
    Yes
    3. Will 1 manager see all the 10 line items OR only the 1 line item for which he is responsible?
    1 manager can 'see' all the items but he can only approve or reject the item that he is suppose to act on. All other item will be grayed out. However, this behaviour is configuarable !
    4. If he will get only line for which he is responsible , and once he clicks on approve , will this approval apply to his line item only , OR it will apply to all the 10 line items ?
    - see above
    Regards,
    Amit

  • Line item based approval

    Hi All,
    I have line item based approval workflow WS14500015. My shopping cart has multiple line items each awaiting approval from multiple approvers.
    Now my requirement is when any approver approves his line items , that particular line items should not be allowed for changes even though the shopping cart has status awaiting approval coz others line items are still awaiting approval .
    Is this possible i.e user should be able to make changes to unapproved line items abut not approved line items .
    Can i user badi BBP_WFL_SECURE_BADI for this ?? Please if anyone has already done this please share your inputs .
    Thanks in advance
    Iftekhar Alam

    Hi Alam,
    have you checked the APPROVAL_HISTORY_TABLE and ITEM_APPROVAL_HISTORY_TABLE? Here you will receive information on already approved items and the current approval process.
    Kind regards,
    Thomas

  • How to show limited items based on a custom field

    Is there a way to show only web app items based on the custom date field? For example, i want the module to only show web app item(s) whose "event date" is "today"....  ?? Help please!

    There has to be a jQuery plugin that can help you do that... just search on Google, Stackoverflow, etc...
    There's one that SimpleFlame wrote via Kiyuko but it's a premium offering:
    http://kiyuco.com/tutorials/create-a-web-app-driven-event-calendar

  • COPA Realignments for line item based reports

    Hi Guru
    I built two CO-PA  line item based reports in our environment. Now , there are some organizational changes in our environment and Now I have re-derive a characteristic from customer master data. Does those changes reflect in my line item based reports, If i run Re-Alignments (KEND)?
    Thanks in advance

    Line item reports (defined w/KE91) will reflect the realignment.  Line item display (KE24/KE25) will give you the choice of reading the original posting or the realigned data.

  • Line-item based profitability report (CO-PA)

    Hi SAP community,
    when I run KE24 i can select the "Mode of access"
    Read acc. to current structure ==> Realignment changes are included
    Read as posted ==> Realignment changes are excluded
    When I create a line-item based CO-PA report (KE91), do I have the same functionality, do either include or exclude realignments?
    Thanks in advance,

    When I do a realignment and run a line item based report afterwards, the reports picks up the realigned value.
    I havent seen any setting during the report setup where I could potentially define if the realigned or the original value should be picked.
    So I assume SAP always selects the realigned values from the segment table in case of a line item based report

  • ALV Output need to send to Printer

    Hi Folks,
    I need to send the ALV output to the printer. I built the ALV in OOps. The printer button is enabled in the scrren and when I give print it is goint to dump
    Below I have pasted the dump.
    Help me to solve this.
    Points will be rewarded.
    Regards,
    Raj.
    Short text
        Field symbol has not yet been assigned.
    What happened?
        Error in the ABAP Application Program
        The current ABAP program "SAPLKKBL" had to be terminated because it has
        come across a statement that unfortunately cannot be executed.
    Error analysis
        You attempted to access an unassigned field symbol
        (data segment 81).
        This error may occur if
        - You address a typed field symbol before it has been set with
          ASSIGN
        - You address a field symbol that pointed to the line of an
          internal table that was deleted
        - You address a field symbol that was previously reset using
          UNASSIGN or that pointed to a local field that no
          longer exists
        - You address a global function interface, although the
          respective function module is not active - that is, is
          not in the list of active calls. The list of active calls
          can be taken from this short dump.
    rigger Location of Runtime Error
       Program                                 SAPLKKBL
       Include                                 LKKBLF01
       Row                                     1,315
       Module type                             (FORM)
       Module Name                             CHECKBOX_OUT
    ource Code Extract
    ine  SourceCde
    1285     "<<Unicode/Doublebyte 1
    1286   else.
    1287     write at (rs_fieldcat-outputlen) <hf> as icon no-gap quickinfo
    1288                                                  rs_fieldcat-tooltip.
    1289   endif.
    1290
    1291   g_tabname = l_tabname.
    1292
    1293   format hotspot off.
    1294 *End of Orginalcoding 4.6c
    1295
    1296 endform.                               " HEADER_FIELD_OUT
    1297 &----
    1298 *&      Form  CHECKBOX_OUT
    1299 &----
    1300 *       text                                                           *
    1301 ----
    1302 form checkbox_out using rs_layout type kkblo_layout
    1303                         r_tabname type stack-i_tabname
    1304                         r_sum     type c.
    1305
    1306   data: l_mark(1) type c.
    1307
    1308   if not rs_layout-box_tabname is initial and
    1309          rs_layout-box_tabname ne r_tabname.
    1310     format color off.
    1311     write at (2) space no-gap.
    1312     exit.
    1313   endif.
    1314
    >>>>>   if not r_sum is initial or <box> = '-'.
    1316     format color off.
    1317     write at (2) space no-gap.
    1318   else.
    1319     format color off.
    1320     if <box> = ' ' or <box> = 'X'.
    1321       g_mark = <box>.
    1322       if rs_layout-no_input = 'X'.
    1323         write g_mark as checkbox no-gap input off.
    1324       else.

    check these parts in ur method:
                I_SAVE                = <var. of type CHAR01 >
                I_DEFAULT             = <var. of type CHAR01 >
                IS_LAYOUT             = <structure of type LVC_S_LAYO >
                IS_PRINT              = <structure of type LVC_S_PRNT >

  • Need to know how to show P6 Report Line Item Numbers

    Team... I cannot find where to turn on the line item numbers in P6 Reports... I can show breaks on a code then activities right below that, but can't show the line item number... only the actID... Hellllllllp!

    Thanks... I can't give a screen dump right now... but I will try to describe in better details what I am trying to do:
    Below is a sample report of a simple activity listing just as it would come from any P6 report:
    ActID Description RDur Start Finish
    ABC123 First Activity Here 9 01Jan10 10Jan10
    DEF456 Second Activity Here 9 10Jan10 19Jan10
    GHI789 Third Activity Here 9 19Jan10 26Jan10
    Below is the desired report which now includes a new, first column which gives a unique line item number for each line:
    Item# ActID Description RDur Start Finish
    1 ABC123 First Activity Here 9 01Jan10 10Jan10
    2 DEF456 Second Activity Here 9 10Jan10 19Jan10
    3 GHI789 Third Activity Here 9 19Jan10 26Jan10
    This new, first column is like the Excel Row Numbers... you don't need to try to explain what line you are addressing by ActID...

  • Customer number needed in "GL a/c line item display" for customer gl?

    Hi SAP Experts,
    while running GL account line item display in FBL3N,customer number is not displaying against the gl accounts relating to customer reconcilation account or the gls relating to the customer line item entry.my clients need that in either ASSIGNMENT field(where presently showing the document entry date as defult) or in a different column.for that he even does not want to write any report.
    How can i solve this problem?
    Plz guide me.
    I need a quick response.
    Regards,
    Biswa

    Hi,
    Check If you are using the G/L account which is the reconciliation account for your customer, then it is possible to display the special field1-U_KUNNR and it is ALSO possible to add Sort Key 031 into the Assignment field of that account in FS00 tab Control Data and therefore to display your 'Customer no.' in the Assigment field in FBL3N.
    If you are using the G/L account which is the offsetting entry or the other side of the posting, then it is NOT possible to display your 'Customer no.' neither in the Assignment field, nor adding the
    special field 1-U_KUNNR to the display. At this stage, notes 112312 and 217189 may be of use, which enable you to use a Business Transaction Event to populate offsetting account information.
    I hope these helps.
    Regards
    Ravinagh Boni

  • Need to stop posting a line item in PR using BADI ME_PROCESS_REQ_CUST

    Hi All,
    I have a requirement to check the combination of the GLaccount and project and if the combination is not allowed i need to show an error message and to stop the user from saving the Purchase Requisition.
    For this i have coded in BADI ME_PROCESS_REQ_CUST in PROCESS_ACCOUNT method.
    the badi is triggered and the error message is also shown but it is not stopping the user from saving the Purchase Requisition.
    i want to know how to invalidate a line item as we do in PO by calling item->invalidate( ) method.
    i couldnt find any method like that in the ME_PROCESS_REQ_CUST BADI.
    Please anyone of us let me know how to invalidate a line item of a purchase requesition.
    Thanks,
    Srinath S

    Hello Srinath
    Looking at the signature of interface method PROCESS_ACCOUNT it becomes obvious that you cannot stop processing of the PO requisition here.
    You need to implement your validations in method CHECK because here you have a CHANGING parameter CH_FAILED (Nomen est Omen!!!).
    Regards
      Uwe

  • Counting Requirement (Counting PO line items wrt PO No)

    Hi All,
    We have a requirement here . Suppose there are 2 Purchase orders Y & Z . "Y" purchase order has  5 line items as 10,20,30,40,50 . "Z" purchase order has 7 line items as 10,20,30,40,50,60,70 . now i want to count the number of purchase orders & no of line items . I.e output should be , for a particular month there are 2 purchase orders & 12 line items .
    Point will be awarded .
    Thanks,
    Deadlocks

    Hi Priya,
    thnx for the reply, just a small thing i wanted to ask,
    inside those two CKFs should i create a formula variable on PO header & PO item no ?
    Before this what i did was i created a CKF with constant 1 in it and then i applied exception aggregation as "total" and refrence characteristic as "PO header" & and "PO item".
    so instead of bringing item count as 12 it is bring 7 .
    Regards,
    Deadlocks

Maybe you are looking for