ALV sums of lines depending on value of field of the line?

Hi,
We have an ALV and would like to get the sums depending on the value of a field of each line.
For example: imagine we have an ALV, and there are two kinds of lines: one have a counter=1, and others have a counter=2. Is it possible to receive two totals in the ALV, one for the lines that have counter=1, and one for the lines that have counter=2? And that when a filter is being applied, the sums change automatically?
Thx!

Hi,
Please the below code which ill help to change the subtotal text, you need do manula total and replace with the wa of the subtotal with you calculated sum. In the below code i replaced a break point where you need to add your coding
*& Report  Z_ALV_SUBTOTAL
REPORT Z_ALV_SUBTOTAL.
*& Table declaration
TABLES: EKKO.
*& Type pool declaration
TYPE-POOLS: SLIS. " Type pool for ALV
*& Selection screen
SELECT-OPTIONS: S_EBELN FOR EKKO-EBELN.
*& Type declaration
*Type declaration for internal table to store EKPO data
TYPES: BEGIN OF X_DATA,
       EBELN  TYPE CHAR30,  " Document no.
       EBELP  TYPE EBELP,   " Item no
       MATNR  TYPE MATNR,   " Material no
       MATNR1 TYPE MATNR,   " Material no
       WERKS  TYPE WERKS_D, " Plant
       WERKS1 TYPE WERKS_D, " Plant
       NTGEW  TYPE ENTGE,   " Net weight
       GEWE   TYPE EGEWE,   " Unit of weight
       END OF X_DATA.
*& Internal table declaration
DATA:
     * INTERNAL TABLE TO STORE EKPO      DATA
I_EKPO TYPE STANDARD TABLE OF X_DATA INITIAL SIZE 0,
Internal table for storing field catalog information
I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
Internal table for Top of Page info. in ALV Display
I_ALV_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
Internal table for ALV Display events
I_EVENTS TYPE SLIS_T_EVENT,
Internal table for storing ALV sort information
I_SORT TYPE  SLIS_T_SORTINFO_ALV,
I_EVENT TYPE SLIS_T_EVENT.
*& Work area declaration
DATA:
WA_EKKO TYPE X_DATA,
WA_LAYOUT     TYPE SLIS_LAYOUT_ALV,
WA_EVENTS         TYPE SLIS_ALV_EVENT,
WA_SORT TYPE SLIS_SORTINFO_ALV.
*& Constant declaration
CONSTANTS:
C_HEADER   TYPE CHAR1 VALUE 'H',                    "Header in ALV
C_ITEM     TYPE CHAR1 VALUE 'S'.
*& Start-of-selection event
START-OF-SELECTION.
Select data from ekpo
  SELECT EBELN " Doc no
  EBELP " Item
  MATNR " Material
  MATNR " Material
  WERKS " Plant
  WERKS " Plant
  NTGEW " Quantity
  GEWEI " Unit
  FROM EKPO
  INTO TABLE I_EKPO
  WHERE EBELN IN S_EBELN
  AND NTGEW NE '0.00'.
  IF SY-SUBRC = 0.
    SORT I_EKPO BY EBELN EBELP MATNR .
  ENDIF.
* TO BUILD THE PAGE HEADER
PERFORM SUB_BUILD_HEADER.
* TO PREPARE FIELD CATALOG
  PERFORM SUB_FIELD_CATALOG.
* PERFORM TO POPULATE THE LAYOUT STRUCTURE
  PERFORM SUB_POPULATE_LAYOUT.
* PERFORM TO POPULATE THE SORT TABLE.
  PERFORM SUB_POPULATE_SORT.
PERFORM TO POPULATE ALV EVENT
  PERFORM SUB_GET_EVENT.
END-OF-SELECTION.
  * PERFORM TO DISPLAY ALV REPORT
  PERFORM SUB_ALV_REPORT_DISPLAY.
*&      Form  sub_build_header
      To build the header
      No Parameter
FORM SUB_BUILD_HEADER .
  * LOCAL DATA DECLARATION
  DATA: L_SYSTEM     TYPE CHAR10 ,          "System id
  L_R_LINE     TYPE SLIS_LISTHEADER,   "Hold list header
  L_DATE       TYPE CHAR10,           "Date
  L_TIME       TYPE CHAR10,           "Time
  L_SUCCESS_RECORDS TYPE I,           "No of success records
  L_TITLE(300) TYPE C.                "Title
Title  Display
  L_R_LINE-TYP = C_HEADER.               " header
  L_TITLE = 'Test report'(001).
  L_R_LINE-INFO = L_TITLE.
  APPEND L_R_LINE TO I_ALV_TOP_OF_PAGE.
  CLEAR L_R_LINE.
* RUN DATE DISPLAY
  CLEAR L_DATE.
  L_R_LINE-TYP  = C_ITEM.                " Item
  WRITE: SY-DATUM  TO L_DATE MM/DD/YYYY.
  L_R_LINE-KEY = 'Run Date :'(002).
  L_R_LINE-INFO = L_DATE.
  APPEND L_R_LINE TO I_ALV_TOP_OF_PAGE.
  CLEAR: L_R_LINE, L_DATE.
ENDFORM.                    " sub_build_header
*&      Form  sub_field_catalog
      Build Field Catalog
      No Parameter
FORM SUB_FIELD_CATALOG .
  *  BUILD FIELD CATALOG
  PERFORM SUB_FILL_ALV_FIELD_CATALOG USING:
            '01' '01' 'EBELN'  'I_EKPO' 'L'  'Doc No'(003) ' ' ' ' ' ' ' ',
            '01' '02' 'EBELP'  'I_EKPO' 'L'  'Item No'(004) 'X' 'X' ' ' ' ',
            '01' '03' 'MATNR'  'I_EKPO' 'L'  'Material No'(005) 'X' ' ' ' ' ' ',
            '01' '03' 'MATNR1' 'I_EKPO' 'L'  'Material No'(005) ' ' ' ' ' ' ' ',
            '01' '04' 'WERKS'  'I_EKPO' 'L'  'Plant'(006) 'X' ' ' ' ' ' ',
            '01' '04' 'WERKS1' 'I_EKPO' 'L'  'Plant'(006) ' ' ' ' ' ' ' ',
            '01' '05' 'NTGEW'  'I_EKPO' 'R'  'Net Weight'(007) ' ' ' ' 'GEWE' 'I_EKPO'.
ENDFORM.                    " sub_field_catalog*
*&     Form  sub_fill_alv_field_catalog
*&     For building Field Catalog
*&     p_rowpos   Row position
*&     p_colpos   Col position
*&     p_fldnam   Fldname
*&     p_tabnam   Tabname
*&     p_justif   Justification
*&     p_seltext  Seltext
*&     p_out      no out
*&     p_tech     Technical field
*&     p_qfield   Quantity field
*&     p_qtab     Quantity table
FORM SUB_FILL_ALV_FIELD_CATALOG  USING  P_ROWPOS    TYPE SYCUROW
                                        P_COLPOS    TYPE SYCUCOL
                                        P_FLDNAM    TYPE FIELDNAME
                                        P_TABNAM    TYPE TABNAME
                                        P_JUSTIF    TYPE CHAR1
                                        P_SELTEXT   TYPE DD03P-SCRTEXT_L
                                        P_OUT       TYPE CHAR1
                                        P_TECH      TYPE CHAR1
                                        P_QFIELD    TYPE SLIS_FIELDNAME
                                        P_QTAB      TYPE SLIS_TABNAME.
  * LOCAL DECLARATION FOR FIELD CATALOG
  DATA: WA_LFL_FCAT    TYPE  SLIS_FIELDCAT_ALV.
  WA_LFL_FCAT-ROW_POS        =  P_ROWPOS.     "Row
  WA_LFL_FCAT-COL_POS        =  P_COLPOS.     "Column
  WA_LFL_FCAT-FIELDNAME      =  P_FLDNAM.     "Field Name
  WA_LFL_FCAT-TABNAME        =  P_TABNAM.     "Internal Table Name
  WA_LFL_FCAT-JUST           =  P_JUSTIF.     "Screen Justified
  WA_LFL_FCAT-SELTEXT_L      =  P_SELTEXT.    "Field Text
  WA_LFL_FCAT-NO_OUT         =  P_OUT.        "No output
WA_LFL_FCAT-TECH           =  P_TECH.       "Technical field
WA_LFL_FCAT-QFIELDNAME     =  P_QFIELD.     "Quantity unit
WA_LFL_FCAT-QTABNAME       =  P_QTAB .      "Quantity table
  IF P_FLDNAM = 'NTGEW'.
    WA_LFL_FCAT-DO_SUM  = 'X'.
  ENDIF.
  APPEND WA_LFL_FCAT TO I_FIELDCAT.
  CLEAR WA_LFL_FCAT.
ENDFORM.                    " sub_fill_alv_field_catalog
*&      Form  sub_populate_layout
      Populate ALV layout
      No Parameter
FORM SUB_POPULATE_LAYOUT .
  CLEAR WA_LAYOUT.
  WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'." Optimization of Col width
ENDFORM.                    "SUB_POPULATE_LAYOUT
" sub_populate_layout
*&      Form  sub_populate_sort
      Populate ALV sort table
      No Parameter
FORM SUB_POPULATE_SORT .
  * SORT ON MATERIAL
  WA_SORT-SPOS = '01' .
  WA_SORT-FIELDNAME = 'MATNR'.
WA_SORT-TABNAME = 'I_EKPO'.
  WA_SORT-UP = 'X'.
  WA_SORT-SUBTOT = 'X'.
  APPEND WA_SORT TO I_SORT .
CLEAR WA_SORT."* SORT ON PLANT
WA_SORT-SPOS = '02'.
WA_SORT-FIELDNAME = 'WERKS'.
WA_SORT-TABNAME = 'I_EKPO'.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO I_SORT .
CLEAR WA_SORT.
ENDFORM.                    " sub_populate_sort
*&      Form  sub_get_event
      Get ALV grid event and pass the form name to subtotal_text
      event
      No Parameter
FORM SUB_GET_EVENT .
  CONSTANTS : C_FORMNAME_SUBTOTAL_TEXT TYPE SLIS_FORMNAME VALUE 'SUBTOTAL_TEXT'.
  DATA: L_S_EVENT TYPE SLIS_ALV_EVENT.
  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
      I_LIST_TYPE     = 4
    IMPORTING
      ET_EVENTS       = I_EVENT
    EXCEPTIONS
      LIST_TYPE_WRONG = 0
      OTHERS          = 0.
  * SUBTOTAL
  READ TABLE I_EVENT  INTO L_S_EVENT WITH KEY NAME = SLIS_EV_SUBTOTAL_TEXT.
  IF SY-SUBRC = 0.
    MOVE C_FORMNAME_SUBTOTAL_TEXT TO L_S_EVENT-FORM.
    MODIFY I_EVENT FROM L_S_EVENT INDEX SY-TABIX.
  ENDIF.
ENDFORM.                    "SUB_GET_EVENT
" sub_get_event
*&      Form  sub_alv_report_display
      For ALV Report Display
      No Parameter
FORM SUB_ALV_REPORT_DISPLAY .
  DATA: L_REPID TYPE SYREPID .
  L_REPID = SY-REPID .
* THIS FUNCTION MODULE FOR DISPLAYING THE ALV REPORT
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM     = L_REPID
     I_CALLBACK_TOP_OF_PAGE = 'SUB_ALV_TOP_OF_PAGE'
     IS_LAYOUT              = WA_LAYOUT
      IT_FIELDCAT            = I_FIELDCAT
      IT_SORT                = I_SORT
      IT_EVENTS              = I_EVENT
     I_DEFAULT              = 'X'
     I_SAVE                 = 'A'
    TABLES
      T_OUTTAB               = I_EKPO
    EXCEPTIONS
      PROGRAM_ERROR          = 1
      OTHERS                 = 2.
  IF SY-SUBRC <> 0.
   MESSAGE i000 WITH 'Error in ALV report display'(055).
  ENDIF.
ENDFORM.                    " sub_alv_report_display
      FORM sub_alv_top_of_page
      Call ALV top of page
      No parameter
FORM SUB_ALV_TOP_OF_PAGE.                                   "#EC CALLED
To write header for the ALV
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
   EXPORTING
     IT_LIST_COMMENTARY = I_ALV_TOP_OF_PAGE.
ENDFORM.                    "alv_top_of_page
*&      Form  subtotal_text
      Build subtotal text
      P_total  Total
      p_subtot_text Subtotal text info
FORM SUBTOTAL_TEXT CHANGING
               P_TOTAL TYPE ANY
               P_SUBTOT_TEXT TYPE SLIS_SUBTOT_TEXT.
Material level sub total
  IF P_SUBTOT_TEXT-CRITERIA = 'MATNR'.
    P_SUBTOT_TEXT-DISPLAY_TEXT_FOR_SUBTOTAL  = 'Materia  l'(009).
    BREAK-POINT.
here calucate the total and change the p_total    
  ENDIF.
  * PLANT LEVEL SUB TOTAL
  IF P_SUBTOT_TEXT-CRITERIA = 'WERKS'.
    P_SUBTOT_TEXT-DISPLAY_TEXT_FOR_SUBTOTAL = 'Plant level total'(010).
  ENDIF.
ENDFORM.                    "subtotal_text

Similar Messages

  • LOV depending on value of field in report

    I have a report on a query. In one of the fields I want to have a Radio Group, Based on query based LOV. The values in the LOV depends on the value in the field in the report. Is this possible, and how do I define the LOV for it?
    Would it be something like:
    select disp_val d, id r
    from my_table
    where field_x = [value_of_this_field_in_my_report]
    order by 1What do I fill in for [value_of_this_field_in_my_report]?

    Please refer to Metalink note 825603.1.

  • Error while inserting value Qualified field in the main table

    Hello,
    I am trying to populate Qualified field in the main table when a new record is inserted in the Products Repository.
    The field is Reference Price and its a qualified lookup field. I am using the below code to create qualified lookup value and create qualified link values.
    QualifiedLookupValue qlvRefPrice = new QualifiedLookupValue();
    TableId qltabid = repSchema.getTableId("ReferencePrices");
    FieldId qlfieldid = repSchema.getFieldId("ReferencePrices","RP_ReferncePrices");
    RecordId rdRefPrice = getRecordId(connPool,session,"RP",qlfieldid,qltabid);
    HashMap map = new HashMap();
    map.put(repSchema.getFieldId("ReferencePrices","StartDate_ReferencePrice"),new DateTimeValue(cal));
    map.put(repSchema.getFieldId("ReferencePrices","EndDate_ReferencePrice"),new DateTimeValue(cal));
    map.put(repSchema.getFieldId("ReferencePrices","ListPrice"),new FloatValue(Float.parseFloat("123.3")));
    map.put(repSchema.getFieldId("ReferencePrices","Currency"),new LookupValue(getLookupRecordId(connPool,session,"Currencies","Currency_Currencies","EUR")));
    QualifiedLinkValue qlvLinkValue = MdmValueFactory.createQualifiedLinkValue(rdRefPrice,map);
    qlvRefPrice.addValue(qlvLinkValue);
    emptyRecord.setFieldValue(fieldIdRefPriceHistory,qlvRefPrice);
    However when the createrecord command is executed I get the following error.
    java.lang.RuntimeException: No matching validation Id 97. at com.sap.mdm.internal.validation.ValidationInfoHelper.retrieveValidations(ValidationInfoHelper.java:71) at com.sap.mdm.data.commands.CreateRecordCommand.execute(CreateRecordCommand.java:246) at com.alcatel_lucent.productdetail.ProductItemDetail_Comp.createProduct(ProductItemDetail_Comp.java:2927) at com.alcatel_lucent.productdetail.wdp.InternalProductItemDetail_Comp.createProduct(InternalProductItemDetail_Comp.java:656) at com.alcatel_lucent.productdetail.ProductItemAddView.onActionSave(ProductItemAddView.java:971) at com.alcatel_lucent.productdetail.wdp.InternalProductItemAddView.wdInvokeEventHandler(InternalProductItemAddView.java:662) at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87) at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67) at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doHandleActionEvent(WindowPhaseModel.java:420) at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:132) at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335) at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143) at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:332) at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingPortal(ClientSession.java:761) at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:696) at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:253) at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149) at com.sap.tc.webdynpro.clientserver.session.core.ApplicationHandle.doProcessing(ApplicationHandle.java:73) at com.sap.tc.webdynpro.portal.pb.impl.AbstractApplicationProxy.sendDataAndProcessActionInternal(AbstractApplicationProxy.java:869) at com.sap.tc.webdynpro.portal.pb.impl.localwd.LocalApplicationProxy.sendDataAndProcessAction(LocalApplicationProxy.java:77) at com.sap.portal.pb.PageBuilder.updateApplications(PageBuilder.java:1356) at com.sap.portal.pb.PageBuilder.SendDataAndProcessAction(PageBuilder.java:327) at com.sap.portal.pb.PageBuilder$1.doPhase(PageBuilder.java:869) at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processPhaseListener(WindowPhaseModel.java:755) at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doPortalDispatch(WindowPhaseModel.java:717) at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:136) at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335) at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143) at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:332) at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:741) at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:694) at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:253) at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149) at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62) at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401) at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266) at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386) at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364) at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039) at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265) at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95) at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(AccessController.java:219) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)      
    I spoke to my MDM team and they say there is no validation which they have put for Reference Price field. I have tried inserting values in another field of type qualified lookup in the same main table and that works without any issue.
    The code is as below:
    QualifiedLookupValue qlvRating = new QualifiedLookupValue();
    TableId qlvtable = repSchema.getTableId("ProductRatings");
    FieldId qlvratinglink = repSchema.getFieldId("ProductRatings","RatingLink");                    
    RecordId rdidPR = getRecordId(connPool,session,"CI",qlvratinglink,qlvtable);
    wdComponentAPI.getMessageManager().reportSuccess("rdidPR "+rdidPR);
    HashMap mapPR = new HashMap();
    mapPR.put(repSchema.getFieldId("ProductRatings","AvailRating"),new LookupValue(getLookupRecordId(connPool,session,"AvailabilityRatings","AvailabilityRating_AvailabilityRatings","CI")));
    mapPR.put(repSchema.getFieldId("ProductRatings","EffectiveDate"),new DateTimeValue(cal));
    mapPR.put(repSchema.getFieldId("ProductRatings","FERAIndic"),new LookupValue(getLookupRecordId(connPool,session,"ReplacementIndicators","Code","FE")));
    mapPR.put(repSchema.getFieldId("ProductRatings","FERAOrdItem"),new LookupValue(getLookupRecordId(connPool,session,"ReplProducts","ProdID","100008200")));
    QualifiedLinkValue qlvLink = MdmValueFactory.createQualifiedLinkValue(rdidPR,mapPR);
    qlvRating.addValue(qlvLink);
    emptyRecord.setFieldValue(fieldIdRatingHistory,qlvRating);     
    I would really appreciate if someone can help in solving the issue.
    Thanks in advance,
    Aamod

    Hi Aamod,
    Sees that some validation/assignments are getting triggered as soon as you make changes to the record in MDM. Please check once after removing validations/workflow that you may have. This way you may debug the issue.
    Hope this helps!!
    Cheers,
    Arafat

  • Is it possible to add value date field in the debit entry?

    Hi gurus,
    I'm an abapper and struggling to be an FI consultant since I have no one to consult with. Here's my issue:
    I want to add the Value Date field in a GL acct debit entry. I used optional in Field status group. It doesn't appear unless if I change the posting key to credit. But if I change it to required entry, an error appears " Rules for posting key 40 and acct 115-30-002 set incorrectly for "VALUT" field . Did I miss anything? As much as possible, I don't want to use the other GL Account (a credit entry) since I dont need it in the program flow.
    Need an expert explanation on this. Sorry I only have limited knowlege with regards to FI concepts.

    Hi
    Feild status at entry time looks for the following combination
    S- Supressed
    D- Display
    R- Required
    O- Optional
    System looks for this above combination at first in Posting Key and then in FSV of account which we enter. For this partical purpose the the feilds in posting key are kept optional.
    Check the feild status of posting key & account T-code FBKP.
    thanks
    Colin Thomas

  • Authority to change entries through SM30 depending on values of fields?

    Hi.
    Is it somehow possible to set authorizations in a way, that a user could change only certain entries in a customizing table using SM30? What I want to achieve with this - we have an internationally used system, where consultants from different countries are working often on the same customizing tables and we would like to restrict tham to be able to change records only relevant for those countries, so they cannot change the records for other countries by mistake / on purpose. The records are usually identified by a certain "grouping" field (for instance MOLGA in table T511K or MOABW in T554S).
    So far I couldn't find anything apart from the S_TABU_DIS object, which is too rough for this requirement.
    Or maybe is there another way to achieve security in such a scenario?
    Thanks in advance for any ideas.

    Hi Dusan,
    You can restrict access to tables by business organizational units using the
    Line-oriented authorizations introduced in Release 4.6C. You could previously
    only use the authorization objects S_TABU_DIS and S_TABU_CLI to allow or
    prevent access to complete tables.
    The introduction of organizational criteria allows you to restrict user access
    to parts of a table. The authorization object <b>S_TABU_LIN</b> has been
    introduced for this purpose.
    One possible use for line-oriented authorizations would be that a user can
    only display and change the contents of a particular work area, e.g. a
    country or plant, in a table.
    See the IMG documentation under Basis ---> System administration ---> Users and authorizations ---> Line-oriented authorizations.
    <u>Following are the fields present:</u>
    Activity
    Organization criterion for key
    Org. crit. attribute 1
    Org. crit. attribute 2
    Org. crit. attribute 3
    Org. crit. attribute 4
    Org. crit. attribute 5
    Org. crit. attribute 6
    Org. crit. attribute 7
    Org. crit. attribute 8
    Hope it helps.
    Please award points if it is useful.
    Thanks & Regards,
    Santosh

  • Initial, empty #-value in fields in the new abap debugger

    Hi,
    after using the logical database with the get statement, I have a value in a field which is shown in the new debugger for the field ldb_structure-bukrs like this: '####'.
    If I use the if-clause like:
    IF ldb_structure-bukrs IS INITIAL.
    <do-something>
    ENDIF.
    <do_something-else>
    The <do-something>-part is left out in this case, because there are #-values in the empty field.
    Where does this behavior come from? Just because there was a select and the field could not be filled? Why isn't it just empty?
    Kind greetings,
    Mario
    Message was edited by: Mario Schmidt

    Perhaps it would be
    IF ldb_structure-BUKRS IS INITIAL.
    <do-something>
    ENDIF.
    <do_something-else>
    Normally it is visualization subject, if you click in structure, in debugging you would be able to see the value of the fields of structure.
    Regards

  • Sum a particular filed based on other field in the Internal table?

    Hi Guys,
                I am having an Internal table with G/L account number and Amount in Local Currency .so in this we will have some g/l account number's repeated with different amount.I need to add all the Amounts in the amount column  with same G/L account number and make it into a single entry.so how to do this ?
    Thanks,
    Gopi.

    Hi Gopi,
    declare another wa1 same as wa.
    declare final_tab same as itab.
    clear wa1.
    sort itab by accno.
    loop at itab into wa.
    if wa-accno = wa1-accno.
    wa-amt = wa-amt + wa1-amt.
    modify final_tab from wa transporting amt.
    else.
    append wa to final_tab.
    endif.
    wa1 = wa
    endloop.
    Reward if it helps,
    Satish

  • Mandatory fields on the same page with dependent LOVs

    Hi,
    I am working on an ADF-BC application using JDeveloper 10.1.3.4
    I have an ADF Creation form with dependent LOVs and while implementing dependent LOVs we set the autoSubmit property of the selectOneChoiceListBox as true.
    If I have some mandatory fields on the same page then because of the autoSubmit property set as true whenever I select a value in the list the page gets submitted and the mandatory fields give an error that the values are required therefore I had to remove the mandatory fields.
    I tried using f:subview but even that dint serve the purpose because what I want is something like partialSubmit so that my mandatory fields do no give an error when I select a value in the list.
    Can somebody help me on this, how to have a dependent list and mandatory fields on the same page.
    P.S: It is very crucial for my application
    Thanks,
    Raksha

    Hello,
    This bug has been around since 10.1.3, its even still present in Trinidad and now in 11.
    One of the ways to avoid is to make your fields use:
    showRequired="true"instead of
    required="true"I have not found a decent way to avoid this in general.
    My idea was that this shiould be possible with a phaselistener and determine if this is a partial page event instead of a normal submit, but this didnt work.
    -Anton

  • Javax.ejb.EJBException: Attempt to access a collection valued cmr-field

    I have 2 local CMP project and defect
    i have a method getDefectList in ProjectBean. This method returns a collection of defect object.The relationship of Defect and Project is defined in ejb-jar where project can contain many defects.
    when i try to access this method in a session bean it gives me the error
    "javax.ejb.EJBException: Attempt to access a collection valued cmr-field outside the scope of a transaction."
    Please let me know the solution.

    After further research, it looks like CMR fields can only use three options for the trans-attribute: Mandatory, Required, or RequiresNew
    <container-transaction>
    <description>Transaction attributes</description>
    <method>
    <ejb-name>strong.customer</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Mandatory</trans-attribute>
    </container-transaction>
    thus I believe that you will have to begin a transaction before executing your method.

  • To allow me put a value into field without coming out the tcode.

    Hi Friends,
    My requirement is when a value is entered into a field leaving the other field empty should display a error  message
    I'm making use of the below statement to display the error message
    message S000(01) display like 'E' raising error_with_message.
    But the thing is ,when trying to save it after entering value into a field leaving the other empty, its displaying the error message which i have maintianed.till here its well and good.But from here I can only come out of the tcode without allowing me to enter the value into the other field.
    want a message to be displayed on the status bar and allow me to put the value into the remaining field
    without coming out from the screen..
    Please help..

    Hi laxman,
    Are you saying like this..
    message S000(01) dispaly like 's' raising error_with_message.
          set screen 100.
          leave screen.
    The Req is "If I enter a value in field leaving the other field empty in tcode XXXX..its should display a message that this particular field is mandatory and allow me to put the value into the other field "
    I'm able to display a message when the second field is left empty..
    In the message dialog (where the message gets displayed), exit option is there.so i'm coming out of the tcode.But it should give me message and allow me to put the value in the screen without coming out of it.

  • Summing Selected Rows in Column Depending on Value in Another Column

    I'd like to sum only the values in selected rows in a given column depending on the value of another column in the same row. For example, suppose I have a table (please disregard the underscores, needed for correct alignment):
    ___A____B____C___D
    1__5___10___15___0
    2_20___25___30___1
    3_35___40___45___1
    4_50___55___60___0
    5__sum(D=1)
    In cell B5, I'd like to compute the sum of only rows in column B for which the value of the corresponding column D is 1. In this case B5 would be 65.
    How can I do this using functions? Is it possible to do it for a variable range of rows without specifying each row individually?
    Thanks,
    Dave

    You should place your formula to other collumn then calculated ones or in another table. You will be able to calculate whole collumns with: =SUMIF(D;“=1”;B)
    Formula for your example is: =SUMIF(D1:D4;“=1”;B1:B4)
    VB

  • ALV: How do I suppress repeating values and page breaks on printed output?

    Good day, everyone!
    First, I've done a LOT of searching trying to find the answer to my question, but I'm not finding an answer.  If this has already been answered and you can point me to a URL, I would appreciate it.
    Here's my issue:  I have a rather simple ALV report.  It has the columns of Person ID, Personnel Number, For Period, In Period, and Amount.  I sort by Person ID and Personnel Number, and if the value repeats on the next line of the report, I want to suppress it (make it blank).
    I thought the answer was in the following code, where I set the GROUP attribute to asterisk:
      CLEAR sortcat_ln.
      sortcat_ln-spos      = '1'.
      sortcat_ln-fieldname = 'PERSONID_EXT'.
      sortcat_ln-up        = c_true.
      sortcat_ln-group     = '*'.
      APPEND sortcat_ln TO sortcat.
      CLEAR sortcat_ln.
      sortcat_ln-spos      = '2'.
      sortcat_ln-fieldname = 'PERNR'.
      sortcat_ln-up        = c_true.
      sortcat_ln-group     = '*'.
      APPEND sortcat_ln TO sortcat.
    It looks PERFECT on the screen -- the values are suppressed if they repeat, and everything appears together on one screen.  However, when I print the report, two things happen:  1) The values repeat on each row, even if they are the same, and 2) I get a page break after each Person ID / Personnel Number combination.
    I now realize that I can't use the GROUP attribute.  Is there some other way in ALV to blank these repeating values and keep all the rows together on one page, rather than page breaking after each value change?
    Thanks!
    Dave

    Hi
    Same requirement i had before, when i try to print preview. the output of the grid display is in grouping is ok, but when i print preview or print it doesnt cater the grouping and page breaks, so what i did i modify the internal table use in alv , after hitting the print preview/print with the format desired by the user. you can do that in user-command. see code below
    FORM user_command USING r_ucomm TYPE syucomm
                            rs_selfield TYPE slis_selfield.
      DATA lt_sort TYPE lvc_t_sort.
      CASE r_ucomm.
        WHEN '&RNT_PREV' OR '&RNT'.
          t_final_x[] = t_final[].
          PERFORM clear_redundant.
          PERFORM set_sort_criteria USING lt_sort.
        WHEN '&F03' OR '&PRINT_BACK_PREVIEW'.
          t_final[] = t_final_x[].
        WHEN OTHERS.
      ENDCASE.
    ENDFORM.                    "user_command
    hope it helps

  • ALV Sum N columns how to?

    Hi all,
    I'm doing a report on ABAP for a timesheet of the current month. The output i want is similar to this:
    Year      Month     Type         Item       #days  tue-1      wed-2    thu-3 ...
    2009     September  Project    Project1      3        1        1          1
    2009     September  Project    Projec2       5        1        1          0
    2009     September  Task       Task1         1        0        1          0
    The field #days is a sum of all the days columns for september next right to the #days column.
    I can have an SQL wich can extract all the data to fill year,month,type,item and #days. But then, i need to flat these #days in the correct days column. I think i can do it with 2 sqls, but then i need to join these data to display it right.
    Finally, present that data in an ALV.
    I have a structure defined in ABAP dictionary with all the static fields. The columns representing the days (sat-1,sun-2,...) are not in the structure.
    I've tried to define a new structure wich include the old one and define the remaining columns, but i can't show the fields defined in this extra structure, only the static fields defined in ABAP dictionary.
    This is probably simple, but i'm just starting in ABAP, and this seems odd and confusing right now.
    What's your advice to solve this problem?

    Hi vasanth,
    I'm trying to define my ALV from 2 structures.
    The YTS_REPORT_PROJ has year,month,type_item,item and #days
    The YTS_WEEK_DESC is a static structure with an interval of weekdays such as : saturday1,sunday1,monday1,...,saturday2,sunday2,... until i get the 31 days possibles to show for a month.
    I'm declaring this way:
      DATA: BEGIN OF IT_ALV_YTMSHT.
              INCLUDE STRUCTURE YTS_REPORT_PROJ.
              INCLUDE STRUCTURE YTS_WEEK_DESC.
      DATA: END OF IT_ALV_YTMSHT.
    For field catalogs i call this subrutine:
    *      Form  get_LayoutTable - Set Up Columns/Headers
    FORM GET_LAYOUTTABLE.
      DATA: LS_FCAT TYPE LVC_S_FCAT.
      REFRESH: FIELDCAT.  CLEAR: LS_FCAT.
      LS_FCAT-REPTEXT    = 'Year'.
      LS_FCAT-FIELDNAME  = 'YEAR_ITEM'.
      LS_FCAT-REF_TABLE  = 'IT_YTMSHEET'.
      LS_FCAT-OUTPUTLEN  = '4'.
      LS_FCAT-FIX_COLUMN = 'X'.
      LS_FCAT-COL_POS    = '1'.
      APPEND LS_FCAT TO FIELDCAT.  CLEAR: LS_FCAT.
      LS_FCAT-REPTEXT    = 'Month'.
      LS_FCAT-FIELDNAME  = 'MONTH_ITEM'.
      LS_FCAT-REF_TABLE  = 'IT_YTMSHEET'.
      LS_FCAT-OUTPUTLEN  = '6'.
      LS_FCAT-FIX_COLUMN = 'X'.
      LS_FCAT-COL_POS    = '2'.
      APPEND LS_FCAT TO FIELDCAT.  CLEAR: LS_FCAT.
      LS_FCAT-REPTEXT    = 'Type_of_item'.
      LS_FCAT-COLTEXT    = 'Type of item'.
      LS_FCAT-FIELDNAME  = 'TYPE_ITEM'.
      LS_FCAT-REF_TABLE  = 'IT_YTMSHEET'.
      LS_FCAT-FIX_COLUMN = 'X'.
      LS_FCAT-OUTPUTLEN  = '12'.
      LS_FCAT-COL_POS    = '4'.
      APPEND LS_FCAT TO FIELDCAT.  CLEAR: LS_FCAT.
      LS_FCAT-REPTEXT    = 'Item'.
      LS_FCAT-FIELDNAME  = 'ITEM'.
      LS_FCAT-REF_TABLE  = 'IT_YTMSHEET'.
      LS_FCAT-FIX_COLUMN = 'X'.
      LS_FCAT-OUTPUTLEN  = '20'.
      LS_FCAT-COL_POS    = '5'.
      APPEND LS_FCAT TO FIELDCAT.
      CLEAR: LS_FCAT.
      LS_FCAT-REPTEXT    = 'Number_of_days'.
      LS_FCAT-COLTEXT    = 'Days number'.
      LS_FCAT-FIELDNAME  = 'DAYS_ITEM'.
      LS_FCAT-REF_TABLE  = 'IT_YTMSHEET'.
    *  LS_FCAT-FIX_COLUMN = 'X'.
      LS_FCAT-OUTPUTLEN  = '11'.
      LS_FCAT-TOOLTIP    = '#Days=Hours/8'.
      LS_FCAT-COL_POS    = '6'.
      APPEND LS_FCAT TO FIELDCAT.
    DO 30 TIMES.
        CLEAR: LS_FCAT.
        LS_FCAT-REPTEXT    = 'day of week'.
        LS_FCAT-COLTEXT    = 'Day of week'.
        LS_FCAT-FIELDNAME    = ' '.             ----------> HOW CAN I REFERENCE HERE "SUNDAY1,SATURDAY1,..."?
        LS_FCAT-REF_TABLE  = 'IT_ALV_YTMSHT'.
    *  LS_FCAT-FIX_COLUMN = 'X'.
        LS_FCAT-OUTPUTLEN  = '11'.
        APPEND LS_FCAT TO FIELDCAT.
    As you can see, at the end of the routine i try to create 30 more columns, and those columns actually appear, but i don't know how to fill the data of those columns.
    To construct the ALV i'm using
    DATA: VARIAVEL LIKE IT_ALV_YTMSHT OCCURS 0 WITH HEADER LINE.
    *IT_YTMSHEET[] has the first part that i want to show (year,month,type,item and #days.
      VARIAVEL[] = IT_YTMSHEET[].
      CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IS_LAYOUT = GD_LAYOUT
          I_SAVE = 'A'
        CHANGING
          IT_FIELDCATALOG  = FIELDCAT[]
          IT_OUTTAB        = VARIAVEL[].

  • ALV SUM problem

    Hi All,
    I am using ALV grid to display report output and to sum column values i am using the DO_SUM = 'X'
    but the sum is mot populating please give any suggestions.
    Regards,
    Phani.

    Hi,
    Check My [Sample Code Here |Re: Automatic Sum At the Bottom Or At the Top of an ALV Grid]. Hope will solve out your problem,
    Best Regards,
    Faisal

  • How to loop with varying values depending on where you are in the loop

    Hi,
    I have need of loops / nested loops that pick different figures depending on where you are in the loop.
    The whole function needs to run through 'ml' times. 'ml' is a dynamic figure.
    Loop 1 = While the loop is within the first 12 iterations, 'exconemp' must equal 100. For iterations 13 - 24, 'exconemp' must equal 102.5, for 25 - 36 it will be 105.06, for 37 - 48 it will be 107.69. This needs to change every 12th iteration until it has reached 'ml'. The calculation takes the value of the previous 'exconemp' and then multiplies that by 0.025.
    Loop 2 = While the loop is within the first 120 iterations, 'abc' must equal 0.015 and any further iterations must use 0.01. This must also work in a way to figure out whether 'ml' is higher or lower than 120 and work accordingly.
    My main issue is this - how do I get the loops to run through as this:
    While the iteration is < 12, do this, THEN take the final figure (12th iteration) and start on 13 - 24, do this THEN etc etc.
    How do I produce a THEN statement? I can get the code to pick up the final values, but not change along the way.
    I think that I may be better creating an array for Loop 1, but I am not entirely convinced of this. I also think it would be better/tidier if I can get 'month 1 total' and 'month 2 total' into the loops, but am not sure on how to do this.
    The values that I need to produce are (only first 36 shown):
    1 - 12 = 125.55, 251.65, 378.31, 505.52, 633.29, 761.63, 890.53, 1019.99, 1150.03, 1280.63, 1411.81, 1543.57
    13 - 24 = 1679.05, 1815.12, 1951.79, 2089.06, 2226.93, 2365.41, 2504.50, 2644.20, 2784.52, 2925.45, 3067.00, 3209.18
    25 - 36 = 3355.19, 3501.85, 3649.15, 3797.11, 3945.71, 4094.96, 4244.87, 4395.44, 4546.68, 4698.57, 4851.14, 5004.38
    var ml = 240 // dynamic figure, multiple of 12 up to 780
    var exconemp;
    var exconem = 100;
    var inf = 0.025;
    var tree;
    var tec;
    var power;
    var fvis;
    var abc;
    var fvee;
    var tfv;
    function myfunction() {
    //Loop 1
    //while (ml <= 12) {
      exconemp = exconem;
    //while (ml > 12) {
    // exconemp = exconem*inf;
    //end Loop 1
      trace("exconemp=", exconemp); // employees contribution
    tree = exconemp/(1-0.2)-exconemp;
    tec = exconemp + tree;
      trace("tree", tree);
      trace("tec", tec);
    power = Math.pow(1+0.07, 1/12);
    //Loop 2
    //while (ml <= 120) {
      abc = 0.015;
    //while {
      //abc = 0.01;
    //end Loop 2
    fvis = power*(1-abc/12);
    trace("fvis=", fvis);
    fvee = tec*fvis;
    trace("fvee=", fvee); // month 1 total
    tfv = (tec+fvee)*fvis;
    trace("tfv=", tfv); // month 2 total
    for (var i:Number = 0; i < ml; i++)
          tfv = (tec+tfv)*fvis;
      trace("tfvloop=", tfv);
    I hope that I have explained this well enough.
    Many thanks in advance.

    I think this will do it although I am not quite getting the numbers you posted.
    stop();
    var ml = 48; // dynamic figure, multiple of 12 up to 780
    var exconemp;
    var exconem = 100;
    var inf = 0.025;
    var tree;
    var tec;
    var power;
    var fvis;
    var abc = 0.15;
    var fvee;
    var tfv;
    myfunction();
    function myfunction()
        exconemp = exconem;
            for(var index:uint = 1; index <= ml; index++)
                trace(index + "--------------------------------");
                    tree = exconemp/(1-0.2)-exconemp;
                    tec = exconemp + tree;
                    power = Math.pow(1+0.07, 1/12);
                    fvis = power*(1-abc/12);
                    fvee = tec*fvis;
                        if(index == 1)
                            trace("month 1 total=", fvee);
                        else if(index == 2)
                            tfv = (tec+fvee)*fvis;
                            trace("month 2 total=", tfv); // month 2 total
                        else
                            tfv = (tec+tfv)*fvis; //now that we are here the tfv self perpetuates on itself
                            trace("month " + index + " total=", tfv); // month n total
                if(index % 12 == 0)
                    exconemp = exconemp*(1+inf);
                    trace("changed exconemp to: " + exconemp);
                if(index % 120 == 0)
                    abc = .01;
                    trace("changed abc to: " + abc);

Maybe you are looking for