Adding Amount field in BSEG table and display it single line item?

hi experts,
       I am doing credit / debit form now my requirement is
                                           According to BELNR , GJAHR,BUKRS i want to find credit amount for this selection cretiria.
                     so i want to add all the lines of amount filed for a particular BELNR and display it as single line.
so i am getting data from print program like this
SELECTION-SCREEN BEGIN OF BLOCK b0 WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP 2.
PARAMETERS: p_belnr LIKE bkpf-belnr OBLIGATORY,
            p_bukrs LIKE bkpf-bukrs OBLIGATORY,
            p_gjahr LIKE bkpf-gjahr OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b0.
SELECT SINGLE *
               FROM bkpf
               INTO  i_bkpf
               WHERE belnr = p_belnr
                     AND ( blart = 'DG' OR blart = 'ZG' )
                     AND bukrs = p_bukrs
                     AND gjahr = p_gjahr.
IF sy-subrc = 0.
    SELECT  *
          FROM bseg
          INTO  table it_bseg
          WHERE belnr = i_bkpf-belnr .
  ENDIF.
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname                 = 'Z_CREDIT_DEBIT'    " p_name
  VARIANT                  = ' '
  DIRECT_CALL              = ' '
    IMPORTING
      fm_name                  = v_form_name
EXCEPTIONS
  NO_FORM                  = 1
  NO_FUNCTION_MODULE       = 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 v_form_name
EXPORTING
  ARCHIVE_INDEX              =
  ARCHIVE_INDEX_TAB          =
  ARCHIVE_PARAMETERS         =
  CONTROL_PARAMETERS         =
  MAIL_APPL_OBJ              =
  MAIL_RECIPIENT             =
  MAIL_SENDER                =
  OUTPUT_OPTIONS             =
  USER_SETTINGS              = 'X'
IMPORTING
  DOCUMENT_OUTPUT_INFO       =
  JOB_OUTPUT_INFO            =
  JOB_OUTPUT_OPTIONS         =
  TABLES
    i_bkpf                     = i_bkpf
    i_bseg                     = i_bseg
EXCEPTIONS
  FORMATTING_ERROR           = 1
  INTERNAL_ERROR             = 2
  SEND_ERROR                 = 3
  USER_CANCELED              = 4
  OTHERS                     = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
so my I_BSEG containing all line items of particular BELNR . with the field SHKZG  iam  getting only credit line items .
  now i want to do is add all credited amount and display like this in a table.
against ref#  (BSEG-REBZG) ! details (BSEG-SGTXT)!  amount
124569                                   10%discount                950.00(total amount ie sum of all lines amount for a BELNR)
                                                                                10.00(total tax amt ie sum of   all lines of tax amount for a BELNR)                                                                               
                                                                                960.00

hi arun,
         i used collect in smartform my procedure is like this .
               i am getting data into i_BSEG because i declared like this in TABLES parameter
                  i created a loop .
                         in that i mentioned like I_BSEG into WA_BSEG.
                               then i created a program lines here i mentioned like this.
                                              COLLECT WA_BSEG INTO IT_BSEG.
           but because of BUZEI "Number of Line Item Within Accounting Document .it is not same it is varying for every credited time that means for every line of BELNR. thats why it is not adding it is just appending .
so pls tell me any other chance to find sum .
because i want to sum up all credted amount and display it in single line
ie first column REBZG "Number of the Invoice the Transaction Belongs to(against ref) i want to display once .
And Second column  SGTXT "item text(details) for amount once and for tax amount once
And Third column Amount first line consists total amount & second line consists total for tax amount
regards,
satheesh.
[email protected]
any doubts chat me regarding this post.

Similar Messages

  • Refreshing the value of a field in a table and displaying it on the screen.

    how do i mimimize calls to the database in the following scenario?
    I need to show the latest value of a field in a table in a database through a java program. in a concurrent access environment, there are chances of multiple users getting stale values. how do I overcome this problem through code?
    please advise.

    There are many ways of doing this. However its worth noting that RDBMS database are not messaging, event driven systems and are not best suited to do what you want to do. You should only consider doing this if you have a low rate of changes.
    You can
    - Poll the database table and look for changes.
    - Add a trigger to the table to record the keys which have changed. The have a query to find just the key which have changed.
    - When a field changes, also send a broadcast/topic message.
    - Add a trigger which sends a JMS message when a change occurs. (This is entirely DB/JMS specific, you need to find if this is possible)
    Again, databases are not ideally suited to event driven, real time updates. There is no simple, clean solution.

  • VT01N User exit for adding additional field to VTTP table and populate the

    Hi,
    Can any one sujjest what is the use exit/bapi when we add(append) a custom field to vttp table to populate the incremental number  based on ship to address when we create a shipment..
    need user exit in ...............to populate data to vttp table custom field when we append......

    hi,
    check these exits for vt01n.
    Transaction Code - VT01N                    Create Shipment
    Enhancement/ Business Add-in            Description
    Enhancement
    V56USVDP                                Preparation for updating new objects for transport?
    V56USVDO                                Update new objects for transport
    V56USTAT                                User-individual definition of transportation planning status
    V56UNUMB                                Shipment number allocation
    V56UDLUP                                Obsolete as of 4.6C: Delivery Update on Delivery Routines
    V56UCHCO                                Check shipments are complete
    V56UCHCH                                Shipment processing: Check whether changes were made
    V56TDLIF                                Filter Delivery Items for Shipment
    V56SLDET                                Shipment processing: Leg determination
    V56MVT04                                Extensions for Collective Processing of Shipments
    V56LOCID                                Shipment Processing: Determine Location Identification
    MV56AINI                                Initialization of transaction control for transportation
    V56AFCCH                                Shipment processing: Check function code allowed
    V56AGTAR                                User Exit for Filtering Shipping Unit Calculation
    V56ARCHV                                Customer-spec. checks for archiving shipments
    V56ATKTX                                Change the number of lines for text input in shipment
    V56BMOD                                 Transportation processing: Field modification
    V56DISTZ                                Shipment Processing: Determine Distance
    V56FCOPY                                Shipment processing: Copy delivery data
    V56FSTAT                                Shipment processing: Activities when setting a status
    V56L0001                                Status of Shipments for a Delivery
    V56LDELI                                Read Delivery Data for Shipment Processing
      Business Add-in
    BADI_LE_SHIPMENT                        BadI: Shipment Processing
    BADI_V56N                               User Exit for Message Determination: Shipment

  • Fill BSEG-LIFNR and LFA1-NAME1 in line item text field of Bank GL line item

    Hi all,
    I need to develop a program to populate the Vendor Number (BSEG-LIFNR) and Vendor Name (LFA1-NAME1) in the line item text field of Bank GL line item.
    The UI design will have the input data as:
       - Company Code
       - Posting Dates (both from and to date)
       - Execute Icon
    Please let me know how to proceed on this.
    Thanks and regards,
    Anishur

    program a bdc to tcode fb09
    A.

  • Amount Difference in sales order and billing for one line item

    Hi experts,
    User created one sales order with three line items say line item10, line item20
    Line item 30.Line item 10 value is 5024.26 EUR in sales order. He did delivery for three line item and invoiced. But the problem is that the line item 10 value is changed i.e. 5024.28 EUR in Billing and the remaining line item values are correct. All the line items having same item category.
    I asked the user to cancel the invoice and PGI. He did that. And again he created the PGI and Invoice. But the value of line item 10 become 5024.27 EUR and again he cancels the invoice and the PGI. and again he created the PGI and Invoice. Now the value of line item 10 is correct i.e. 5024.26EUR in invoice.
    Note: No changes are carried out from sales order to billing and even in material also.
              I checked copy control settings also all are correct.

    Hi
    I think this is standard SAP issue of rounding the condition records at item level. Can you please share the netvalue for all the three items and the header net value at sales order and invoice level.
    kind regards
    sandeep

  • Adding Custom Fields to BSEG and BKPF Tables

    Hi All,
    My customer would like to add around 5 fields to BKPF table and 6-7 fields to BSEG table. Can you all suggest me whether it would be a good idea to add any custom field to these tables ? I would like to mention that standard fields available in these tables will not be used for the requirements of the customer and he is insisting on adding custom fields. I need your expert advice on this matter.
    Regards,
    Rohit

    Hi Friend,
    Please do not add any custom fields in those tables.
    These two tables are pillar of accounting entries in SAP, if you want to push them then it is OK, otherwise find some other way.
    Regards
    Krishnendu

  • Adding Colume in the Table and display result in it.

    Hi Guru's ,
    I have a requirement to add column in existing Table. and Display the result after calculation.
    Thanks,
    Rutu

    Hi,
    Please used this code snippet for reference:
    OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);
    OAViewObject vo = (OAViewObject)am.findViewObject("<VO Name>"); // Give VO Name attached to the Table Region.
    if (vo != null)
    vo.addDynamicAttribute("<Att_Name>"); //Adding ViewAttribute to VO
    vo.reset();
    vo.next();
    //Do calculation that you want
    //Setting the calculated value in the created VO Attribute
    vo.getCurrentRow().setAttribute("<Att_Name>", <Value to assign>);
    I hope this will gives you a proper Help.
    Please feel free to ask if any more Question
    Thanks,
    Shrikant

  • How to join  fields from different internal tables and display into one int

    hai i have one doubt...
    how to join  fields from different internal tables and display into one internal table..
    if anybody know the ans for this qus tell me......

    hii
    you can read data as per condition and then can join in one internal table using READ and APPEND statement..refer to following code.
    SELECT bwkey                         " Valuation Area
             bukrs                         " Company Code
        FROM t001k
        INTO TABLE i_t001k
       WHERE bukrs IN s_bukrs.
      IF sy-subrc EQ 0.
        SELECT bwkey                       " Valuation Area
               werks                       " Plant
          FROM t001w
          INTO TABLE i_t001w
           FOR ALL ENTRIES IN i_t001k
         WHERE bwkey = i_t001k-bwkey
           AND werks IN s_werks.
        IF sy-subrc EQ 0.
          LOOP AT i_output INTO wa_output.
            READ TABLE i_t001w INTO wa_t001w WITH KEY werks = wa_output-werks.
            READ TABLE i_t001k INTO wa_t001k WITH KEY bwkey = wa_t001w-bwkey.
            wa_output-bukrs = wa_t001k-bukrs.
            MODIFY i_output FROM wa_output.
            CLEAR wa_output.
          ENDLOOP.                         " LOOP AT i_output
        ENDIF.                             " IF sy-subrc EQ 0
    regards
    twinkal

  • Adding  fields in the  transaction  FS10N ( G/L  Account LIne Item  Display

    Hi all,
    in G/L  Account Balance Display( FS10N)  once i get list display when i click
    CUMULATIVE DISPLAY button it will go to G/L  Account LIne Item  Display list
    Here i have to add CUSTOMER field (sold to party or partner)  And NAME field in
    the list beside G/L account and  company code fileds
    Please let me know how to proceed.
    shall i have to do any back ground setting or
    i have to copy the program in to Z program
    then modify?
    urgent requirement
    please let me know
    thanks

    Hi,
    For writing a substitution exit code you will need the help of your ABAPer.
    Use T Code GGB1 to create a substitution. In the application Area select Financial Accounting --> Line item.
    Create a substitution for your company code. Under Substitution Create Step. When you click on step it will give you a list of fields in BSEG table. Select field name XREF1 or XREF2 or XREF3 any one. In the next screen select "Exit". In the Prerequisites give conditions as BKPF-BUKRS = 1000 (your company code).
    In the Substitution select your exit code against  your XREF1 or XREF2 or XREF3 field.
    While writing the exit code you can give the logic as select BSEG-KUNNR and pass to table KNA1. Then populate BSEG-XREF1 with KNA1-NAME1
    Save this substitution and activate it in T Code "OBBH"
    While writing Substitution exit copy the standard program "RGGBS000" and create your Z program. Write your new code in the Z program. This step should be done before you create a substitution. Use T Code GCX2 and maintain your Z program against Application Area "GBLS".
    Also see to it that the Reference Key1 / 2 / 3 field is made optional in all the Posting Keys and Field Status Groups.
    Please let me know whether this helps.
    Regards,
    Swapnil

  • How do I retrieve all data from a table and display it on a text area?

    I want to retrieve all the data from one of my MS Access data table and display them all in a text area. how do i go among doing this?
    In my car table i have the fields lined up like this..
    license,color,doors and year_made
    I have an Object class called CAR that will contain methods to set the data from these fields when it gets retrieved.
    here's what i go so far.....
    statement = getDBConnection().createStatement();
         rs = statement.executeQuery("select * from car");
         boolean moreRS = rs.next();
    if(moreRS)
    car.setLicense(rs.getLong(1));
         car.setColor(rs.getString(2));
         car.setDoors(rs.getString(3));
    car.setYearMade(rs.getString(4));
    //but this will only get me one car. How do I get more car data?
    HELP!!

    Vector cars = new Vector();
    while (rs.next()) {
      String license = rs.getLong(1);
      String color = rs.getLong(2);
      String doors = rs.getLong(3);
      String year = rs.getLong(4);
      myTextArea.append(license+"\t"+color+"\t"+doors+"\t"+year+"\n");
      Car car = new Car();
      car.setLicense(license);
      car.setColor(color);
      car.setDoors(doors);
      car.setYearMade(year);
      cars.add(car);
    }t=tab
    n=newline
    Vector: http://java.sun.com/j2se/1.4.1/docs/api/java/util/Vector.html

  • Error while adding user fields to user table using vb6.0

    Hi,
    I am adding a user tables using vb6.0 using DIAPI.
    I am able to add the user table successfully.
    I am getting the following error when i am adding the fields to the table.
    "The metadata object for this object cannot be updated, since it's ref count is bigger than 0."
    My code is as follows:
        oUserFieldsMD.TableName = TABLE_NAME_ITEM_LOCN
        oUserFieldsMD.Name = vTableFields(0, lCount)
        oUserFieldsMD.Description = vTableFields(1, lCount)
        oUserFieldsMD.Type = vTableFields(2, lCount)
        oUserFieldsMD.EditSize = CLng(vTableFields(3,lCount))
        lRetCode = oUserFieldsMD.Add
    This error does not come up when i try to add the field to my table using the vb sample provided by SAP.
    Your help will me much appreciated.
    Thanks.

    Hi Satish,
    The problem is that you added the table and the objetc that you used to add the table is not freed properly. You need to free the object and then the reference count to that table will be 0 - which will enable you to add the fields
    e.g
    Dim pUTables As SAPbobsCOM.UserTablesMD
    'Do your stuff
    Set pUTables = Nothing
    Dim pUFields As SAPbobsCOM.UserFieldsMD
    'Do your stuff
    Set pUFields = Nothing

  • Adding New field in a Table

    Hello Experts,
    I have created a table. I have 3 fields in that table and i hav used that table for 2 months. Now i have added a
    new field( FLAG Field ) values will be 'X' or Blank.  Now when i am using a select query on this table in where condition if i am using Flag = ' ' ,  it is not considering the old records it is fetching values from the day i have added the new field, Kindly provide me a solution
    Thanks & Regards,
    Kams.

    Hi,
    then you forgot to set the INITIALIIZE flag for your new field in SE11.
    Regards,
    Klaus

  • Aditional field in standard table and screen

    Hi friends.
    I'd like to know how to add a new field in a table and make it visible in standard transaction.
    In this case, the table is EBAN and transaction is ME51N, ME52N and ME53N. This new field must be includded in transaction items grid.
    I've already added field to CI... include in EBAN but this new field does't appear in standard transaction.
    I've already saw variant and this new field doesn't appear there too.
    Any idea ? Any SAP Note (I hadn't find any sap note yet) ?
    thanks.
    Glauco

    Hi Raymond Giuseppi.
    Greate hint about this SAP NOTE. It solved my issue !!!
    P.S.: This note is to releases 46c and 47, BUT even I'm in release ECC 6.0 I must do the same: I've already created CMOD prject, includes and subscreen 0111 like SAP NOTE ask to do. This SAP NOTE has entire example on how to add this subscreen and encoding includes of TOP, PBO and PAI to read and save data of Zfields of EBAN. It's nice and easy to understand.
    thank you !!!
    Glauco
    Edited by: Glauco Kubrusly on Nov 22, 2010 11:53 AM

  • Adding Custom Field to Shopping Cart and PO, Classic Scenario

    We are running SRM 7.0 with ECC 6.0 as the backend and using the Classic scenario. I want to add a custom field to the shopping cart and have the data transfer over to a custom field (of the same name) on the purchase order to the ECC side. I have already added the field to the shopping cart and have the data saving successfully there on the SRM side. What I am having trouble with is getting the data from the custom field to go over to ECC on the purchase order.
    I have extended the Shopping Cart and Purchase Order item structures through configuration on SRM. This has added the fields to the INCL_EEW_PD_ITEM_CSF_SC and INCL_EEW_PD_ITEM_CSF_PO structures, as described in note 672960 (do i need to extend the PO structure on SRM if using the Classic scenario?). I have also extended the CI_EKPODB and CI_EKPODBX structures on ECC as described in note 458591. So the placeholders are there.
    I feel like there must be something I am missing. The OSS note 458591 suggests that just adding the fields to the needed structures will cause the data to transfer, but this does not appear to be the case.
    I have an implementation of BBP_CREATE_BE_PO_NEW that I can use, but do not see where to add the data in the output parameters of that BADI. Is there a BADI I need to implement on the ECC side?
    Any help in this issue would be greatly appreciated.

    Dug around a little bit more and stumbled onto this article which solved it for me: [How to transfer custom fields from SRM to ECC|http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/20b36c12-685f-2c10-4fb4-ba2e0b969c27?quicklink=index&overridelayout=true]
    In BADI BBP_CREATE_BE_PO_NEW I had to add some code to fill in the CS_PO1_DOCUMENT-EXTENSIONIN parameter table with the structure for the BAPI_TE_MEPOITEM structure on the ECC side. The tricky part is creating a string representation of that structure with the correct offset. And it isn't as easy as just counting up the number of characters in SE12. For example, looking at my BAPI_TE_MEPOITEM structure in SE12, my custom field appears to start on character 157, but in reality, I had to offset the writing of my value to character 143. I guess it depends on what types are in there.
    But once that gets figured out, it works well. As long as the custom field is added correctly to the CI_EKPODB append structure (which is appended to BAPI_TE_MEPOITEM), the data gets tranferred over in the ExtensionIn table, and SAP automatically knows what to do with the data as long as you have everything in ExtensionIn aligned correctly.
    Thanks for the help everyone!

  • Update of segment field in bseg table

    hi
    can any explain me about update of segment field in bseg table
    segment is mentained in profit center master record ,and i want to generate trial balance segment wise and profit center wise
    please suggest me steps to do in a new gl senario
    thanks
    cb

    Hi,
    You need to activate the assign scenarion FIN_SEGM to your ledgers in the below path:-
    SPRO> Financial Accounting (New) > Financial Accounting Global Settings (New) > Ledgers > Ledger > Assign Scenarios and Customer Fields to Ledgers
    Then you need to make document splitting characteristics based on Segment field in the below path:-
    SPRO> Financial Accounting (New) > General Ledger Accounting (New) > Business Transactions > Document Splitting > Define Document Splitting Characteristics for General Ledger Accounting
    Make the below entry:-
    Field = SEGMENT
    Zero Balance = Selected
    Partner Field = PSEGMENT
    Mandatory Field = Selected
    Then you will be able to generate the balance sheet segment wise in report S_PL0_86000028 "Financial Statement: Actual/Actual Comparison". (Similar steps you can use for profir center wise balance sheet in addition.)
    Regards,
    Gaurav

Maybe you are looking for