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

SELECT OPTIONS DATA OUTPUT

Former Member
0 Likes
817

Hi there,

I am using select-options in my program and I can't seem to get the output to show up for the individual selections I enter in the single values tab.

I am using the KNA1 table to output general data. See program below. Any help would be appreciated.

SELECT * FROM KNA1 WHERE KUNNR IN CUSTOMER.

I_UPDATE-CUSTOMER = KNA1-KUNNR.

I_UPDATE-NAME = KNA1-NAME1.

I_UPDATE-STREET = KNA1-STRAS.

I_UPDATE-CITY = KNA1-ORT01.

I_UPDATE-STATE = KNA1-REGIO.

I_UPDATE-ZIPCODE = KNA1-PSTLZ.

I_UPDATE-PHONE = KNA1-TELF1.

I_UPDATE-COUNTRY = KNA1-LAND1.

  • REP NUMBER AND REP-NAME FOR CUSTOMER(S) SELECTED.

SELECT single * FROM KNVP WHERE KUNNR = I_UPDATE-CUSTOMER AND

PARVW = 'Z4'.

I_UPDATE-REP = KNVP-PERNR.

SELECT single * FROM PA0002 WHERE PERNR = I_UPDATE-REP.

I_UPDATE-REPNAME = PA0002-NACHN.

  • CHECK TO SEE IF THE CUSTOMER HAS PLACED ANY ORDERS USING LIKP TABLE.

SELECT * FROM LIKP WHERE KUNNR = I_UPDATE-CUSTOMER.

I_UPDATE-SALESORD = LIKP-VBELN.

  • CHECK TO SEE IF THE CUSTOMER PURCHASED MOULDING/PHOTOFRAME/WALLDECOR/MIRRORS USING LIPS TABLE.

SELECT * FROM LIPS WHERE VBELN = I_UPDATE-SALESORD.

I_UPDATE-MATKL = LIPS-MATKL.

LOOP AT I_UPDATE.

WRITE: AT 20 I_UPDATE-CUSTOMER,

100 I_UPDATE-NAME,

135 I_UPDATE-STREET,

160 I_UPDATE-CITY,

180 I_UPDATE-STATE,

200 I_UPDATE-ZIPCODE,

210 I_UPDATE-COUNTRY,

215 I_UPDATE-PHONE,

310 I_UPDATE-REPNAME.

IF I_UPDATE-MATKL = 'MOULDINGS'.

WRITE: 345 'TRUE'.

ELSE.

WRITE: 345 'FALSE'.

ENDIF.

IF I_UPDATE-MATKL = 'PHOTO FRM'.

WRITE: 355 'TRUE'.

ELSE.

WRITE: 355 'FALSE'.

ENDIF.

IF I_UPDATE-MATKL = 'WALL DECO'.

WRITE: 365 'TRUE'.

ELSE.

WRITE: 365 'FALSE'.

ENDIF.

IF I_UPDATE-MATKL = 'MIRRORS'.

WRITE: 375 'TRUE'.

ELSE.

WRITE: 375 'FALSE'.

ENDIF.

ENDLOOP.

APPEND I_UPDATE.

ENDSELECT.

ENDSELECT.

ENDSELECT.

6 REPLIES 6
Read only

Former Member
0 Likes
790

*Remove bellow lines from your program and paste it at the bottom of your program (Bellow endselect).

LOOP AT I_UPDATE.

WRITE: AT 20 I_UPDATE-CUSTOMER,

100 I_UPDATE-NAME,

135 I_UPDATE-STREET,

160 I_UPDATE-CITY,

180 I_UPDATE-STATE,

200 I_UPDATE-ZIPCODE,

210 I_UPDATE-COUNTRY,

215 I_UPDATE-PHONE,

310 I_UPDATE-REPNAME.

IF I_UPDATE-MATKL = 'MOULDINGS'.

WRITE: 345 'TRUE'.

ELSE.

WRITE: 345 'FALSE'.

ENDIF.

IF I_UPDATE-MATKL = 'PHOTO FRM'.

WRITE: 355 'TRUE'.

ELSE.

WRITE: 355 'FALSE'.

ENDIF.

IF I_UPDATE-MATKL = 'WALL DECO'.

WRITE: 365 'TRUE'.

ELSE.

WRITE: 365 'FALSE'.

ENDIF.

IF I_UPDATE-MATKL = 'MIRRORS'.

WRITE: 375 'TRUE'.

ELSE.

WRITE: 375 'FALSE'.

ENDIF.

ENDLOOP.

Read only

0 Likes
790

I agree with ganesh.

please remove your loop endloop from select endselect as it is calling it again and again in select endselect because select endselect is itself a loop and you are looping loop in loop

good luck

HItesh

Read only

Former Member
0 Likes
790

Hi,

Try this.

Either use the select endselect or loop n endloop.

Since you are using both, it becomes loop inside a loop.

Sharin.

Read only

Former Member
0 Likes
790

Hi

Select ... Endselect is a loop itself. When you select the data from table you use three nesting select ..

endselect that means you use a three nesting loop. Check you program logic if it is correct. And when you

want output your selected data, you use loop statement. Also it should not write in the select... endselect.

Read only

Former Member
0 Likes
790

I have made the changes as per the suggestions offered but I still don't get the proper output. I enter two single values in the the multiple selection box and I only get output for one of the customers selected. I need both lines of data to show up in the output. Any other suggestions.

Thanks

Read only

Former Member
0 Likes
790

The reason that the code was outputting one line of data is because I did not have the / in the first line of the write statement.