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: 

select querry failing

Former Member
0 Kudos
111

Hi Friends,

I am writing a subroutine in scripts.

I want to get data from vbrk-vbeln->vbfa>vbelv->vbak->vbeln->konv->knumv.

my input is VBDKR-VBELN.

My select querry is failing.

can any code this and help me out in this.

Regards,

Venu

1 ACCEPTED SOLUTION

Former Member
0 Kudos
73

Hi,

Try this..

DATA: V_VBELN LIKE VBAK-VBELN.

SELECT VBELV UP TO 1 ROWS

INTO V_VBELN

FROM VBFA

WHERE VBELN = VBDKR-VBELN

AND VBTYP_V = 'C'.

ENDSELECT.

TABLES: VBAK.

SELECT SINGLE * FROM

VBAK

WHERE VBELN = V_VBELN.

DATA: T_KONV LIKE KONV OCCURS 0 WITH HEADER LINE.

SELECT * FROM KONV

INTO TABLE T_KONV

WHERE KNUMV = VBAK-KNUMV.

Thanks,

Naren

7 REPLIES 7

Former Member
0 Kudos
74

Hi,

Try this..

DATA: V_VBELN LIKE VBAK-VBELN.

SELECT VBELV UP TO 1 ROWS

INTO V_VBELN

FROM VBFA

WHERE VBELN = VBDKR-VBELN

AND VBTYP_V = 'C'.

ENDSELECT.

TABLES: VBAK.

SELECT SINGLE * FROM

VBAK

WHERE VBELN = V_VBELN.

DATA: T_KONV LIKE KONV OCCURS 0 WITH HEADER LINE.

SELECT * FROM KONV

INTO TABLE T_KONV

WHERE KNUMV = VBAK-KNUMV.

Thanks,

Naren

0 Kudos
73

Hi Naren,

Now I have data in three internal tables, can U tell me how to append the data to the internal and call in form.

Thanx in advance,

Venu.

Former Member
0 Kudos
73

Hi,

Please explain what is "how to append the data to the internal and call in form"..

Thanks,

Naren

0 Kudos
73

Hi Naren,

This my code, and data is in all the three internal table I want to pass the data to the form through Subroutine, Can you tell me how to do it.

DATA : BEGIN OF IT_VBRP OCCURS 0,

VBELN LIKE VBRP-VBELN,

VRKME LIKE VBRP-VRKME,

END OF IT_VBRP.

DATA : BEGIN OF IT_VBFA OCCURS 0,

VBELN LIKE VBFA-VBELN,

VBELV LIKE VBFA-VBELV,

END OF IT_VBFA.

DATA : BEGIN OF IT_VBAK OCCURS 0,

VBELN LIKE VBAK-VBELN,

VKBUR LIKE VBAK-VKBUR,

VKGRP LIKE VBAK-VKGRP,

KNUMV LIKE VBAK-KNUMV,

END OF IT_VBAK.

DATA : BEGIN OF IT_KONV OCCURS 0,

KBETR LIKE KONV-KBETR,

END OF IT_KONV.

DATA : IVBELN TYPE VBRK-VBELN.

DATA : OVBELN TYPE VBRK-VBELN.

READ TABLE INPUT WITH KEY 'VBDKR-VBELN'.

IVBELN = INPUT-VALUE.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = IVBELN

IMPORTING

OUTPUT = OVBELN.

SELECT SINGLE VBELN VRKME FROM VBRP INTO IT_VBRP

WHERE VBELN = OVBELN.

IF SY-SUBRC EQ 0.

SELECT SINGLE VBELN VBELV FROM VBFA INTO IT_VBFA

WHERE VBELN = IT_VBRP-VBELN

AND VBTYP_N = 'M'.

ENDIF.

IF SY-SUBRC = 0.

SELECT SINGLE VBELN VKBUR VKGRP KNUMV FROM VBAK INTO IT_VBAK

WHERE VBELN = IT_VBFA-VBELV.

ENDIF.

Thanx in advance,

Venu.

Former Member
0 Kudos
73

Hi,

PERFORM FORM1 TABLES IT_VBRP

IT_VBFA

IT_VBAK.

FORM FORM1 TABLES PT_VBRP

PT_VBFA

PT_VBAK.

ENDFORM.

Is this what you want..

THanks,

Naren

0 Kudos
73

No Naren,

I am having the values in the itabs I want to pass this to final itab in the subroutine, Can I do this in subroutines and how to pass these values in form.

Thanx in advance,

Venu.

Former Member
0 Kudos
73

Hi,

Do you want to call this subroutine from the sapscript form..Correct??

But in the sap script form you can pass only single parameters and not an internal table..

Thanks,

Naren