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: 

change to select single

Former Member
0 Kudos

HI,

what is the Best way to converse this select to select single

and remove the line AND posnr EQ '00010' .

Regards



    SELECT  vbeln  kvgr3                  "change this to select single
    FROM vbrp INTO CORRESPONDING FIELDS OF TABLE sdprojectinvoice
    FOR ALL ENTRIES IN l_sdproj
    WHERE vbeln = l_sdproj-vbeln
    AND posnr EQ '00010'                 " remove this 
    AND ps_psp_pnr = l_project.

1 ACCEPTED SOLUTION

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try this.


SELECT  SINGLE VBELN KVGR3
INTO (VBRP-VBELN, VBRP-KVGR3)
FROM VBRP
FOR ALL ENTRIES IN L_SDPROJ
WHERE VBELN = L_SDPROJ-VBELN
      AND PS_PSP_PNR = L_PROJECT.


MOVE VBRP-VBELN TO <...>.
MOVE VBRP-KVGR3 TO <...>.

Regards,

Ferry Lianto

5 REPLIES 5

former_member386202
Active Contributor
0 Kudos

Hi,

Loop on l_sdproj and within this loop

use select single SELECT vbeln kvgr3 WHERE vbeln = l_sdproj-vbeln

Regards,

Prashant

former_member404244
Active Contributor
0 Kudos

Hi,

try like this

Loop on l_sdproj .

SELECT single vbeln kvgr3

FROM vbrp INTO (v_vbeln, v_kvgr3)

WHERE vbeln = l_sdproj-vbeln

AND ps_psp_pnr = l_project.

endloop.

It will retrieve the first reocrd from the table..

Reward if helpful.

Regards,

Nagaraj

Former Member
0 Kudos

Hi,

Give the when u r writing the select single statement you have to give conditions for the primary keys fields.

reward points if it helps.

Former Member
0 Kudos

HI

SELECT SINGLE vbeln kvgr3 "change this to select single

FROM vbrp INTO sdprojectinvoice

FOR ALL ENTRIES IN l_sdproj

WHERE vbeln = l_sdproj-vbeln

AND posnr EQ '00010' " remove this

AND ps_psp_pnr = l_project.

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try this.


SELECT  SINGLE VBELN KVGR3
INTO (VBRP-VBELN, VBRP-KVGR3)
FROM VBRP
FOR ALL ENTRIES IN L_SDPROJ
WHERE VBELN = L_SDPROJ-VBELN
      AND PS_PSP_PNR = L_PROJECT.


MOVE VBRP-VBELN TO <...>.
MOVE VBRP-KVGR3 TO <...>.

Regards,

Ferry Lianto