2009 Mar 01 7:00 AM
Hi All
I have a program which gives a list of Customer no, Name and City. The 2nd Column is Customer column.
Requirement :
-
When I double click on a line in the Output it should give a pop-up giving the details about the customers bank details..
So my question is how should i use at line-selection in this case to get the desired output.
Here is my program .
-
REPORT ZASSIGN_IR1.
tables : kna1, knbk, bnka.
data : it_kna1 type kna1 occurs 0 with header line.
data : begin of it_bkdet occurs 0,
banka like bnka-banka,
banks like knbk-banks,
bankl like knbk-bankl,
bankn like knbk-bankn,
end of it_bkdet.
select-options : s_kunnr for kna1-kunnr.
select * into it_kna1 from kna1 where kunnr in s_kunnr.
append it_kna1.
endselect.
write:/ 'No.', 10'Customer', 24 'Name', 60 'City'.
write:/ sy-uline.
loop at it_kna1.
write:/ sy-tabix left-justified, it_kna1-kunnr, it_kna1-name1,
it_kna1-ort01.
endloop.
at line-selection.
select bnkabanka knbkbanks knbkbankl knbkbankn into table of it_bkdet
from knbk inner join bnka
on knbkbankl = bnkabankl
where knbk~kunnr = s_kunnr.
endselect.
loop at it_bkdet.
write 😕 it_bkdet-banka, it_bkdet-banks, it_bkdet-bankl, it_bkdet-bankn.
endloop.
-
Right now whenever am double clicking on any row in the output, a blank screen is displayed. Please help !!!
Edited by: Himanshu Bhusan Sahoo on Mar 1, 2009 8:00 AM
Edited by: Himanshu Bhusan Sahoo on Mar 1, 2009 8:03 AM
2009 Mar 02 5:19 AM
Hi,
1.Use the keyword HIDE on the filed on which you need to extract the data from the table.
2.use SY-LSIND = 1 in at line selection for valid selection of the line.
adding a code sniipet to help you out:
TABLES: ZLFA1,ZLFB1.
START-OF-SELECTION.
SELECT * FROM ZLFA1.
WRITE:/ ZLFA1-LIFNR,ZLFA1-LAND1,ZLFA1-NAME1,ZLFA1-NAME2,ZLFA1-ORT01.
HIDE: ZLFA1-LIFNR.
ENDSELECT.
END-OF-SELECTION.
CLEAR ZLFA1-LIFNR.
AT LINE-SELECTION.
CHECK SY-LSIND = 1.
CHECK NOT ZLFA1-LIFNR IS INITIAL.
WINDOW STARTING AT 10 4 ENDING AT 77 12.
WRITE:/ 'USER CLICKED ON ',SY-LISEL.
SELECT * FROM ZLFB1 WHERE LIFNR = ZLFA1-LIFNR.
WRITE:/ ZLFB1-LIFNR,ZLFB1-BUKRS.
ENDSELECT.
IF SY-SUBRC <> 0.
WRITE:/ 'NOT A VALID ENTRY'.
ENDIF.
CLEAR ZLFA1-LIFNR.Hope this might help you out.
Pooja
Hi,
1.Use the keyword HIDE on the filed on which you need to extract the data from the table.
2.use SY-LSIND = 1 in at line selection for valid selection of the line.
adding a code sniipet to help you out:
TABLES: ZLFA1,ZLFB1.
START-OF-SELECTION.
SELECT * FROM ZLFA1.
WRITE:/ ZLFA1-LIFNR,ZLFA1-LAND1,ZLFA1-NAME1,ZLFA1-NAME2,ZLFA1-ORT01.
HIDE: ZLFA1-LIFNR.
ENDSELECT.
END-OF-SELECTION.
CLEAR ZLFA1-LIFNR.
AT LINE-SELECTION.
CHECK SY-LSIND = 1.
CHECK NOT ZLFA1-LIFNR IS INITIAL.
WINDOW STARTING AT 10 4 ENDING AT 77 12.
WRITE:/ 'USER CLICKED ON ',SY-LISEL.
SELECT * FROM ZLFB1 WHERE LIFNR = ZLFA1-LIFNR.
WRITE:/ ZLFB1-LIFNR,ZLFB1-BUKRS.
ENDSELECT.
IF SY-SUBRC <> 0.
WRITE:/ 'NOT A VALID ENTRY'.
ENDIF.
CLEAR ZLFA1-LIFNR.Hope this might help you out.
Pooja
2009 Mar 01 7:10 AM
Hi,
Please Check the following Sample Code hope will solve out your problem,
DATA: BEGIN OF it OCCURS 5,
amount(20),
END OF it.
it-amount = 'AA'.
APPEND it TO it.
it-amount = '~D'.
APPEND it TO it.
it-amount = 'BB'.
APPEND it TO it.
it-amount = 'CC'.
APPEND it TO it.
it-amount = 'ZZ'.
APPEND it TO it.
SORT it BY amount.
LOOP AT it INTO it.
WRITE: / it-amount HOTSPOT ON.
HIDE it.
ENDLOOP.
AT LINE-SELECTION.
WINDOW STARTING AT 25 3 ENDING AT 103 25.
WRITE: it-amount.Please Reply if any issue,
Kind Regards,
Faisal
2009 Mar 01 8:30 AM
Hello,
YOu can use Hide statement.
When you are displaying your result. YOu needs to place Hide statement.
At line selection. you will all values in the same variable which you Hide.
for your understanding refer below piece of code.
report abc.
DATA NUMBER LIKE SY-INDEX.
START-OF-SELECTION.
DO 9 TIMES.
WRITE: / 'Row', (2) SY-INDEX.
NUMBER = SY-INDEX.
HIDE NUMBER.
ENDDO.
AT line selection.
CHECK NOT NUMBER IS INITIAL.
WRITE: / 'Cursor was in row', (2) NUMBER.
CLEAR NUMBER.
similarly, you can hide the customer number & at line selection you will custmer number with that you can get rest value.
2009 Mar 02 3:07 AM
Hi friend,
Your code is correct.
But do one change, it will exactly work.
Give 'in' operator instead of '=' in at line-selection because s_kunnr is 'select-options' not 'parameter'.
Your code:
at line-selection.
select bnkabanka knbkbanks knbkbankl knbkbankn into table of it_bkdet
from knbk inner join bnka
on knbkbankl = bnkabankl
where knbk~kunnr = s_kunnr. <----- (Use 'in' instead of '=' here, since s_kunnr is 'select-options')
endselect.
Will solve ur problem..
Thanks....
Edited by: Sap Fan on Mar 2, 2009 4:07 AM
2009 Mar 02 3:23 AM
Dear SAP Fan,
You response is correct and it will fix the issue.
Himanshu has to replace the operator '=' with in in the select query that he has used in his program.
Himanshu,
Please remember that whenever a selection field is used as a parameter , only then we use '=' in the select query.
If the selection field is used as a select-option, then we need to use 'in' as the operator.
Regards,
Thej.
2009 Mar 02 5:19 AM
Hi,
1.Use the keyword HIDE on the filed on which you need to extract the data from the table.
2.use SY-LSIND = 1 in at line selection for valid selection of the line.
adding a code sniipet to help you out:
TABLES: ZLFA1,ZLFB1.
START-OF-SELECTION.
SELECT * FROM ZLFA1.
WRITE:/ ZLFA1-LIFNR,ZLFA1-LAND1,ZLFA1-NAME1,ZLFA1-NAME2,ZLFA1-ORT01.
HIDE: ZLFA1-LIFNR.
ENDSELECT.
END-OF-SELECTION.
CLEAR ZLFA1-LIFNR.
AT LINE-SELECTION.
CHECK SY-LSIND = 1.
CHECK NOT ZLFA1-LIFNR IS INITIAL.
WINDOW STARTING AT 10 4 ENDING AT 77 12.
WRITE:/ 'USER CLICKED ON ',SY-LISEL.
SELECT * FROM ZLFB1 WHERE LIFNR = ZLFA1-LIFNR.
WRITE:/ ZLFB1-LIFNR,ZLFB1-BUKRS.
ENDSELECT.
IF SY-SUBRC <> 0.
WRITE:/ 'NOT A VALID ENTRY'.
ENDIF.
CLEAR ZLFA1-LIFNR.Hope this might help you out.
Pooja
2009 Mar 02 5:26 AM
Hi,
at line-selection.
case sy-lsind.
when '1'.
perform display_lsind_2.
when '2'.
perform display_lsind_3.
endcase.
Thanks,
Krishna...
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |