Skip to Content
0
Former Member
Sep 10, 2007 at 07:21 PM

Can anyone tell me what has gone wrong in the code

14 Views

*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