UDF for Total Lines

Hi Masters,
Please any body give me UDF Code for Total Lines.
Thanks!
Regards,
SReddy

Hi,
See for example if your  structure looks like the below
<Recordset>
<Row>
<Fname>J</Fname>
</Row>
<Row>
<Fname>K</Fname>
</Row>
<Row>
<Fname>L</Fname>
</Row>
<Row>
<Fname>M</Fname>
</Row>
<Row>
<Fname>N</Fname>
</Row>
</Recordset>
If you want to count the row then ,
Row[Change context to higher level]----->COUNT--
>Target
Hope it helps you!!
Best regards,
raj.

Similar Messages

  • UDF for Total records

    Hi
    I have a scenario where sender is file. In file there is a field Total records.
    I need to validate Total records field with the total records in the file using UDF..
    Can any suggest me the how to write the cod efor this..
    venkat

    Hi Venkatesh,
    In your source structure should Detail Records count  equal to Total Record Count?
    if yes,just create <b>Context</b> UDF and pass the following 2 inputs
    1. <b>DetailRecord</b> -> RemoveContext
      2. <b>TotalRecord</b>
    and inside UDF write java code for validation
    suppose if your inputs are a[](DetailRecord) and b[](TotalRecord)
      int scnt = a.length;
      int tcnt = Integer.parseInt(b[0]);
      if( scnt != tcnt)
           //write code to trigger an alert(from the following weblog)
    To Trigger alert from UDF just go through the following weblog
    /people/bhavesh.kantilal/blog/2006/07/25/triggering-xi-alerts-from-a-user-defined-function
    Cheers,
    Jag

  • UDF for Line item number

    Hi All,
    Currently i'm working on a EDI2JDBC scenario. we have a field called LINE_ITEM_NUMBER at the target side. The incoming EDI signal doesn't contain the line item number and at the target side for every line item we need a create line item number. Lets suppose the incoming signals contains 3 line item number then at target side the value for LINE_ITEM_NUMBER should be 1,2 and 3. Can i achieve this functionality with any standard function or do i need to write an UDF? Can anyone provide the code for UDF?
    Your hekp is highly appreciated.
    Regards
    Faisal.

    Hi Faisal,
    The Below mapping will work for your requirement..
    Source(LineItemNumber)--->Index(Initial Value = 1, Increment = 1 )------\
                                                                             then
    Source(LineItemNumber)  ---->  Exisists      ----->  If                     ------>Target(LineItemNumber)
                                                                             else
                                                      Constant[0] ------------/
    If Input is
    <Source>
       <Line>aaaa</Line>
       <Line>bbbb</Line>
       <Line>cccc</Line>
    </Source>
    Your Target will be Like This
    <Target>
       <Line>1</Line>
       <Line>2</Line>
       <Line>3</Line>
    </Target>
    I have Tested That Mapping.. Working as shown below.
    Let me know For any clarifications..
    Regards
    Jyothi A.

  • How To avoid column heading for only total line in ALV list Display

    Hi,
    How To avoid column heading for only total line in ALV list Display.

    Hi,
    to change colunm header field catlog is built
    look at the example below
    Changing column text headers
    use this to change, hide, or alter the ALV columns
    CLEAR: gt_fcat.
    READ TABLE gt_fcat WITH KEY fieldname = 'TEXT1' " ***
    *TEXT1 is your field name
       ASSIGNING <gtfcat>.
    IF sy-subrc = 0.
       <gtfcat>-coltext   = 'Date Type'.
       <gtfcat>-no_out    = ' '.
       <gtfcat>-tooltip   = 'Date Type Text from IT0019'.
       <gtfcat>-seltext   = 'IT0019'.
    keep seltext to '' if u want to hide
    ENDIF.
    regards
    austin

  • Stopping total line in crosstab for plus

    Okay.
    Should be a simple answer where it's some setting somewhere .... but I could have sworn under Disco Desktop in the ol' days (ie: 4.x and down), there was a way to stop the automatic total line in a crosstab.
    Does anyone know the setting - or how to do this - in a crosstab in Plus?
    I need the crosstab presentation, but in a particular report's case, I DO NOT want the auto-aggregation to automatically total up the lines below when I have an item on the left column of the crosstab.
    This should be a simple setting somewhere, but where ... I can't find it.
    Any help?
    Thx.
    Russ

    Thx. already taking the SUM for the aggregation.
    The problem I'm having - and it SHOULD BE a trivial fix - is in a crosstab, let's say you have 2 axis items on the left side (like the Y axis in a graph) and a number of columns across the top (ie: state on far left, sales amt on near left, stores along the top).
    Well when the datapoints are presented in the data area (where it's set to SUM), you'll get the correct datapoints for each location, etc. across the top, but I DO NOT want state to automatically show the SUM.
    A good way to explain this, would be if you also created a total to sum all points everytime the state changed, then you'd get a total line, plus the auto-summing at the top where the state is.
    It's the auto-summing I don't want for a particular worksheet.
    So, it should be something trivial like: 'crosstab autosum off', and I could have sworn I've turned this off in the past in Desktop, but cannot figure out how to do it in Plus.
    Any ideas?
    Russ

  • Purchase Order Row UDF for Received Qty

    Hi experts,
    Can someone please recommend a way to create a row UDF for purchase orders to show the qty received? We cannot use a simple calculation like Qty-Open Qty because if the row is closed manually, the open qty becomes zero. Another problem is how to prompt the PO to update this value if additional GR PO's or AP Invoices are created. Thanks.

    I should explain the circumstances more clearly. There is no problem with the standard GR PO or AP invoice receiving method. What I want is a reference field on the original PO showing the total qty received to date. For example: total of 1,000 pcs ordered -> 900 pcs received against several GR PO's -> want to see that 900 has been received back on the PO. Then let's say we want to close the PO line 100 pcs short.
    I can think of 2 ways to go about this:
    Method 1: Change the ordered qty from 1,000 to 900 -> row is closed, but lose the reference of the original order qty being 1,000.
    Method 2: Close row manually and maintain the original order qty as reference, but lose b/o qty and it is difficult to tell how many pcs where received/closed short.
    Is there another way to keep all the reference information?

  • UDF for leading zero's in message mapping

    Dear team,
    I need UDF for leading zero's in my message mapping.
    Source and Target both structures contains matnr field.But we have to maintain total 18 chars at target matnr , because RFC in R/3 needed.So I want to add leading zero's when mapping. Can anybody provide the UDF code.
    Matnr[source]--->split by value(eachvalue) ->UDF->Matnr[Target]
    Ex::if source matnr conatains value "9846538" ; I need matnr value at target side like "000000000009846538"[total 18 chars].
    -Drumi

    Hi Ambrish,
    Good day...
    I have enterd what you said and I got below error... and I gave "input" in place of var1, 18 in place of filedlenght in below program...
    =================================
    int len = Integer.parseInt(18);
    int inputLength = input.length();
    try {
    Integer.parseInt(input);
    // If it is an integer, add 0 (len - inputLength) times
    for (int i=0; i< len-inputLength;i++)
        input = "0" + input;
    return input;
    } catch (NumberFormatException numForEx) {
    // return as it is, if alphanumeric
    return input;
    ====================================
    ERROR:
    Source text of object Message Mapping: Lubrisur_SHPMNT_SHPMNT05_TO_WMMBXY_WMMBID02_TransferPosting | urn:bp:xi:dwn:lu:common:Logistics:100 has syntax errors:
    Function LeadingZeros, Line 1:
    cannot find symbol symbol  : method parseInt(int) location: class java.lang.Integer int len = Integer.parseInt(18);                  ^ 1 error
    =======================
    Please suggest

  • Total line in PA report painter

    Hi,
    I have a problem with total line calculation in KE30 report.
    I have defined a few colomns in the form like gross sales, discounts, returns by some customer and I have written a MAX formula for one colomn. When I select material for drill-down. the system generate a total line automatically. total line for MAX formula colomn is calculated as MAX of the related colomn total line result. I would like to change this calculation way and I want to see the result of  MAX colomn total at this line.
    the Report form can be seen as follow:
    Key colomn(material)Net sales(cust.1)  Net sales(Cust 2)  MAX of net sales
    Material 1                   100                        120                    120        
    Material 2                    90                           85                     90
    Total line                     190                        205                    205 (I want to see 210 for this total result)
    I have tried all type of report form to change the result like matrix, one axes with key figure but I could not solve the problem.
    Could you please help me about that issue If you have any idea or experience
    Thanks
    Best regards.
    Ozlem Babacan.

    Remove the drilldowns for the "detail" characteristics that you do not want to see. The report will then display only the "totals" that you do want to see.
    Hope this helps...
    Bob

  • BDC for multiple line items (VA01)

    Hi Experts,
      I create a BDC for VA01 transaction for single line item in that now i want to upload multiple line items also with  o/p of total no. of records uploaded, no. of records posted and the no. of error records...
    Can any body explain with sample code...

    Hi,
    if the flat file is containing header and item records...
    first split those records tooo two internal tables header and item..
    Loop at header ...
      process of recording steps for header....
    Loop at item...
    here create a varialbe with char 2 .. for index value....
      process of item recording steps..
      increment the index value by 1....
      here u have to pass  'p+'  OK_CODE..
    Endloop ..(item)
    Endloop...(header)
    for more info goo through this link...
    http://www.sap-img.com/bdc.htm
    hope helpful
    Raghunath.S

  • Total and non-total lines in ALV grid

    Hi all,
    Does anyone know if there is any standard SAP functionality for retrieving the non-total/raw item lines that lies beneath a total line in an ALV grid (after the user has selected the total line)?
    All helpful answers will be rewarded!
    Best regards,
    MV

    Try the ALV event AFTER-LINE-OUTPUT may be it can help u to achieve ur requirement.
    Append  AFTER-LINE-OUTPUT event to the internal table T_EVENT.
    CLEAR W_EVENT.
    W_EVENT-FORM = SLIS_EV_AFTER_LINE_OUTPUT.
    W_EVENT-NAME = SLIS_EV_AFTER_LINE_OUTPUT.u201CAFTER_LINE_OUTPUT event
    APPEND W_EVENT TO T_EVENT.
    FORM AFTER_LINE_OUTPUT
      USING P_RS_LINEINFO TYPE SLIS_LINEINFO.
    Here you have to write the logic to retrieve the 'total' line
    ENDFROM.
    Now call the alv FM
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
          I_CALLBACK_PROGRAM = L_REPID    "Program Name
          IS_LAYOUT          = W_LAYOUT   "Layout of the Report
          IT_FIELDCAT        = T_FIELDCAT "Field Catalog for Report
          IT_EVENTS          = T_EVENT    "For setting the events
       TABLES
          T_OUTTAB           = T_OUTPUT   "Report data Internal Table
       EXCEPTIONS
          PROGRAM_ERROR      = 1
          OTHERS             = 2.

  • Total line in ALV grid

    Hi,
    Can I use a total line in an ALV grid and hide part of the columns, so that only the total line will be presented for some of the columns ?

    Hi,
    Yes u can use a total column in the ALV Grid.
    Check the code below:
    AT LAST.
          WA_ALV_CAT1-FIELDNAME = 'TOTAL'(004).
          WA_ALV_CAT1-COL_POS = L_I.
          WA_ALV_CAT1-COLTEXT = 'TOTAL'(004).
          WA_ALV_CAT1-JUST =  C_CENTER.   " 'C'.
          APPEND WA_ALV_CAT1 TO L_ALV_CAT1_TAB.
          CLEAR  WA_ALV_CAT1.
        ENDAT.
    Regards
    Kannaiah

  • ALV grid total line customizing

    Dear Masters,
    I need a solution for my problem. I need to modify sorting of subtotal and grand total based on currency which criteria i create  myself. The standard alv output sort total by currency based on alpahabetical order, e.g: AUD,  EUR, IDR, USD. I need to change the sorting into IDR, USD, AUD, EUR. How can i do it in alv grid?
    I also like to add new line after grand total line, which is grand total in Local Currency, in this case, in IDR, which rate given. I can get the figure of subtotal, but i don't know how to append new line after grand total line output in alv standard.
    Need your suggestion.
    Many thanks,
    Tiara

    Hi,
    I have used object oriented ALV. You can remove final total line and have sub total lines. Code below can help you.
    1) Fieldcatalog you can do sum for currency values
    2) Sort Build you can have sub totals.
    3) layout_init you can remove final total line.
    4) CALL METHOD grid->set_table_for_first_display you can pass above structure for excepted Result.
    fieldcatalog_init
    FORM fieldcatalog_init USING lt_fieldcatalog TYPE lvc_t_fcat
                           value(field_name) value(field_type) value(field_text) value(field_key).
      DATA: ls_fieldcatalog TYPE lvc_s_fcat.
      CLEAR ls_fieldcatalog.
      ls_fieldcatalog-fieldname = field_name.
      ls_fieldcatalog-datatype  = field_type.
      ls_fieldcatalog-reptext   = field_text.
      ls_fieldcatalog-coltext   = field_text.
      ls_fieldcatalog-seltext   = field_text.
      ls_fieldcatalog-tooltip   = field_text.
      ls_fieldcatalog-key       = field_key.
      IF field_type = 'CURR'.
        ls_fieldcatalog-do_sum    = 'X'.
      ENDIF.
      APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ENDFORM.                    "fieldcatalog_init
    sort_build
    FORM sort_build USING lt_sort TYPE lvc_t_sort.
      DATA: ls_sort TYPE lvc_s_sort.
      ls_sort-fieldname = 'BUKRS'. "Fieldname on which to sort
      ls_sort-subtot    = 'X'.
      ls_sort-up        = 'X'.     "Sort Ascending
      APPEND ls_sort TO lt_sort.
      IF p_comp <> 'X'.
        ls_sort-fieldname = 'LIFNR'. "Fieldname on which to sort
        ls_sort-subtot    = 'X'.
        ls_sort-up        = 'X'.     "Sort Ascending
        APPEND ls_sort TO lt_sort.
      ENDIF.
      ls_sort-fieldname = 'WAERS'. "Fieldname on which to sort
      ls_sort-subtot    = 'X'.
      ls_sort-up        = 'X'.     "Sort Ascending
      APPEND ls_sort TO lt_sort.
    ENDFORM.                    "sort_build
    layout_init
    FORM layout_init USING ls_layout TYPE lvc_s_layo.
      DATA lv_date(10) TYPE c.
      WRITE sy-datum TO lv_date.
      IF p_line = 'X'.
        CONCATENATE 'Line Item wise Report as on' lv_date INTO w_string2 SEPARATED BY space.
      ELSEIF p_vend = 'X'.
        CONCATENATE 'Vendor Summary Report as on' lv_date INTO w_string2 SEPARATED BY space.
      ELSEIF p_comp = 'X'.
        CONCATENATE 'Company Summary Report as on' lv_date INTO w_string2 SEPARATED BY space.
      ENDIF.
      ls_layout-zebra      = 'X'.
      ls_layout-grid_title =  w_string2.
      ls_layout-sel_mode   = 'A'.
    ls_layout-no_merging = 'X'.
      ls_layout-cwidth_opt = 'X'.
      ls_layout-no_totline = 'X'.
      IF p_line = 'X'.
        ls_layout-ctab_fname = 'COLINFO'.
      ENDIF.
    ENDFORM.                    "layout_init
          CALL METHOD grid->set_table_for_first_display
            EXPORTING
              is_layout       = gs_layout
              is_variant      = va_layout "&see below
              i_save          = 'A'     "&see below
              i_default       = ''
            CHANGING
              it_outtab       = it_apout[]
              it_fieldcatalog = gt_fieldcatalog
              it_sort         = gt_sort.
    Edited by: Himanshu Dave on May 11, 2009 2:33 PM

  • Adding a new schedule line for a line item using bapi_po_change

    hi experts,
    can i know how to add a new schedule line for a line item using<u> bapi_po_change</u>. what are the parameters that need to be filed. i filled poitem with total quantities and poschedule table with 2 different schedule lines and passing as the parameter.but then i get the error saying item 0000 doesnt exist

    Hi,
    Please check if you have properly populated the following fields in POSCHEDULE:
    PO_ITEM
    SCHED_LINE
    and the other fields required for your schedule line such as delivery date and quantity, etc.
    After that, make sure to properly populate fields in POSCHEDULEX:
    PO_ITEM -> same value as found in POSCHEDULE
    SCHED_LINE -> same value as found in POSCHEDULE
    All other values populated in POSCHEDULE should be ticked as 'X' in POSCHEDULEX.
    Kind Regards,
    Darwin
    Kind Regards,
    Darwin

  • Merge the total line about header and item in the Hierarchical Seq ALV

    Hello guys,
    Now i used CL_SALV_HIERSEQ_TABLE to create a Hierarchical Sequential ALV. but there are two total lines, one is to calculate the numerical fields in the header(main) and another is calculate the numerical fields in the item(slave).
    my requirement doesn't contain the calculation for header line, so the first line is unuseful and i want to merge these two  line. 
    how i should do with it?
    Any clues is appreciated.
    Thanks a lot

    could anyone help me? i am very urgent!

  • How to count the total lines of the file (including the file header)

    Hi all,
    I am working with Idoc to file scenario(FCC).
    I need to map one of the field with a recound count ie.., count of the total lines of the file (including the file header).
    Eg:Record Count-- mapping area:Total number of records in the file including file header     The total line of the file (including the file header).
    Can i get a help on this.
    Thanks and Regards,
    Manoj

    Hi !
    If there is a tag of your IDOC that occurs the same quantity of times as file lines you have to create in your target file, you could make a Java user defined function in graphical mapping that "caches the entire queue" (use the corresponding option button), that receives as input that field of the IDOC, and returns the "lenght" (.length property value) of that input parameter (it is an array) as output..that should be the file line quantity..you may also add 1 to that count, for the header.
    Hope it helps.
    Regards,
    Matias.

Maybe you are looking for

  • Client Installing But Not All Components Are Available Post Install

    Hi, Now I am not positive how the posy client install process works but it seems the CM client normally installs and has only base components, then downloads a policy and installs the other components based on the policy? I have 2 DP's that is PXE en

  • Purchase Order Carryforward Does Not Net to Zero

    We are working in a year-end test client, copy of Production, in preparation for fiscal year end closing. For purchase order carryforwards, we find a number of documents which do not net to zero in the sender year. This seems to occur most often for

  • Using images in module pool programming.

    Can anyone tell the way to display an image in a module pool program screen? If its not too much of a headache, please give a detailed code.

  • Why when I delete an email, is there is a second copy to delete?

    I have an iPad 2 using IOS5.  Now when I delete an email there is a second copy of the same email to delete.  This is not a big deal but why does it happen and what can I do to prevent it?  Thank you.

  • Advantages of  ABAP Proxy ?

    Hi Folks, Can you suggest me , apart from ALE/IDOC and XI interface - what are the procedure to transfer data from sap to non sap and sap to sap? I heared about ABAP proxy. Can you provide some schenario based on ABAP proxy? Thanks in advance..!