Sapscript printing only the last value

Hello,
Im currently coding subroutine for medruck.. My problem is sapscript is only printing the last value of the item for all items.. For example:
Item # 1    10 pcs  10,000.00
Item # 2     5 pcs   10,000.00
Item # 3     5 Pad  10,000.00
where actually the value of item 1 and item 2 is not 10,000.. sapscript prints only the price of item # 3 for the  first two items.. here is my code..
  TABLES: konv, ekko, ekpo.
  DATA: BEGIN OF tab OCCURS 0,
      brtwr LIKE ekpo-brtwr,
      ebelp LIKE konv-kposn,
      ebeln LIKE ekko-ebeln,
      knumv LIKE ekko-knumv,
      kbetr LIKE konv-kwert,
END OF tab.
  DATA: sum TYPE p DECIMALS 2, gross TYPE p DECIMALS 2, val(16) TYPE c, d_knumv LIKE ekko-knumv, tab1 LIKE tab, val1(20) TYPE c,
        ext TYPE p DECIMALS 2, val2(20) TYPE c, extend TYPE p DECIMALS 2.
  REFRESH: tab.
  READ TABLE in_tab INDEX 1.
  CHECK sy-subrc = 0.
  SELECT brtwr ebelp ebeln FROM ekpo INTO TABLE tab WHERE ebeln = in_tab-value.
  LOOP AT tab.
    AT NEW ebelp.
      tab-kbetr = 0.
      ext = 0.
    ENDAT.
    SELECT SINGLE knumv FROM ekko INTO tab-knumv WHERE ebeln = tab-ebeln.
    SELECT SINGLE kbetr FROM konv INTO tab-kbetr WHERE knumv = tab-knumv AND kposn = tab-ebelp                                AND kschl = 'ZDEL'.
    ext = tab-brtwr + tab-kbetr.
    AT END OF ebelp.
      READ TABLE out_tab INDEX 1.
      WRITE ext TO val.
      out_tab-value = val.
      MODIFY out_tab INDEX 1.
    ENDAT.
    CLEAR: tab.
  ENDLOOP.
i used this code using abap only and it work. there seems to be a problem in sapscript.. Thank u for the help guys..
Thanks,
JP

put ur write_form with in loop...
loop at itab.
  write_form..
      element = 'ddd'
endloop.
in script check ...
check wheather element is specified there r not
/e  ddd.
     &itab-   &  &itab-  &

Similar Messages

  • WAD - display only the last value in the chart

    hi...
    I designed a chart in WAD wich displayed a range of values in a line. Now im searching for a possibility to display the value for the points in my chart, but not for all values, only for the last value in the line! And every month the line will extended with new value-points, so it is necassary that the function is dynamic, always for the last point in the chart the value should displayed!?
    thx for some ideas!
    david

    hi @ all... once more information:
    the chart displayed only one keyfigure of a query. for example it display the revenue per month. in jan. = 10, feb. = 15, mar. = 25, apr. = 13, jun. = 23. these values should be displayed in a line in the chart aaaand additional for the last one in the line the valuecaption direct in the chart (f.e.: jun. = 23). not for all "periods-points"only for the last one.
    in jul. = 25 the chart changed and only for july the value-caption should be displayed. Is it possible?
    Regards,
    David

  • I want to print only the last message in a thread of messages

    I have to keep hard copies of e mails.
    The problem is that as a trhead gets added to it means the print outs get longer and longer and are of course repatative
    Is there a setting that allows me to only print the most recent mail in a thread?

    Have you tried to open the last message in a new window?
    If that includes the messages you do not want to print, you could limit the printing to e.g. the first page (in the print dialog).
    For more advanced options you could look at the [https://addons.mozilla.org/nl/thunderbird/addon/printingtools/ PrintingTools add-on].

  • Only the last line item is shown in main window...

    Hello Experts,
    I created a custom form for the standard checque program RFFOUS_C. Now, in my MAIN window, I
    called a subroutine in a custom program which loops through the line items but the problem is
    only the last line item is being shown. I tried using CONTROL_FORM to create a new line
    but it does not work. Note that I did not customize RFFOUS_C since it is being used by
    multiple companies. Below is my code:
    SAPSCRIPT:
    510-C
    Begin of insertion DEVK940799 11/10/2008 DEL_HIDALGO
    DEFINE &LTYC_XBLNR& = ''
    DEFINE &LTYC_BLDAT& = ''
    DEFINE &LTYC_SGTXT& = ''
    DEFINE &LTYC_DMBTR& = ''
    PERFORM WRITE_LINE_ITEMS IN PROGRAM Z9999RFI_Z2574FFI_RA
    USING &REGUH-LAUFD&
    USING &REGUH-LAUFI&
    USING &REGUH-XVORL&
    USING &REGUH-ZBUKR&
    USING &REGUH-LIFNR&
    USING &REGUH-VBLNR&
    CHANGING &LTYC_XBLNR&
    CHANGING &LTYC_BLDAT&
    CHANGING &LTYC_SGTXT&
    CHANGING &LTYC_DMBTR&
    ENDPERFORM
    PROTECT
         &LTYC_XBLNR&     &LTYC_BLDAT&     &LTYC_SGTXT&     &LTYC_DMBTR&
    ENDPROTECT
    End of insertion DEVK940799 11/10/2008 DEL_HIDALGO
    PROGRAM:
    IF gt_regup[] IS NOT INITIAL.
        CALL FUNCTION 'OPEN_FORM'
           EXPORTING
    *         APPLICATION                       = 'TX'
    *         ARCHIVE_INDEX                     =
    *         ARCHIVE_PARAMS                    =
    *         DEVICE                            = 'PRINTER'
    *         DIALOG                            = 'X'
             form                              = lcc_z2574ffi_ra
    *         LANGUAGE                          = SY-LANGU
    *         OPTIONS                           =
    *         MAIL_SENDER                       =
    *         MAIL_RECIPIENT                    =
    *         MAIL_APPL_OBJECT                  =
    *         RAW_DATA_INTERFACE                = '*'
    *         SPONUMIV                          =
    *       IMPORTING
    *         LANGUAGE                          =
    *         NEW_ARCHIVE_PARAMS                =
    *         RESULT                            =
           EXCEPTIONS
             canceled                          = 1
             device                            = 2
             form                              = 3
             OPTIONS                           = 4
             unclosed                          = 5
             mail_options                      = 6
             archive_error                     = 7
             invalid_fax_number                = 8
             more_params_needed_in_batch       = 9
             spool_error                       = 10
             codepage                          = 11
             OTHERS                            = 12.
        IF sy-subrc <> 0.
    *        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    *                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        LOOP AT gt_regup INTO lw_regup.
          m_line_items 'LTYC_XBLNR' lw_regup-xblnr.
          m_line_items 'LTYC_BLDAT' lw_regup-bldat.
          m_line_items 'LTYC_SGTXT' lw_regup-sgtxt.
          m_line_items 'LTYC_DMBTR' lw_regup-dmbtr.
          DELETE ex_output WHERE value IS INITIAL.
          CALL FUNCTION 'WRITE_FORM'
           EXPORTING
             element                        = '510-C'
             function                       = 'APPEND'
    *         TYPE                           = 'BODY'
             window                         = 'MAIN'
    *       IMPORTING
    *         PENDING_LINES                  =
           EXCEPTIONS
             element                        = 1
             function                       = 2
             type                           = 3
             unopened                       = 4
             unstarted                      = 5
             window                         = 6
             bad_pageformat_for_print       = 7
             spool_error                    = 8
             codepage                       = 9
             OTHERS                         = 10.
          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 'CONTROL_FORM'
            EXPORTING
              command   = 'NEW-LINE'
            EXCEPTIONS
              unopened  = 1
              unstarted = 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.
        ENDLOOP.
        CALL FUNCTION 'CLOSE_FORM'
    *       IMPORTING
    *         RESULT                         =
    *         RDI_RESULT                     =
    *       TABLES
    *         OTFDATA                        =
           EXCEPTIONS
             unopened                       = 1
             bad_pageformat_for_print       = 2
             send_error                     = 3
             spool_error                    = 4
             codepage                       = 5
             OTHERS                         = 6.
        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.

    Hi,
    Write the at last event in the program and check if it works
      At last.
           CALL FUNCTION 'CONTROL_FORM'
            EXPORTING
              command   = 'NEW-LINE'
            EXCEPTIONS
              unopened  = 1
              unstarted = 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.
    Regards,
    Sravanthi

  • How to display the last value of a field in a group in the group header

    I need to display the last quiz score from a group of quiz scores as part of the header of a group of units (the quiz score values are in the detail record).  I can not use the group footer, which would be the natural place to find the last value.  It must be in the group header because there will be a subsequent group within the unit group.  In other words, the grouping is as follows:
    Unit Group Header (Display last quiz score in unit)
    SubUnit Group Header (Display other detail summaries)
    Detail Record (including quiz score)
    SubUnit Group Footer
    Unit Group Footer
    While there is a minimum/maximum summary function, there is not a first/last function.
    Fuskie
    Who is constantly amazed at the ability of users to request report features that are not easily implented through Crystal Reports...

    Hi Fuskie,
    One suggestion to display the last quiz score in the Group Header, other than what had already been suggested, will be to use a linked subreport in the Group Header. It is not an efficient way to display the information, but it could do the trick.
    Another suggestion will be to insert a subreport in the report header, then store the last quiz score in an array for each group, then share it with the main report and display the  values in the appropriate group. In this way it will only connect twice to the data source, one for the main report and once for the subreport, instead of multiple connection for each group.
    Finally, the most efficient way will be to have this value calculated on the database side using a command object or a stored procedure.
    Patrick

  • How to get the last value edited by users from JTable?

    Hi.
    I have a JDialog that includes an editable JTable. This table is used to set up field caption and font for a report program. I found only when cursor is moved to another cell, the value in current cell being edited will be transferred to Table Model. So if the user don�t move cursor to another cell after editing the value of a cell but click OK button directly, Table Model cannot get the last value edited by the user, I wonder if there is a way to fire JTable to transfer the value being edited to Table model.
    By the way, I found if the TableCellEditor is using JCheckBox or JComboBox instead of JTextField, there is no this problem.
    Thank you for any reply.

    I guess you can make use of the following methods on your table model to inform it make it getValueAt bcos table data has changed.
    fireTableCellUpdated
    Notifies all listeners that the value of the cell at [row, column] has been updated.
    fireTableChanged
    Forwards the given notification event to all TableModelListeners that registered themselves as listeners for this table model.
    fireTableDataChanged
    Notifies all listeners that all cell values in the table's rows may have changed. The number of rows may also have changed and the JTable should redraw the table from scratch. The structure of the table (as in the order of the columns) is assumed to be the same.
    But when to call these methods??
    -- When OK button is pressed, do this as the first thing!!
    OR
    -- Call this on every key event!!
    regds,
    CA

  • How to print in the last page of the script..?

    Hi,
    I am working on a script. I have a header window and one main window. In the main window, I am printing the line items of the Invoice. Once the line items finish, I have to print the sub totals there. and also to print the company agreement details(around 10 lines of text) in the last page of the script.
    So, <b>how to print the agreement details in the last page of the script..?</b>
    Can anyone provide me a sample code to find the last page of the Script layout..?
    And regarding writing the agreement details, is it better to hard code the text or use the standard texts..? which one is better..?
    Regards,
    Paddu.

    HI,
      Just create a Standard text, if you are going to use this standard text in other layouts also... and use it otherwise you can hard code it as this its of only 10 lines.
    declare one more element in the  main window itselft and call it atlast it would print in the last page..
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    ELEMENT = 'FOOTER'<b><- This element should contain the agreement details</b>
    FUNCTION = 'SET'
    TYPE = 'BODY'
    WINDOW = 'MAIN'
    EXCEPTIONS
    ELEMENT = 1.
    Thanks
    Mahesh

  • Keep only the last date in a tablix whith formula using previous

    Hi,
    I am using this formula in a tablix
    =iif(Previous(Fields!Extract_Date.Value)="", "", (
    (Fields!Percent_IPCoverage.Value-Previous(Fields!Percent_IPCoverage.Value))*1
    +(Fields!Percent_DVerCoverage.Value-Previous(Fields!Percent_DVerCoverage.Value))*2
    +(Fields!Percent_Formalized.Value-Previous(Fields!Percent_Formalized.Value))*2
    +(Fields!Percent_Traced.Value-Previous(Fields!Percent_Traced.Value))*3
    +(Fields!Percent_StakeholderValidation.Value-Previous(Fields!Percent_StakeholderValidation.Value))*3
    +(Fields!Percent_Compliant.Value-Previous(Fields!Percent_Compliant.Value))*3
    /(1+2+2+3+3+3)
    I would only display the last Extract Date in my tablix and corresponding value.
    How is it possible ?
    Thanks in advance.

    Hi fiacre6631,
    According to your description, you want to display the last Extract Date in your report. Right?
    In Reporting Services, we have last() function to display the last value in a specified scope. In this scenario, please refer to the expression below:
    =last(Fields!Extract_Date.Value,"DataSet")
    Reference:
    Last Function (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou
    Thanks!!
    It works :)

  • Function calling only the last Javascript API

    All,
    I have a function in my page header:
    function DisableANo(){
    //1
    $f_DisableOnValue('P20_B','AAAA','P20_A');
    //2
    $f_DisableOnValue('P20_B','BBBB','P20_A');
    //3
    $f_DisableOnValue('P20_B','CCCC','P20_A');
    I am calling this function on Item B's onChange event.
    When I do this, only the last //3 API is being called. If i remove //3 and have only //1 and //2, then I get //2 to work and if I remove //2 and have only //1, then I can get //1 to work.
    Can you please tell me where i am going wrong?
    Thanks!

    spriya wrote:
    Hi,
    I am trying to disable the item P20_A if the value of item P20_B is in 'AAAA' or 'BBBB' or 'CCCC'.Review the documentation:
    >
    $f_DisableOnValue(pThis, pValue, pThat)
    Checks the value (pValue) of an item (pThis). If it matches, this function disables the item or array of items (pThat). If it does not match, then the item is enabled.
    >
    So in this code (and code should always be posted using <tt>\...\</tt> tags):
    function DisableANo(){
    //1
    $f_DisableOnValue('P20_B','AAAA','P20_A');
    //2
    $f_DisableOnValue('P20_B','BBBB','P20_A');
    //3
    $f_DisableOnValue('P20_B','CCCC','P20_A');
    }If <tt>P20_B == 'AAAA'</tt> //1 will disable <tt>P20_A</tt>, then because <tt>P20_B == 'AAAA'</tt>, //2 will enable <tt>P20_A</tt> because <tt>P20_B != 'BBBB'</tt>, and so on etc...
    Try <tt>$x_disableItem</tt>:
    $x_disableItem('P20_A', (($v('P20_B') === 'AAAA') || ($v('P20_B') === 'BBBB') || ($v('P20_B') === 'CCCC')))

  • Printing only the Gantt Chart

    Is there a way to print only the Gantt Chart?
    Mike
    R-Investments

    Check your page set up options when you do print preview. The last tab has some toggles where you can turn on/off printing the activity table and Gantt Chart.

  • JTable problem : how to get the last value entered by user + event lost

    Hi all,
    I have 2 problems with Jtable class.
    1 => To get the last value entered by user in a cell,
    it seems that we must change the selected cell.
    That is to say we can only have the previous cell's value.
    Is there a simple way to get the current value of any cell ?
    2 => To resolve the problem i store the values of each cell in a vector and i intercept keyboard event (!)
    BUT, when i do a double click with the mouse on the Jtable, i loose keyboard events. Then, i can't intercept them.
    Is it a bug of swing or am i following a wrong way ?
    Thanks by anticipation for your help.

    You have to fire the "TableCellUpdatedEvent"
    and override the getCellEditorValue in TableCellEditor to return the current value

  • How to get  --Last date of the Last value .

    Dear All,
    I have a report like
    Material – Country – Current Price
    1112-----  Singapore  -
      100
    1112-----  Japan  -
      120
    1112-----  Malesia   -
      99
    Here current price is Last Value of the particular Material on particular Date.
    This I can get based on Key figure Aggregation ( Last Value and reference Character 0CALDAY ), It is giving the last Value of the Particular Material.
    Now my user wants to see Last date of the value ( Date of the Value )
    Example :-
    Material – Country –  Date --Current Price
    1112-----  Singapore  -
    01/04/2008 -- 100
    1112-----  Japan  -
    04/05/2008 -- 120
    1112-----  Malesia   -
    05/05/2008 -- 99
    If  I drill down the date in my  report  it is showing all dates , my user wants to see only last date .
    Hope some one has solved this issue , please help me to solve this issue.
    Regards,
    SHAIK.

    I have created a keyfigure with date as a data type.
    In aggregation tab, I selected  aggregation Maximum.
    Upto DSO, data is Loaded perfect. Ok.
    I added the same key figure in cube , When I am trying to Activate the Transformation,
    It is giving Error message.
    Rule 17 is invalid and is being deleted. The reason for this is that a field or InfoObject that is used in rule 17 has been deleted in the source or target of the transformation ODSO ZPL_DSO1 -> CUBE ZPLATT_C (0GH6MHANQ2J79LXZBLGIJ9ZK9LWHK6RS)
    Plz Advice.
    Regards,
    SHAIK
    Edited by: shaik on May 7, 2008 5:46 PM

  • How to pick up the last value of the input string

    Hi there,
    I have a requirement in which I have to pick up the last value of the input string.
    I don't know the field length, it could be 10 line, it could be 4 line and it could be even 1 line.
    Another problem is that the field contains all the alphanumeric values so the sort function is not working.
    I believe I need to write a UDF but not sure exact what and how.
    Can some body please help me solving this issue.
    Input.
    1.Abc
    2.abc123atxx.com
    3.(980)771-2341
    4.
    5.518VR50V58AD10DSAYBDSAFDSIEGHA:1
    In that case I only need to pickup the last value i.e. 518VR50V58AD10DSAYBDSAFDSIEGHA:1
    Output
    518VR50V58AD10DSAYBDSAFDSIEGHA:1
    Note:
    1. Length is unknown
    2. Alphanumeric data
    Thanks,

    Hi karthick Lakkar,
    Thanks for your quick response but unfortunately I am getting mapping exception.
    What I did is create a UDF with 2 input
    INPUT
    a string
    b string
    and then this code
    int Length=Integer.parseInt(a);
    int requiredLength=Integer.parseInt(b);
    if(Length<=requiredLength)
    return(a);
    else
    return a.substring((Length-requiredLength),Length);
    I am wondering about the input as well.
    At present I am doing
    KTEXT + KTEXT --- UDF
    + does represent concat, means same input will go to the UDF
    This is the error which I am getting
    Exception:[java.lang.NumberFormatException: For input string: "Kevin Farrar"] in class com.sap.xi.tf._MM_XXXXXXXXXXXXXX_ method calculate[Kevin Farrar, Kevin Farrar, com.sap.aii.mappingtool.tf7.rt.Context@6dbf19db]

  • Hello, as I do in iCal to print only the events

    Hello,
    as I do in iCal to print only the events of a certain period of time without seeing me days without commitments?
    is it possible?
    thanks in advance
    Alice

    Have you tried to open the last message in a new window?
    If that includes the messages you do not want to print, you could limit the printing to e.g. the first page (in the print dialog).
    For more advanced options you could look at the [https://addons.mozilla.org/nl/thunderbird/addon/printingtools/ PrintingTools add-on].

  • How can I print ONLY the active document?

    Whenever I go to File/Print the darn PSE 9 program sends all of the working files in the bin to the printer. I've searched online for 2 hours now looking for an answer.
    I like to work with having several to many files in the 'bin' and prefer to only print the active file I'm currently working on without having to close the 'working files' before I can print. How can I print ONLY the active document or file in the project bin? Please help, I've upgraded from PSE 3 to PSE 9 and really like the updated features, but this one pain in the neck default is getting the best of me.

    Thanks for your help, that works nicely. It is good to have control of the printer again.

Maybe you are looking for

  • Satellite U400-10J - Constant notification if I use multimedia buttons

    Hi! My problem is that whenever I press one of the configurable multimedia buttons above the keyboard (either the one with the speaker icon or media player icon), Windows UAC pops up with a window saying "Do you want to allow the following program to

  • If your screen goes blank is there anyway to retrieve our information?

    ok so my ipod screen no longer works after i shattered it is there a way to retrieve all my information?

  • Increased logfile size and now get cannot allocate new log

    Because we were archiving up to 6 and 7 times per minute, I increased our logfiles from size from 13M to 150M. I also increased the number of groups from 3 to 5. Because we want to ensure recoverability within a certain timeframe, I also have a scrip

  • More wrvs4400n issues

    I honestly don't understand how cisco can release a product like this.  It's soo flakey and unrealiable.  So far in order to get my 4400nv1 running I've had to use the recovery utility just to load firmware onto it (that was a 16hour ordeal!!) then i

  • Using Oracle to Oracle Datapump KM in ODI

    Hi, I am trying to use datapump to speed up the ODI execution. It works when I use it to move data across two schemas in the same database. However it fails to move data across different databases. When I looked a little into the problem I realized t