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: 

Fastest way to run the SAP query Infoset

Former Member
0 Kudos

I get runtime error with below code, can anyone suggest fastest output. Same logic as below: Thanks in advanced!

TABLES: LIPS.

SELECT SINGLE *
  FROM LIPS
  WHERE VGBEL = EKPO-EBELN
  AND   VGPOS = EKPO-EBELP
  AND   MATNR = EKPO-MATNR.

IF SY-SUBRC = 0.
  DELIVERY = LIPS-VBELN.
  STORLOC  = LIPS-LGORT.
  CREATED_BY_DELIV = LIPS-ERNAM.
  CREATED_DAY_DELIV = LIPS-ERDAT.
ELSE.
  DELIVERY = ' '.
  STORLOC  = ' '.
  CREATED_BY_DELIV = ' '.
  CREATED_DAY_DELIV = ' '.
ENDIF.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

Pls try the below code


SELECT SINGLE  VBELN LGORT ERNAM ERDAT
        INTO (DELIVERY,  STORLOC, CREATED_BY_DELIV,  CREATED_DAY_DELIV )
  FROM LIPS
  WHERE VGBEL = EKPO-EBELN
  AND   VGPOS = EKPO-EBELP
  AND   MATNR = EKPO-MATNR.

Regards

MD

Code Formatted by: Alvaro Tejada Galindo on Jan 4, 2010 5:49 PM

14 REPLIES 14

Former Member
0 Kudos

Hi

Pls try the below code


SELECT SINGLE  VBELN LGORT ERNAM ERDAT
        INTO (DELIVERY,  STORLOC, CREATED_BY_DELIV,  CREATED_DAY_DELIV )
  FROM LIPS
  WHERE VGBEL = EKPO-EBELN
  AND   VGPOS = EKPO-EBELP
  AND   MATNR = EKPO-MATNR.

Regards

MD

Code Formatted by: Alvaro Tejada Galindo on Jan 4, 2010 5:49 PM

0 Kudos

I'm still getting runtime error...

0 Kudos

Hi

Can you pls let me know, what is the error message you are getting

Regards

MD

0 Kudos

maximum time exceeded...

0 Kudos

Hi

Try to access the table with key fields

VBELN and POSNR

and also make sure

VBELN,POSNR,VGBEL,VGPOS,MATNR

is in the same sequence in LIPS table, else

change the where sequence


Selection screen : VBELN FOR LIPS-VBELN NO-DISPLAY,
                            POSNR FOR LIPS-POSNR NO-DISPLAY.
                     
TABLES: LIPS.
 
SELECT SINGLE VBELN LGORT ERNAM ERDAT
INTO (DELIVERY, STORLOC, CREATED_BY_DELIV, CREATED_DAY_DELIV )
FROM LIPS
WHERE 
VBELN IN VBELN AND
POSNR IN POSNR AND
VGBEL = EKPO-EBELN
AND VGPOS = EKPO-EBELP
AND MATNR = EKPO-MATNR.

Regards

MD

Edited by: Madhan Doraikannan on Sep 25, 2008 1:56 PM

Code Formatted by: Alvaro Tejada Galindo on Jan 4, 2010 5:50 PM

0 Kudos

Try to access the table with key fields

VBELN and POSNR

i cant do that because as you can see table EKKO/EKPO has no direct connection(key field) to LIPS/LIKP.

and also make sure

VBELN,POSNR,VGBEL,VGPOS,MATNR

is in the same sequence in LIPS table, else

change the where sequence

ill try this

Selection screen : VBELN FOR LIPS-VBELN NO-DISPLAY,

POSNR FOR LIPS-POSNR NO-DISPLAY.

not a requirements

0 Kudos

Hi

i cant do that because as you can see table EKKO/EKPO has no direct connection(key field) to LIPS/LIKP.

If you do not use Key fields in the select query performance will be slow.

If you donot want to use, than you see whether VGBEL,VGPOS,MATNR is in sequence

Regards

MD

0 Kudos

Hi

And also

keep a break-point at check whether

EKPO-EBELN

EKPO-EBELP

EKPO-MATNR.

is having value

Regards

MD

0 Kudos

Anymore suggestions people? Thanks!

0 Kudos

Thanks to all who replied! I already got the right solution..

I just have to link EKPO to EKES then EKES to LIPS and it is working very well!

Thank you again! Until my next inquiry!

0 Kudos

Hi Jay

I have also got the same problem as above , i have also used the same technique which you mentioned ie connecting EKKO TO EKES and then to LIPS .

But EKES is not having some PO No( EBELN ) but where as LIPS should select fields for that EBELN .


IF GT_EKPO IS NOT INITIAL.
SELECT *
             FROM ekes INTO TABLE gt_ekes1 FOR ALL ENTRIES IN gt_ekpo
                         WHERE ebeln = gt_ekpo-ebeln AND
                                     ebelp = gt_ekpo-ebelp .
IF NOT GT_EKES IS INITIAL.
SELECT *
           FROM lips  INTO TABLE gt_lips FOR ALL ENTRIES IN
                             gt_ekes1 WHERE vbeln = gt_ekes1-vbeln
                                                and   posnr = gt_ekes1-vbelp .
ENDIF.
ENDIF.

Please help me if you have any solution.

Code Formatted by: Alvaro Tejada Galindo on Jan 4, 2010 5:51 PM

former_member182426
Active Contributor
0 Kudos

hi jai,

in tables statement include the table name EKPO also.

Like this.

TABLES: LIPS, EKPO.

Regards,

Shankar.

0 Kudos

It is already in the fields so i dont need to include it... Besides it will display an error when I do...

Former Member
0 Kudos

See if you can use the Sales Document Flow table - VBFA.

Rob