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

Problem with 'AC_DOCUMENT_RECORD' FM ...Urgent Please !!!!!

i call the following code and i take always the same DOCNR in my itab.The number is the first result that FM give to me .At the next lines i take the same result ....

    
   DATA : BEGIN OF ITAB OCCURS 0,
        BUKRS       LIKE ANEK-BUKRS,
        ANLN1       LIKE ANEK-ANLN1,
        ANLN2       LIKE ANEK-ANLN2,
        BELNR       LIKE ANEK-BELNR,
        GJAHR       LIKE ANEK-GJAHR,
        AWTYP       LIKE ANEK-AWTYP,
        AWORG       LIKE ANEK-AWORG,
        AWSYS       LIKE ANEK-AWSYS,
        DOCNR       LIKE ACC_DOC-DOCNR,
        ICON2       LIKE ICONS-L4,
        CELLCOLOR TYPE LVC_T_SCOL,
        SEL,
        END OF ITAB.
*************END MY BASIC ITAB *********************
DATA : INS TYPE TABLE OF ACC_DOC WITH HEADER LINE. "LIKE ACC_DOC OCCURS 0 WITH HEADER LINE. 
......
......
.......


   CLEAR ANEK.
    SELECT * FROM ANEK WHERE BUKRS IN SBUKRS
                       AND   ANLN1 IN SANLN1
                       AND   ANLN2 IN SANLN2
                       AND   GJAHR IN SGJAHR.
                      

    IF SY-SUBRC = 0.
        MOVE-CORRESPONDING ANEK TO ITAB.
    ENDIF.

    CALL FUNCTION 'AC_DOCUMENT_RECORD'
      EXPORTING
        I_AWTYP            =  ANEK-AWTYP
        I_AWREF            =  ANEK-BELNR
        I_AWORG            =  ANEK-AWORG
        I_AWSYS            =  ANEK-AWSYS
        I_AWTYP_INCL       = 'BKPF'
        I_AWTYP_EXCL       = ' '
        I_BUKRS            = ANEK-BUKRS
        I_VALUTYP          = '0'
        X_DIALOG           = ' '
     TABLES
        T_DOCUMENTS        = INS
*     EXCEPTIONS
*       NO_REFERENCE       = 1
*       NO_DOCUMENT        = 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.

<b>    MOVE INS-DOCNR TO ITAB-DOCNR.    " i take the same result always !!!!</b>

    CLEAR INS-DOCNR.

    APPEND ITAB.
    ENDSELECT.

Points will be rewarded !!!!!

Please help ....

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 06:42 AM

    thanks everyone ...

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 23, 2007 at 02:44 PM

    Try this.

    First Refresh the internal table t_documents.

    CLEAR ls_dialog.

    REFRESH t_documents.

    CALL FUNCTION 'AC_DOCUMENT_RECORD'

    EXPORTING

    i_awtyp = w_bkpf-awtyp

    i_awref = w_bkpf-awkey+0(10)

    i_aworg = w_bkpf-awkey+10(10)

    i_awsys = w_bkpf-awsys

    • I_AWTYP_INCL = ' '

    • I_AWTYP_EXCL = ' '

    i_bukrs = w_bkpf-bukrs

    • I_VALUTYP = '0'

    x_dialog = ls_dialog

    TABLES

    t_documents = t_documents

    EXCEPTIONS

    no_reference = 1

    no_document = 2

    OTHERS = 3

    Hope it can help you

    doryam

    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.