2007 May 17 8:44 PM
In the basic list I put this code and it's returning me wrong values in the First Detail List .
select kunnr
name1
land1
from kna1 into table itab.
loop at itab.
write:/10 itab-kunnr,
35 itab-name1,
70 itab-land1.
get cursor field itab-kunnr.
hide itab-kunnr.
2007 May 17 11:09 PM
Hi,
Please make sure to reward points for helpful answers..
Also next time..Please open a new thread for each question..
Thanks,
Naren
2007 May 17 8:47 PM
you dont have to put
- get cursor field itab-kunnr. in side the loop.
this statement can be put after at-line selection..
2007 May 17 8:47 PM
2007 May 17 8:52 PM
Here's the code
select kunnr
name1
land1
from kna1 into table itab.
loop at itab.
write:/10 itab-kunnr,
35 itab-name1,
70 itab-land1.
hide itab-kunnr.
endloop.
*&---------------------------------------------------------------------*
*& selecting and display data for detail list *
*&---------------------------------------------------------------------*
at line-selection.
case sy-lsind.
when '1'.
select vbeln
erdat
netwr
from vbak into table jtab where kunnr = itab-kunnr.
if sy-subrc ne 0.
message e000(zmessage).
endif.
loop at jtab.
write:/10 jtab-vbeln,
35 jtab-erdat,
70 jtab-netwr.
at last.
sum.
write:/ 'Sub total:', jtab-netwr color 3.
endat.
hide jtab-vbeln.
endloop.
Now where should i put get cursor statement
2007 May 17 8:47 PM
HI,
check the sample code
DATA: CURSORFIELD(20),
GLOB_FIELD(20) VALUE 'global field',
REF_PARAMETER(30) VALUE 'parameter by reference',
VAL_PARAMETER(30) VALUE 'parameter by value',
FIELD_SYMBOL(20) VALUE 'field symbol'.
FIELD-SYMBOLS: <F> TYPE ANY.
PERFORM WRITE_LIST USING REF_PARAMETER VAL_PARAMETER.
ASSIGN GLOB_FIELD TO <F>.
AT LINE-SELECTION.
GET CURSOR FIELD CURSORFIELD.
WRITE: / CURSORFIELD, SY-SUBRC.
FORM WRITE_LIST USING RP VALUE(VP).
DATA: LOK_FIELD(20) VALUE 'local field'.
ASSIGN FIELD_SYMBOL TO <F>.
WRITE: / GLOB_FIELD, / LOC_FIELD,
/ RP, / VP,
/ 'literal', / FIELD_SYMBOL.
ENDFORM.
can u elaborate which wrong values u r getting?
Regards
SAB
2007 May 17 8:50 PM
sample code..
loop at itab.
write:/10 itab-kunnr,
35 itab-name1,
70 itab-land1.
get cursor field itab-kunnr.
hide itab-kunnr.
endloop.
AT LINE-SELECTION.
GET CURSOR FIELD G_CURFLD.
IF NOT G_CURFLD IS INITIAL.
case G_CURfld.
WHEN 'KUNNR'.
whatever you want to do further with this..
2007 May 17 8:58 PM
I think you are trying to:
REPORT ztest MESSAGE-ID 00.
DATA itab LIKE TABLE OF kna1 WITH HEADER LINE.
DATA u_kunnr LIKE kna1-kunnr.
SELECT *
FROM kna1 UP TO 10 ROWS
INTO CORRESPONDING FIELDS OF TABLE itab.
SORT itab BY kunnr.
LOOP AT itab.
WRITE:/10 itab-kunnr,
35 itab-name1,
70 itab-land1.
u_kunnr = itab-kunnr.
HIDE u_kunnr.
CLEAR u_kunnr.
ENDLOOP.
AT LINE-SELECTION.
READ TABLE itab WITH KEY kunnr = u_kunnr BINARY SEARCH.
WRITE: /001 itab-kunnr,
035 itab-name1,
070 itab-name2,
105 itab-land1.
Rob
2007 May 17 9:16 PM
Hi,
<u><b>GET CURSOR</b></u>
Use the statements GET CURSOR FIELD and GET CURSOR LINE to pass the output
field or output line on which the cursor was positioned during the interactive event to the
ABAP program.
Check the following example program:
REPORT SAPMZTST NO STANDARD PAGE HEADING LINE-SIZE 40.
DATA: HOTSPOT(10) VALUE 'Click me!',
F(10), OFF TYPE I, LIN TYPE I, VAL(40), LEN TYPE I.
FIELD-SYMBOLS <FS>.
ASSIGN HOTSPOT TO <FS>.
WRITE 'Demonstration of GET CURSOR statement'.
SKIP TO LINE 4.
POSITION 20.
WRITE <FS> HOTSPOT COLOR 5 INVERSE ON.
AT LINE-SELECTION.
WINDOW STARTING AT 5 6 ENDING AT 45 20.
GET CURSOR FIELD F OFFSET OFF
LINE LIN VALUE VAL LENGTH LEN.
WRITE: 'Result of GET CURSOR FIELD: '.
ULINE AT /(28).
WRITE: / 'Field: ', F,
/ 'Offset:', OFF,
/ 'Line: ', LIN,
/ 'Value: ', (10) VAL,
/ 'Length:', LEN.
SKIP.
GET CURSOR LINE LIN OFFSET OFF VALUE VAL LENGTH LEN.
WRITE: 'Result of GET CURSOR LINE: '.
ULINE AT /(27).
WRITE: / 'Offset:', OFF,
/ 'Value: ', VAL,
/ 'Length:', LEN.
In this program, the HOTSPOT field is assigned to the field symbol <FS> and
displayed as hotspot on the output screen. If the user positions the cursor on a list
line and selects it, a dialog box appears containing the results of the GET CURSOR
statements in the AT LINE-SELECTION event.
Note that after GET CURSOR FIELD, the name of the field assigned to the field
symbol <FS> is stored in F, and not the name of the field symbol.
Regards,
Bhaskar
2007 May 17 9:20 PM
hi..
IN CASE STATEMENT.
when '1'.
get cursor field fnam value fval.
pass this fval to the select statement in the where condition.
This works.
regards,
kamal
2007 May 17 9:53 PM
In the basic list if i click any customer , orders details of that customer should be displayed in the details list.
I am able to perform this.
But it should only happen if i click on kunnr (not on name,country)...
I need to Get cursor...
Having problem in achieving the result with that.
Help me in fixing this
2007 May 17 10:13 PM
Hi,
Try this..Changes marked with in comment..
when '1'.
*********Naren insert Begin:
CHECK sy-cucol >= 2 AND sy-cucol <= 11. " Insert this code..
*********Naren insert End.
select vbeln
erdat
netwr
from vbak into table jtab where kunnr = itab-kunnr.
if sy-subrc ne 0.
message e000(zmessage).
endif.
Thanks,
Naren
2007 May 17 10:16 PM
2007 May 17 10:20 PM
Hi,
Yes..You can achieve with GET CURSOR also..
Check this..
when '1'.
*********Naren insert Begin:
DATA: v_field(60). " Insert this code.
GET CURSOR FIELD v_field. " Insert this code.
CHECK v_field = 'ITAB-KUNNR'. " Insert this code.
*********Naren insert End.
select vbeln
erdat
netwr
from vbak into table jtab where kunnr = itab-kunnr.
if sy-subrc ne 0.
message e000(zmessage).
endif.
Thanks,
Naren
2007 May 17 10:26 PM
Thanx Naren. I got the result.
Could you explain me the logic of the code we inserted.
2007 May 17 10:34 PM
Hi,
Explaination above before each line
The above is the data declaration to get the field name..
DATA: v_field(60). " Insert this code.
Get the field name using the get cursor statement..
GET CURSOR FIELD v_field. " Insert this code.
Check whether the field name got is customer "ITAB-KUNNR".
CHECK v_field = 'ITAB-KUNNR'. " Insert this code.
Hope this helps..
Thanks,
Naren
2007 May 17 10:39 PM
One more quick question
I developed a interactive report.
For the basic list, 1st detail list I was able to trigger top-of-page.
for the second detail I could'nt do it.
(top-of-page during line-selection was used for the 1st detail list)
2007 May 17 10:42 PM
Hi,
For second list also you can use TOP-OF-PAGE DURING LINE-SELECTION event..
Check this ex..
WRITE: / 'Test'.
TOP-OF-PAGE.
WRITE: / 'top-of-page'.
TOP-OF-PAGE DURING LINE-SELECTION.
WRITE: / 'top-of-page during line selection'.
AT LINE-SELECTION.
WRITE: / sy-lsind.
Thanks,
Naren
2007 May 17 10:44 PM
If you use top-of-page during line-selection I am getting both page heading in the 1st detail list itself.
2007 May 17 10:49 PM
Hi,
I checked my example..Only one page heading is coming..
Post your TOP-OF-PAGE and TOP-OF-PAGE DURING LINE SELECTION code..
I will check.
Thanks,
Naren
P.S. Please make sure to reward points for helpful answers..
2007 May 17 10:57 PM
*&---------------------------------------------------------------------*
*& data declaration *
*&---------------------------------------------------------------------*
tables: kna1,
vbak,
vbap.
data: begin of itab occurs 0,
kunnr type kna1-kunnr,
name1 type kna1-name1,
land1 type kna1-land1,
end of itab.
data: begin of jtab occurs 0,
vbeln type vbak-vbeln,
erdat type vbak-erdat,
netwr type vbak-netwr,
end of jtab.
data: begin of ktab occurs 0,
posnr type vbap-posnr,
arktx type vbap-arktx,
werks type vbap-werks,
end of ktab.
data: fname(20) type c.
*&---------------------------------------------------------------------*
*& selecting and display data for basic list *
*&---------------------------------------------------------------------*
select kunnr
name1
land1
from kna1 into table itab.
loop at itab.
write:/10 itab-kunnr,
35 itab-name1,
70 itab-land1.
hide itab-kunnr.
endloop.
*&---------------------------------------------------------------------*
*& selecting and display data for detail list *
*&---------------------------------------------------------------------*
at line-selection.
case sy-lsind.
when '1'.
data: v_field(60).
get cursor field v_field.
check v_field = 'ITAB-KUNNR'.
select vbeln
erdat
netwr
from vbak into table jtab where kunnr = itab-kunnr.
if sy-subrc ne 0.
message e000(zmessage).
endif.
loop at jtab.
write:/10 jtab-vbeln,
35 jtab-erdat,
70 jtab-netwr.
at last.
sum.
write:/ 'Sub total:', jtab-netwr color 3.
endat.
hide jtab-vbeln.
endloop.
when '2'.
select posnr
arktx
werks
from vbap into table ktab where vbeln = jtab-vbeln.
loop at ktab.
write:/10 ktab-posnr,
35 ktab-arktx,
70 ktab-werks.
endloop.
endcase.
top-of-page.
write:/ 'CUSTOMERS INFORMATION REPORT'.
uline.
write:/10 'customer number',
35 'customer name',
70 'customer country'.
uline.
end-of-page.
write:/80 'Page Number:',sy-pagno .
top-of-page during line-selection.
write:/'ORDER DETAILS OF', itab-kunnr, itab-name1.
uline.
write:/10 'order number',
35 'order date',
80 'order value'.
uline.
top-of-page during line-selection.
write:/'ORDER DETAILS OF', jtab-vbeln,jtab-erdat.
uline.
write:/10 'Item Number ',
35 'Item Description',
80 'Plant'.
uline.
2007 May 17 10:59 PM
Hi,
Why do you have two TOP-OF-PAGE DURING LINE-SELECTION events..
<b>top-of-page during line-selection.</b>
write:/'ORDER DETAILS OF', itab-kunnr, itab-name1.
uline.
write:/10 'order number',
35 'order date',
80 'order value'.
uline.
<b>top-of-page during line-selection.</b>
write:/'ORDER DETAILS OF', jtab-vbeln,jtab-erdat.
uline.
write:/10 'Item Number ',
35 'Item Description',
80 'Plant'.
uline.
Thanks,
Naren
2007 May 17 11:03 PM
The first is for the 1st detail list .
Second is for 2nd detail list
2007 May 17 11:07 PM
Hi,
Try this..have one top-of-page during line-selection event..And check for SY-LSIND..
Check the code..
top-of-page during line-selection.
IF sy-lsind = 1. " Code inserted
write:/'ORDER DETAILS OF', itab-kunnr, itab-name1.
uline.
write:/10 'order number',
35 'order date',
80 'order value'.
uline.
elseif sy-lsind = 2. " Code inserted
write:/'ORDER DETAILS OF', jtab-vbeln,jtab-erdat.
uline.
write:/10 'Item Number ',
35 'Item Description',
80 'Plant'.
uline.
ENDIF. " Code inserted
Thanks,
Naren
2007 May 17 11:09 PM
Hi,
Please make sure to reward points for helpful answers..
Also next time..Please open a new thread for each question..
Thanks,
Naren