Skip to Content
avatar image
Former Member

Scripting-Need Loop Help

Hi everyone!

I am trying to create a script to create a sales order (t-code VA01) with multiple line items.

My script code is using counter i to go down each row in excel to pull in the data (for each sales order),

but to create each line item within each sales order, i need it to read across a few columns so that i can make multiple line items.

Any ideas?


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    May 15, 2014 at 04:52 PM

    I am using vbscript

    Add comment
    10|10000 characters needed characters exceeded

  • May 17, 2014 at 08:08 AM

    Hello Christina,

    as far as I understand your problem correct, I think you need a loop in a loop.

    Look at these example:

    For i = 1 To RowCount

      'First code here to fill your fields

      For j = 1 To ColumnCount

        'Second code here to make your multiple line items

      Next j

    Next i

    Cheers

    Stefan

    Add comment
    10|10000 characters needed characters exceeded

  • May 25, 2014 at 05:46 PM

    Hi Christina,

    here's a little Example:

    For Example there are 4 Rows to navigate through:

    For i = 1 to 100 'only for example
    debug.Print xlssht.Cells(i,1).Value   '<- that is Cell "A1"
    debug.Print xlssht.Cells(i,2).Value   'Cell "B1"
    debug.Print xlssht.Cells(i,3).Value '... and so on  ...
    debug.print xlssht.Cells(i,4).value next i

    So if the first Loop is through you will enter the next Column 2

    Using the Cell property of Excel is much faster as the "Range" property...

    Add comment
    10|10000 characters needed characters exceeded