Application Development and Automation 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: 
Read only

ABAP Code

Former Member
0 Likes
461

Hi ,

Please see my code

SELECT land1 adrnr

FROM vbpa INTO (lf_land1 , lf_adrnr)

WHERE vbeln = l_likps_wa-vgbel AND

parvw = 'WE' AND

land1 IN im_land1 AND

posnr = '000000'.

IF sy-subrc <> 0.

SELECT land1 adrnr

FROM vbpa INTO (lf_land1 , lf_adrnr)

WHERE vbeln = l_likps_wa-vbeln AND

parvw = 'WE' AND

land1 IN im_land1 AND

posnr = '000000'.

ENDSELECT.

ENDIF.

ENDSELECT.

I tried to debug it ....the cursor is just jumping from select to endselect after the first select is sy-subrc = 4.

I tried commenting each part of the where condition ...

the problem is with the

<b> land1 IN im_land1 AND</b>

here im_land1 is comming from the selection screen.

what can I do to avoid this?

please help ASAP

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
432

Hi

U've to place the second SELECT out of the first one, because if it fails the system'll not run the code beetween SELECT/ENDSELECT.

SELECT land1 adrnr FROM vbpa INTO (lf_land1 , lf_adrnr)
                                                  WHERE vbeln = l_likps_wa-vgbel AND
                                                               parvw = 'WE' AND
                                                               land1 IN im_land1 AND
                                                              posnr = '000000'.
*  IF sy-subrc <> 0.
*
*    SELECT land1 adrnr
*    FROM vbpa INTO (lf_land1 , lf_adrnr)
*    WHERE vbeln = l_likps_wa-vbeln AND
*    parvw = 'WE' AND
*    land1 IN im_land1 AND
*    posnr = '000000'.
*    ENDSELECT.
*
*  ENDIF.
ENDSELECT.
IF sy-subrc <> 0.
  SELECT land1 adrnr FROM vbpa INTO (lf_land1 , lf_adrnr)
                                                    WHERE vbeln = l_likps_wa-vbeln AND
                                                                 parvw = 'WE' AND
                                                                 land1 IN im_land1 AND
                                                                 posnr = '000000'.
  ENDSELECT.

ENDIF.

Max

3 REPLIES 3
Read only

Former Member
0 Likes
432

Hi

Give in the select option Land1 the correct entry then execute. May be with the country u r giving u dont have data in the database table and also check with the other condition which u gave with and option, check in the database table by giving these 2 values whether u have entries with these two values.

Regards

Haritha.

Read only

0 Likes
432

If I don't have data ...I should see the cursor going to the next select..I can't...that is what is my problem

Message was edited by:

ramana peddu

Read only

Former Member
0 Likes
433

Hi

U've to place the second SELECT out of the first one, because if it fails the system'll not run the code beetween SELECT/ENDSELECT.

SELECT land1 adrnr FROM vbpa INTO (lf_land1 , lf_adrnr)
                                                  WHERE vbeln = l_likps_wa-vgbel AND
                                                               parvw = 'WE' AND
                                                               land1 IN im_land1 AND
                                                              posnr = '000000'.
*  IF sy-subrc <> 0.
*
*    SELECT land1 adrnr
*    FROM vbpa INTO (lf_land1 , lf_adrnr)
*    WHERE vbeln = l_likps_wa-vbeln AND
*    parvw = 'WE' AND
*    land1 IN im_land1 AND
*    posnr = '000000'.
*    ENDSELECT.
*
*  ENDIF.
ENDSELECT.
IF sy-subrc <> 0.
  SELECT land1 adrnr FROM vbpa INTO (lf_land1 , lf_adrnr)
                                                    WHERE vbeln = l_likps_wa-vbeln AND
                                                                 parvw = 'WE' AND
                                                                 land1 IN im_land1 AND
                                                                 posnr = '000000'.
  ENDSELECT.

ENDIF.

Max