Skip to Content
author's profile photo Former Member
Former Member

PROBLEM AT LOOP

Hi

I'm facing a problem for a loop condition. Actually my requirement is to send an mail before two days to a user so for that it have to check the number of documents and it should send the data for that particular person with all document numbers

select BUDAT BELNR GJAHR BUKRS from BKPF into
corresponding fields of  int_BKPF
where bukrs = 'GSEG' and
      BELNR = INT_BSEG-BELNR.


  lv_date1 = int_bkpf-budat.
  var4 = lv_date1+(4).
  var5 = lv_date1+4(2).
  var6 = lv_date1+6(2).

concatenate var6 var5 var4 into lv_formatdate1 separated by '.'.

endselect.

if int_bseg-belnr = int_bkpf-belnr.


read table int_bseg .

   loop at int_bseg.

   int_bseg-belnr = int_bkpf-belnr.
  it_message1 =  lv_formatdate1.

  append int_bseg.

 endloop.
endif.

<b>By using this code i'm getting the document number of last document but i want to get the details of all document numbers. Actually problem is the statement is not executed i mean after reading loop condition it is directly skipping to the next statement</b>

i have tried all possible conditions of loop as follows

loop at int_bseg into it_message.

Regards

Pavan

Message was edited by:

Pavan praveen

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 29, 2007 at 07:52 AM

    Hi Pavan

    Sorry i wan not able to understand your issue completely , could you please illustarate a bit more.

    One more observation , why have you used the statemnt

    <b>read table int_bseg .</b>

    Before the loop endloop.

    Regards

    Arun

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 29, 2007 at 07:52 AM

    HI,

    select BUDAT BELNR GJAHR BUKRS from BKPF into

    corresponding fields of int_BKPF

    where bukrs = 'GSEG' and

    BELNR = INT_BSEG-BELNR.

    lv_date1 = int_bkpf-budat.

    var4 = lv_date1+(4).

    var5 = lv_date1+4(2).

    var6 = lv_date1+6(2).

    <b>append int_BKPF.</b>

    concatenate var6 var5 var4 into lv_formatdate1 separated by '.'.

    endselect.

    Regards,

    Sesh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 29, 2007 at 07:56 AM

    read table int_bseg with key feilds -


    primary keys

    thnkx

    bhanu

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 29, 2007 at 07:57 AM

    Hi,

    R u trying for this

    select BUDAT BELNR GJAHR BUKRS from BKPF into

    corresponding fields of int_BKPF

    where bukrs = 'GSEG' and

    BELNR = INT_BSEG-BELNR.

    lv_date1 = int_bkpf-budat.

    var4 = lv_date1+(4).

    var5 = lv_date1+4(2).

    var6 = lv_date1+6(2).

    concatenate var6 var5 var4 into lv_formatdate1 separated by '.'.

    loop at int_bseg where belnr = int_bkpf-belnr.

    it_message1 = lv_formatdate1.

    append int_bseg.

    endloop.

    endselect.

    Regards,

    Sesh

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi pavan,

      Problem is there in ur select stmts.

      1. select zuonr belnr from bseg into

      corresponding fields of int_bseg

      where bukrs = 'GSEG' and

      ZUONR = lv_formatdate.

      endselect.

      Instead of above write:

      select zuonr belnr from bseg into

      <b>corresponding fields of table int_bseg</b>

      where bukrs = 'GSEG' and

      ZUONR = lv_formatdate.

      2. select BUDAT BELNR GJAHR BUKRS from BKPF into

      corresponding fields of int_BKPF

      where bukrs = 'GSEG' and

      BELNR = INT_BSEG-BELNR.

      Instead of above write:

      select BUDAT BELNR GJAHR BUKRS from BKPF into

      corresponding fields of table int_BKPF

      <b>FOR ALL ENTRIES IN int_bseg</b>

      where bukrs = 'GSEG' and

      BELNR = INT_BSEG-BELNR.

      Regards,

      Preethi.

  • author's profile photo Former Member
    Former Member
    Posted on Jun 29, 2007 at 09:06 AM

    Hi,

    Try this,

    loop at int_bseg.

    read table int_bseg .

    if sy-subrc = 0.

    int_bseg-belnr = int_bkpf-belnr.

    it_message1 = lv_formatdate1.

    endif.

    append int_bseg.

    endloop.

    regards,

    Shivakumar Kanti.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 18, 2007 at 11:40 AM

    solved by my own

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.