Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Can anyone tell me what has gone wrong in the code

Former Member
0 Kudos

*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

3 REPLIES 3

Former Member
0 Kudos

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

former_member583013
Active Contributor
0 Kudos

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

Greetings,

Blag.

0 Kudos

HAHAHAAHA