How to Use document.Lines.SetCurrentLine

Hi there, due to an enormous amount of time spent on this issue, I thought I would share how to use the SetCurrentLine method as posted to me by SAP support:
It seems very cumbersome, as I have now to do an extra Recorset look up to get all the lines if I want to get the correct index - but at least it works (hopefully).
Daniel
SUPPORTS MESSAGE ****
the way the SetCurrentLine works is as following:
You do not have to use neither the LineNum nor the VisOrder as your
parameterfor the setCurrentLine method.
The system will use the corresponding index (starting at zero)linked to
that line when running a query on the database and sorting the lines by
LineNum.
#,,DocEntry,, Item ,,LineNum,,Price,,VisOrder
1,,11669,, A1001,,,, 600,00,,
2,,11669,, A1003,,2,, 3,00,, 2
3,,11669,, A1005,,3,, 600,00,,1
See example above, that is the result of querying the database on that
sales order and sorting by LineNum.
The order in which the items are displayed in the application is based
on the VisOrder. In this example items are displayed A1001, A1005 amd
A1003.
In order to update Item A1005 I will need to create a recordset, query
the database and then loop the recordset to find the corresponding item
and then use that index from the recordset to set the value for the
SetCurrentLine method. In the example above index 0 from recordset
points at item A1001, index 1 points at item A1003 and index 2 points at
A1005 so your code should use setCurrentLine(2) to update item A1005.
If you try to use LineNum (3 in this case) you will get an error message
as index 3 does not exist in the recordset collection ( only 3 items
with indexes 0,1 and 2). If you use visOrder 1(for item A1005) then the
system will update item A1003 as 1 is the index for A1003 in the
recordset.
END OF SUPPORTS MESSAGE ********

Hi Curtis,
Your situation sounds a little different to mine, in that I know the LinNum of the documentline that I need to update - that is what the lineNumber variable is...
To update all the rows, I guess you would just iterate through all the lines sequencially (ie starting at 0 and ending at document.lines.count:
for(int i = 0; i < doc.Lines.Count; i++)
    doc.Lines.SetCurrentLine(i);
    // do your thing here...
How do you know what lines you want to update??
Dan

Similar Messages

  • How to use at-line selection in ALV

    Can someone help me about how to use at-line selection in an ALV

    u can try in user_command
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
             I_CALLBACK_PROGRAM = G_REPID
             IT_FIELDCAT = GT_FIELDCATALOG
             I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_SET'
             I_CALLBACK_HTML_END_OF_LIST = G_HTML_END_OF_LIST
             I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
             I_GRID_SETTINGS = GS_SETTINGS
             IS_LAYOUT = GS_LAYOUT
             I_SAVE = G_SAVE
             IS_VARIANT = GS_VARIANT
             IT_EVENTS = GT_EVENTS[]
    *      I_SCREEN_START_COLUMN = 0 "Use coordinates for
    *      I_SCREEN_START_LINE = 0 "display as dialog box
    *      I_SCREEN_END_COLUMN = 0
    *      I_SCREEN_END_LINE = 0
        IMPORTING
             E_EXIT_CAUSED_BY_CALLER = G_EXIT_CAUSED_BY_CALLER
             ES_EXIT_CAUSED_BY_USER = GS_EXIT_CAUSED_BY_USER
        TABLES
             T_OUTTAB = I_REP
        EXCEPTIONS
             PROGRAM_ERROR = 1
             OTHERS = 2.
    FORM USER_COMMAND USING R_UCOMM TYPE SY-UCOMM
                            RS_SELFIELD TYPE SLIS_SELFIELD.
    CASE R_UCOMM.
        WHEN '&IC1'.
          CASE RS_SELFIELD-FIELDNAME.
            WHEN 'XXXXX'.
              READ TABLE I_xxx INTO V_xxx
                WITH KEY XXX = RS_SELFIELD-VALUE.
              IF SY-SUBRC = 0.
              ENDIF.
            WHEN OTHERS
          ENDCASE.
      ENDCASE.
    ENDFORM.

  • How to use "document.getElementById()" using MVC and  bsp:call

    I follow the tutorial from saptechnical .com about F4 in BSP and it works.
    But my problem, is that is not working in my BSP I get javascript error "document.getElementById() is null" the popup appear I select the value but when I press the button to close the popup and pass the value nothing appears.
    I think that is because im Using MVC and Views that call a controller (like view inside views).
    I have in my main.htm this:
    <htmlb:form id     = "search"
                   method = "get" >
            <bsp:call url     = "search.do"
                      comp_id = "search" >
            </bsp:call>
    </htmlb:form>
    The code with the help values is in the search.htm(this the page associated with controller search.do)
    So Im thinking that my problem is because the form isnt in the SAME page than my inputField  and that is why im getting that error.  Can be this true ?
    And if it is,  how can I solve it?, I have several pieces of page with controllers and If I try to put the form tag in each "piece" I get an error that a button was left without a parent form tag, and I there isnt any button tag without form tag. So I think that another element tray, tabstrip or something require form tag also.
    I hope that I could explain my problem and someone can give me a hand.
    Can It be that this js statement
    document.getElementById("i_VKORG_low").value = fval;
    only works only if the form tag is in the same htm page, and cause I have teh form tag declared in the main.htm and the fieldtext i_VKORH_low in search.htm it doesnt works ?
    Thx
    EDIT: I cant post my javascript source code...dont know why I get an error from the forum that the post is not supported

    Hello,
    If I remember well, the MVC framework adds the comp_id of the bsp_call to all elements in the subcontroller.
    Try using:
    document.getElementById("search_i_VKORG_low");
    Regards,
    Tanguy

  • In interactive how to use AT LINE-SELECTION WITH SET PF-STATUS

    Hi all,
             I am developing an interactive report in which i am using gui status (pf-status ) for AT USER-COMMAND and AT LINE-SELECTION  event .But when i used at line-selection event is  not working with pf-status even though i use PICK function code .
    plz help me to work with both the event i.e.
    AT USER-COMMAND.
    AT LINE-SELECTION.
    Thanks a lot in Advance .
    Regards,
    Tarak

    hi,
      In PBO of Module Pool, Please Write in this way
    MODULE status_9001 OUTPUT.
    Set the PF-STATUS
      SET PF-STATUS '9001'.
    To Set the Title of Screen
      SET TITLEBAR 'TITLE'.
    ENDMODULE
    Setting PF status to the (SAP) system default
    set pf-status 'BASIC'.
    How to check for pf-status
    AT USER-COMMAND.
    CASE SY-UCOMM.
    WHEN 'ART'.
    PERFORM STYR_ARTSKONTI.
    WHEN 'PST'.
    PERFORM STYR_POSTER.
    WHEN 'BIL'.
    PERFORM VIS_BILAG.
    ENDCASE..

  • How to Use At line-Selection Functionality in dialog programming  or mpp .

    hi
    i had created customized Transaction ,
    in that  notification field is there , their when they  place notification number ,after that when they double click on that, it have to go to iw23 .(so that they will get confirm that notification  number is write  )
    i have tried to use AT LINE-SELECTION event it showing error ,
    where i have to write and which event i have to use ?
    may i know how can i resolve this ?
    Thanks a lot
    Edited by: raghu111 on Dec 3, 2011 6:14 AM

    hi  sharin.
    Thanks for ur reply
    i followed ur  steps 
    WHEN 'PICK'.
      DATA : dc_scrfield  TYPE zmotor-qmnum.
      GET CURSOR FIELD dc_scrfield.
      CHECK NOT dc_scrfield IS INITIAL.
      IF dc_scrfield = zmotor-qmnum.
        IF NOT zmotor-qmnum IS INITIAL .
          set PARAMETER ID 'IQM' FIELD zmotor-qmnum.
          call TRANSACTION 'IW23'.
        ENDIF. .
        ENDIF.
    its not working
    but i already tried like this .
    WHEN 'PICK'.
    if field name =tablename-fieldname
    set PARAMETER ID 'IQM' FIELD zmotor-qmnum
      call transaction 'IW23'
    endif
    i written in pai event ." i have dought here also whether i have to write here r not
    HERE ITS  WORKING BUT PROBLEM IS  FOR ANOTHER FIELDS ALSO ITS RESPONDING . how to stop the responding .
    as per my knowledge in condition only prob but i tried i didnt solve
    please send me one example or tell me how to solve
    for better understanding only i pasted coding
    thanks a lot
    Edited by: raghu111 on Dec 5, 2011 12:21 PM

  • How to use new line character?

    Hi,
    i am getting string value like this :
    name john company
    test1 position director sal
    45000
    i am getting this value in a string.
    i want to display the value like below :
    name john
    company test1
    position director
    sal 45000
    how to proceed on this ? can we use new line character here ? how can we use that? pls suggest me on this.
    Regards,
    Pavani

    Hi Friend,
    you can use the split method of String. to split that string base on space.
    for Example
         String st = "Jeetendra Kumar Choudhary";
         String[] string = st.split(" ");
         for (int j = 0; j < string.length; j++) {
              System.out.println(string[j]);
    By this way you can get the each word separately and you can concatenate it again in single string.if you need it.
    Regards
    Jeetendra.

  • How to use bezier lines or curves

    Can you use bezier lines or curves to make a graphic move?
    How do you create a bezier line or curve?

    Start with this tutorial by Kim Cavanaugh.
    http://www.communitymx.com/abstract.cfm?cid=A15CFD250F9D01EF
    alex
    yachtgeek wrote:
    >
    >
    > Can you use bezier lines or curves to make a graphic
    move? How do you create a bezier line or curve?

  • How to use command line with acrobat to extract page(s) from pdf file?

    I have adobe acrobat, and have a pdf file with over 500 pages. I need to extract small chunks of pages from it as seperate pdf files. I was hoping I could use command line interface to do this faster.
    Something like:
    acrobat src des start end
    so for example
    adobe file.pdf my_folder 3 5
    Is this possible? There are many chunks and I don't want to manually do it for every chunk. Command line would be much easier...
    Thanks

    I can't find any programs... sorry.
    Can you create one for me please.
    It should at least have these 5 arguments: (well the first one is not neccessary since were not using acrobat anymore...)
    [program] [src path/src file] [destination path/file name] [start page (inclusive)] [end page (inclusive)]
    for example:
    acrobat ./my_file.pdf ./my_folder/chunk1.pdf 3 5
    if start page == end page, then it only extracts that one page.
    So this way I can just stack these comands on a .bat file or something (maybe like 100 commands), then run the bat file, and it will create all the files.
    Thanks for doing this, it is appreciated.

  • How to use AT LINE-SELECTION and AT USER-COMMAND in one report????

    Dear all,
    I have a problem in reports I want to use AT USER-COMMAND.and AT LINE-SELECTION.both in the one report.
    But as soon as I use SET PF-STATUS my AT LINE-SELECTION event stop workingand only AT USER-COMMAND is working.
    How can I use both of them in one report for your reference I am giving my test program below.
    REPORT ZTEST111 .
    SET PF-STATUS '100'.
    DO 10 TIMES.
    WRITE:/ SY-INDEX.
    HIDE SY-INDEX.
    ENDDO.
    START-OF-SELECTION.
    AT LINE-SELECTION.
    MESSAGE I002(SY) WITH SY-INDEX.
    AT USER-COMMAND.
    MESSAGE I002(SY) WITH 'USER COMMAND'.
    END-OF-SELECTION.
    Thanks in advance
    Sachin Gautam

    hi
    Syntax
    AT USER-COMMAND.
    Effect
    This statement defines an event block whose event is triggered by the ABAP runtime environment if, during the display of a screen list, a function with a self-defined function code was chosen.
    Note
    Self-defined function codes are all those that include character combinations, except for the following:
    The function codes PICK and PF## ("##" stands for 01 to 24) do not cause the event AT USER-COMMAND, but the events AT LINE-SELECTION and AT PF##.
    All function codes that start with the character "%" are interpreted as system functions and do not cause the event AT USER-COMMAND. The system functions for lists are listed in the following table 1.
    The function codes in the following table 2, likewise, do not cause the event AT USER-COMMAND, but are handled by the list processor.
    Table 1
    Function code Function
    %CTX Call a context menu
    %EX Exit
    %PC Save to file
    %PRI Print
    %SC Search for ...
    %SC+ Find next
    %SL Search in office
    %ST Save to report tree
    Table 2
    Function code Function
    BACK Back
    P- Scroll to previous page
    P-- Scroll to first page
    P+ Scroll to next page
    P++ Scroll to last page
    PFILE name Store list lines in a text file named abap.lst in standard character representation in the standard directory of the application server. If a name is entered using name, this is converted to lowercase letters and used as the file name.
    PL- Scroll to first line of the page
    PL-n Scroll n lines back
    PL+ Scroll to last line of the page
    PL+n Scroll n lines up
    PNOP No effect
    PP- Scroll back one page
    PP-n Scroll n pages back
    PP+ Scroll one page forward
    PP+n Scroll n pages forwad
    PPn Scroll to beginning of page n
    PRI, PRINT Print
    PS-- Scroll to first column
    PS++ Scroll to last column
    PS- Scroll one column to the left
    PS-n Scroll n columns to the left
    PS+ Scroll one column to the right
    PS+n Scroll n columns to the right
    PSn Scroll to column n
    PZn Scroll to line n
    RW Cancel

  • How to use Documents & Data in the iCloud on my mac?

    Dear Sir,
    When you activate Documents & Data from System Preferences/iCloud it means that it can be stored and synced with my MAC.
    You can see this when you disable Documents & Data from System Preferences/iCloud, it says that (All Docments & Data Stored in my MAC will be deleted)
    So, there should be a folded that can store and sync my Documents & Data with iCloud.
    So, How?
    Or anyhow, how does it work?
    Thanks,
    Boudy,

    So, iCloud is just for upload and download.
    I even could not use the documents on the web. how come?
    is it just a place to upload and download only? It should be used as a device on the Web also. and it should be synced with my Mac or PC. In this way, It could be useful. But to upload a document to the web, then modify it by any IOS5, in this case I will have 2 versions, one in the could, and another in my mac, and i have to keep update with the new one. if i modify the one in my mac, i have to re-upload again before using the one in the cloud or i'll be using another old version. and if i modify the version in the cloud, i should re-download it to my mac before using the version which is already in my mac. it is really going terrible.
    I'm really disappointed from the iCould.
    It is just for mail, syncing contacts and iCal, Find my iPhone.
    iDisk and Photo Gallery was something unbelievable.
    Hope apple to keep iDisk & Photo Galley and to update the iCloud

  • How to use documents MS-Word-Excel and Pdf on iPhone 4S

    Before I bought the iPhone I was using Sony Ericson X1 Xperia. On this phone I could easily read & write  on documents MS-word/excel and transferred them from and to my PC with Windows 7.
    Till now I cannot find an easy way to transfer these documents onto my iPhone to edit, create or read. Have already installed iTunes, iCloud and one app numbers. Sofar no success to have it on my iPhone.
    I there sombody who could help me out.
    Thnks, Cor

    http://itunes.apple.com/us/app/quickoffice-pro/id310723177?mt=8

  • How to use document() function in PL/SQL XSLT parser ?

    The "XDB Developers Guide" documentation says on page 12-18
    >
    The application can use DBUriType objects:
    To make references, such as import or include, to related XSL stylesheets. You can encode these references within the XSL stylesheet itself.
    following this i added string like this to my stylesheet
    <xsl:apply-templates select="document('/ORADB/SCOTT/STYLESHEET_TAB/ROW[ID=1]/STYLESHEET/text()')" mode="include"/>
    <xsl:cinclude href="/ORADB/SCOTT/STYLESHEET_TAB/ROW[ID=1]/STYLESHEET/text()"/>
    But when XSLT processor reaches this, it fails.
    I also even tried like this
    <xsl:include href="/ORADB/SCOTT/STYLESHEET_TAB/ROW[ID=1]/STYLESHEET/text()"/>
    but result is the same ;(((
    Generally - is there ANY way XSLT processor can deal with stylesheet which contains
    DBURI references to another stylesheets stored in XMLTYPE columns ?
    I'm currently in charge to develop a content management system for a huge corporate site,
    so i'm VERY interested to know - does this feature really exists on Oracle 9.2 ?
    Please ansver ASAP.

    BTW: following this link
    xsl:include within XSL stylesheet stored in XMLType column
    i've encountered that this theme has been asked but none from Oracle staff has answered on it yet ;(((((((

  • How to use documents created from software on bootcamp, on my MBP at the same time?

    I have a MBP. Bootcamp was installed. VM Fusion also installed. Two industry unique software programs, one that plots legal descriptions in deeds and one that creates forms have been installed on the bootcamp side and I can acces them through VM Fusion, but when I receive documents in "ndp" format in an email I can't direct it to the application in bootcamp or on the windows side in order to open it. Any suggestions? Also, the forms program creates documents but I'd like to save them somewhere where I can access them from the Mac side. I'm new to this. I could use some help.
    Thanks.

    I do not know or have time right now to look up NDP format.
    To write to NTFS from Mac, you need a driver.
    And to write to HFS from Windows also.
    I strongly recommend Paragon drivers for both.
    That way you can access anything from any platform.
    Paragon Software for Mac

  • How to use documents like pictures, stored on content management in forms

    Hi,
    We store on content management as an attachment, and in relations with a marketing campaign, an image which represents the campaign. We developed a smartform which restores the data of the campaign and we want to insert the image about which I speak above. It seems that the documents stored on content management are not stored on a physical path but that they are it in cluster tables and thus I does not see how can I post this image in the smartform which we have to create. Thus I seek somebody who would have the solution of this problem.
    Best regards,
    Jean-Baptiste Butat

    I do not know or have time right now to look up NDP format.
    To write to NTFS from Mac, you need a driver.
    And to write to HFS from Windows also.
    I strongly recommend Paragon drivers for both.
    That way you can access anything from any platform.
    Paragon Software for Mac

  • How to use command line

    Hi All
    I want to create a Adobe Reader that when it startup will auto open a file.
    so I add this file to SYSDrive and modify startup command....I add a command line like @SYSDRIVE\test.pdf ,\Files\@SYSDRIVE\test.pdf or c:\test.pdf....
    but all testing will show error message~~
    about my purpose How ot set the "Command line" parameter ??
    thanks!!
    wyldkao

    Are you including the file with your virtualized app?

Maybe you are looking for