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

Can anyone tell me what has gone wrong in the code

*TABLE TYPE TO STORE CUSTOMER/DEALER AND DOCUMENT CATEGORY
TYPES:   BEGIN OF  TY_GET_ACCDOCU,
           BELNR   LIKE BKPF-BELNR,
           XBLNR   LIKE BKPF-XBLNR,
         END OF    TY_GET_ACCDOCU.

TYPES :  BEGIN OF  TY_GET_DEALER ,
           VBELN   LIKE LIKP-VBELN,
           KUNNR   LIKE LIKP-KUNNR,
           BWART   LIKE LIPS-BWART,
         END OF    TY_GET_DEALER.
*               XBLNR     TYPE BKPF-XBLNR,
*              KUNNR     TYPE LIKP-KUNNR,
*               VBTYP     TYPE LIKP-VBTYP,

*           END OF TY_GET_DEALER.


************************************************************************
*                    Data Definitions                                  *
*----------------------------------------------------------------------*
*Internal Table and work area decleration
DATA: T_GET_DEALER      TYPE STANDARD TABLE OF TY_GET_DEALER,
      WA_GET_DEALER     TYPE                   TY_GET_DEALER.

DATA:T_GET_ACCDOCU      TYPE STANDARD TABLE OF TY_GET_ACCDOCU,
     WA_GET_ACCDOCU     TYPE                   TY_GET_ACCDOCU.

*
*----------------------------------------------------------------------

* SELECTION-SCREEN DEFINITION
*-----------------------------------------------------------------------
*Selection screen  document date, Document Type and document number
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SKIP 2.
SELECT-OPTIONS:  S_DATE FOR  BKPF-BLDAT,
*                P_VGART LIKE MKPF-VGART,
                 S_BELNR FOR BKPF-BELNR.
PARAMETERS:  P_BLART LIKE BKPF-BLART DEFAULT 'WL' OBLIGATORY.

SELECTION-SCREEN END OF BLOCK b1.



* CHECK IF DATE IS INITIAL OR NOT.
IF NOT S_DATE IS INITIAL
   AND S_BELNR IS INITIAL.

    SELECT BELNR XBLNR INTO  TABLE T_GET_ACCDOCU " SELECTING THE ACCOUNT
                                                 " NUMBER AND REFERENCE
                                                 " NUMBER INTO TABLE

                        FROM  BKPF
                        WHERE BLDAT IN S_DATE
                        AND   BLART  = P_BLART.
*                        AND   WERKS = 'NA40'.
ENDIF.

*CHECK IF DATE IS INITIAL OR NOT

IF S_DATE IS INITIAL AND
   S_BELNR IS INITIAL.

    SELECT BELNR XBLNR INTO  TABLE T_GET_ACCDOCU " SELECTING THE ACCOUNT
                                                 " NUMBER AND REFERENCE
                                                 " NUMBER INTO TABLE

                   FROM  BKPF
                   WHERE BLART  =  P_BLART.
*                   AND   BUKRS = 'NA40'.

ENDIF.

*CHEK IF REFERNECE NUMBER IS INITAL OR NOT

IF NOT S_BELNR IS INITIAL
   AND S_DATE IS INITIAL.

    SELECT BELNR XBLNR INTO TABLE T_GET_ACCDOCU " SELECTING THE ACCOUNT
                                                " NUMBER AND REFERENCE
                                                " NUMBER INTO TABLE
                       FROM  BKPF
                       WHERE BLART =  P_BLART
                       AND   BELNR IN S_BELNR.
*                       AND   BUKRS = 'NA40'.

ENDIF.

* CHEK IF REFERNECE NUMBER IS INITAL OR NOT

IF NOT S_DATE  IS INITIAL AND
   NOT S_BELNR IS INITIAL.

     SELECT BELNR XBLNR INTO TABLE T_GET_ACCDOCU " SELECTING THE ACCOUNT

                                                " NUMBER AND REFERENCE
                                                " NUMBER INTO TABLE
                       FROM  BKPF
                       WHERE BLART  =  P_BLART
                       AND   BELNR  IN S_BELNR
                       AND   BLDAT  IN S_DATE.
*                       AND   WWERKS = 'NA40'.
ENDIF.




LOOP AT T_GET_ACCDOCU INTO WA_GET_ACCDOCU.

  WRITE :/ WA_GET_ACCDOCU-BELNR, 20 WA_GET_ACCDOCU-XBLNR.
ENDLOOP.


LOOP AT T_GET_ACCDOCU INTO WA_GET_ACCDOCU.

SELECT  VBELN KUNNR  INTO  WA_GET_DEALER
                     FROM  LIKP
                     WHERE VBELN = WA_GET_ACCDOCU-XBLNR
                    AND   VBTYP = 'J'.
APPEND WA_GET_DEALER TO T_GET_DEALER.
ENDSELECT.
ENDLOOP.

ULINE.

LOOP AT T_GET_DEALER INTO WA_GET_DEALER.

  WRITE:/ WA_GET_DEALER-VBELN, 20 WA_GET_DEALER-KUNNR.

ENDLOOP.

*IF NOT T_GET_DEALER IS INITIAL.
*
* SELECT BWART INTO WA_GET_DEALER
*              FROM LIPS
*              FOR ALL ENTRIES IN T_GET_DEALER
*              WHERE VBELN = WA_GET_DEALER-VBELN.
*
*ENDIF.

Is my code...

Here I cant use for all entries instead of select within loop..

When I try to use for all entries its giving a systax error...The where condition do not refer to for all entries table..

Please correct the code...

CHALLA

Title and Message was edited by:

Alvaro Tejada Galindo

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 10, 2007 at 07:23 PM

    Try:

    IF NOT T_GET_DEALER IS INITIAL.
    
      SELECT BWART INTO WA_GET_DEALER
        FROM LIPS
        FOR ALL ENTRIES IN T_GET_DEALER
        WHERE VBELN = T_GET_DEALER-VBELN.    "<=========
    

    Rob

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2007 at 08:52 PM

    Challa...There's no need to shout -;)

    Greetings,

    Blag.

    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.