‎2008 Feb 13 9:03 AM
hiiiiiiiiii
what is structure of program in interactive report.
what is santax to display data in ist sec. list and in 2nd sec. list.
thanks
‎2008 Feb 13 9:04 AM
these are events in the interactive reporting
AT LINE SELECTION.
and AT USER COMMAND
for double click AT LINE SELECTION will be triggered and for anu function codes At user command will be triggered.
When the user triggers the function code PICK, AT LINE-SELECTION is always triggered if the cursor is positioned on a list line. The function code PICK is, by default, always linked with function key F2 and hence with the mouse double-click. Consequently, if you have a simple program that does not react to any further user actions, you only need to write this event block.
AT LINE-SELECTION.
<statements>.
As described in the section Dialog Status for Lists, the function code PICK is always added to the standard list status when you have an AT LINE-SELECTION event in your program.
If you assign PICK to other function keys or menu entries, AT LINE-SELECTION is also triggered when the user chooses then. You should avoid this for the sake of the semantics.
Conversely, if you have a more extensive program that does not react to line selection, you should not use the function code PICK. Instead you should assign a different function code to F2 , to ensure that as many events as possible trigger the AT USER-COMMAND event.
Reward points if useful.
‎2008 Feb 13 9:10 AM
Hi,
if u double click on the list then it will move to next list.
at line-slection.
write: sy-lsind.
if u click the button on the list depending on the code on that particular f-code program execution is done.
at user-command.
if sy-ucomm eq 'del'.
ur code.
endif.
Plzz reward points if it helps.
‎2008 Feb 13 12:38 PM
Hi,
According to the requirement we can use At line selection or At User Command.By Clicking on the specific filed if u want to diaplay the specific output reletaed to field then go for At line selection. By clicking on specific button if u want to display the output related to the button then go for At user command.
If it is useful to u Plz reward points,
Thnaks & Regards,
Koti Reddy N
‎2008 Feb 13 1:01 PM
Hi,
here is a report u can see the syntax,
TYPES : BEGIN OF st_kna1,
kunnr TYPE kna1-kunnr, "CUSTOMER NUMBER
name1 TYPE kna1-name1, "CUSTOMER NAME
END OF st_kna1.
TYPES : BEGIN OF st_vbak,
kunnr TYPE kna1-kunnr,
vbeln TYPE vbak-vbeln, "SALES DOCUMENT NUMBER
erdat TYPE vbak-erdat, "DATE ON WHICH THE RECORD WAS CREATED
audat TYPE vbak-audat, "DOCUMENT DATE
auart TYPE vbak-auart, "SALES DOCUMENT TYPE
ernam TYPE vbak-ernam, "NAME OF PERSON WHO CREATED THE OBJECT.
augru TYPE vbak-augru, "ORDER REASON
END OF st_vbak.
TYPES : BEGIN OF st_vbap,
vbeln TYPE vbak-vbeln,
posnr TYPE vbap-posnr, "SALES DOCUMENT ITEM
matnr TYPE vbap-matnr, "MATERIAL NUMBER
charg TYPE vbap-charg, "BATCH NUMBER
matkl TYPE vbap-matkl, "MATERIAL GROUP
posar TYPE vbap-posar, "ITEM TYPE
END OF st_vbap.
DATA : it_kna1 TYPE STANDARD TABLE OF st_kna1,
it_vbak TYPE STANDARD TABLE OF st_vbak,
it_vbap TYPE STANDARD TABLE OF st_vbap,
wa_kna1 TYPE st_kna1,
wa_vbak TYPE st_vbak,
wa_vbap TYPE st_vbap.
DATA : v_fld(15),
v_kunnr TYPE kna1-kunnr,
v_vbeln TYPE vbak-vbeln.
----
SELECT-OPTIONS
PARAMETERS
----
SELECT-OPTIONS so_kunnr FOR v_kunnr. "CUSTOMER NUMBER
PARAMETERS : p_max TYPE i. "NUMBER OF HITS
----
START-OF-SELECTION
----
START-OF-SELECTION.
PERFORM get_customerdata.
SET PF-STATUS 'MENU1'.
----
AT LINE-SELECTION
----
AT LINE-SELECTION.
IF sy-lsind = 1.
PERFORM get_salesheader.
ELSEIF sy-lsind = 2.
PERFORM get_salesitemdata.
ENDIF.
----
AT USER-COMMAND
----
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'DISP'.
PERFORM get_salesheader.
WHEN 'ITEM'.
PERFORM get_salesitemdata.
WHEN 'VA03'.
SET PARAMETER ID 'AUN' FIELD wa_vbak-vbeln.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDCASE.
----
TOP-OF-PAGE
----
TOP-OF-PAGE.
ULINE AT /1(56).
WRITE : /1 sy-vline ,
2(15) text-004 COLOR 1 ,
sy-vline ,
20(35) text-005 COLOR 1 ,
sy-vline.
ULINE AT /1(56).
----
TOP-OF-PAGE DURING LINE-SELECTION.
----
TOP-OF-PAGE DURING LINE-SELECTION.
CASE sy-lsind.
WHEN 1.
PERFORM get_topofpage1.
WHEN 2.
PERFORM get_topofpage2.
ENDCASE.
----
FORM GET_CUSTOMERDATA
----
FORM get_customerdata.
SELECT kunnr name1
FROM kna1
INTO TABLE it_kna1
UP TO p_max ROWS
WHERE kunnr IN so_kunnr.
IF sy-subrc EQ 0.
LOOP AT it_kna1 INTO wa_kna1.
WRITE : / sy-vline,
2(15) wa_kna1-kunnr ,
sy-vline ,
20 wa_kna1-name1,
sy-vline.
HIDE : wa_kna1-kunnr , wa_kna1-name1.
CLEAR wa_kna1.
ENDLOOP.
ULINE AT : /1(56).
ELSE.
MESSAGE w000(z50871msg).
ENDIF.
ENDFORM. "GET_CUSTOMERDATA
----
FORM GET_SALESHEADER
----
FORM get_salesheader.
SET PF-STATUS 'MENU2'.
GET CURSOR FIELD v_fld VALUE v_kunnr.
IF v_fld = 'WA_KNA1-KUNNR'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_kunnr
IMPORTING
output = v_kunnr.
SELECT kunnr vbeln erdat audat auart ernam augru
FROM vbak
INTO TABLE it_vbak
WHERE kunnr = v_kunnr.
IF sy-subrc EQ 0.
LOOP AT it_vbak INTO wa_vbak.
WRITE : / sy-vline ,
2(22) wa_vbak-vbeln ,
sy-vline,
27(25) wa_vbak-erdat ,
sy-vline ,
55(15) wa_vbak-audat ,
sy-vline ,
73(15) wa_vbak-auart ,
sy-vline,
91(16) wa_vbak-ernam ,
sy-vline,
109(13) wa_vbak-augru,
123 sy-vline.
HIDE : wa_vbak-vbeln.
CLEAR wa_vbak.
ENDLOOP.
ULINE AT : /1(123).
ELSE.
MESSAGE i015(z50871msg).
ENDIF.
ELSE.
MESSAGE i013(z50871msg).
ENDIF.
ENDFORM. "GET_SALESHEADER
----
FORM GET_SALESITEMDATA
----
FORM get_salesitemdata.
SET PF-STATUS space.
GET CURSOR FIELD v_fld VALUE v_vbeln.
IF v_fld = 'WA_VBAK-VBELN'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_vbeln
IMPORTING
output = v_vbeln.
SELECT vbeln posnr matnr charg matkl posar
FROM vbap
INTO TABLE it_vbap
WHERE vbeln = v_vbeln.
LOOP AT it_vbap INTO wa_vbap.
WRITE : /1 sy-vline,
2(13) wa_vbap-posnr ,
sy-vline,
18(18) wa_vbap-matnr ,
sy-vline,
40(13) wa_vbap-charg ,
sy-vline,
56(16) wa_vbap-matkl ,
sy-vline,
75 wa_vbap-posar,
112 sy-vline.
CLEAR wa_vbap.
ENDLOOP.
ULINE AT : /1(112).
ELSE.
MESSAGE i014(z50871msg).
ENDIF.
ENDFORM. "GET_SALESITEMDATA
----
FORM GET_TOPOFPAGE1
----
FORM get_topofpage1.
ULINE AT : /1(123).
WRITE : / sy-vline ,
2 text-000 ,
wa_kna1-kunnr ,
75 text-001 ,
wa_kna1-name1,
123 sy-vline.
ULINE AT : /1(123).
WRITE : / sy-vline ,
2(22) text-006 COLOR 1,
sy-vline,
27(25) text-007 COLOR 1 ,
sy-vline ,
55(15) text-008 COLOR 1 ,
sy-vline ,
73(15) text-009 COLOR 1 ,
sy-vline,
91(16) text-010 COLOR 1 ,
sy-vline,
109(13) text-011 COLOR 1,
123 sy-vline.
ULINE AT : /1(123).
ENDFORM. "GET_TOPOFPAGE1
----
FORM GET_TOPOFPAGE2
----
FORM get_topofpage2.
ULINE AT : /1(112).
WRITE : / sy-vline ,
2 text-000 ,
wa_kna1-kunnr ,
35 text-001 ,
wa_kna1-name1 ,
85 text-003 ,
wa_vbak-vbeln ,
112 sy-vline.
ULINE AT : /1(112).
WRITE : /1 sy-vline,
2(13) text-012 COLOR 1,
sy-vline,
18(18) text-013 COLOR 1 ,
sy-vline,
40(13) text-014 COLOR 1 ,
sy-vline,
56(16) text-015 COLOR 1 ,
sy-vline,
75 text-016 COLOR 1 ,
112 sy-vline.
ULINE AT : /1(112).
ENDFORM. "GET_TOPOFPAGE2
‎2008 Feb 13 1:44 PM
Hi Manpreet,
The Structure of the program for Interactive Reporting is as follows
START-OF-SELECTION
code for creating Basic list
AT LINE_SELECTION. " Event for creating secondary lists
case sy-lsind. " system field which contains list index
when 1.
code for creating 1st Secondary list
when 2.
code for creating 2nd secondary list
endcase.
TOP-OF-PAGE DURING LINE-SELECTION. "Event for creating report header in secondary lists
case sy-lsind.
when 1.
code for displaying 1st Secondary list header
when 2.
code for displaying 2nd Secondary List header
endcase.
AT USER-COMMAND "Event used when function codes where triggered
case sy-ucomm.
when 'FCT_CODE1' .
code for creating 1st secondary list.
when 'FCT_CODE2'.
code for creating 2nd secondary list.
endcase.
for example
we will show mara data in basic list , marc in 1st secondary list, mard in 2nd secondary list.
report ztest1.
data : it_mara type standard table of mara with header line,
it_marc type standard table of marc with header line,
it_mard type standard table of marc with header line,
v_mara_matnr type mara-matnr,
v_marc_matnr type marc-matnr,
v_marc_werks type marc-werks
TOP-OF-PAGE. " Header for basic list
write : 'Mara Data'.
TOP-OF-PAGE DURING LINE-SELECTION. "Headers for secondary list
case sy-lsind.
when 1.
write : 'Marc Data'.
when 2.
write : 'Mard Data'.
endcase.
START-OF-SELECTION.
select * from mara into table it_mara upto 100 rows.
loop at it_mara.
write : / it_mara-matnr, it_mara-mbrsh ...
v_mara_matnr = it_mara-matnr.
hide v_matnr.
endloop.
AT LINE-SELECTION. " event for secondary lists
case sy-lsind.
when 1.
select * from marc into table it_marc where matnr = v_matnr.
loop at it_marc.
write 😕 it_marc-matnr, it_marc-werks ...
v_marc_matnr = it_marc-matnr.
v_marc_werks = it_marc-werks.
hide : v_marc_matnr, v_marc_werks.
endloop.
when 2.
select * from mard into table it_mard where matnr = v_marc_matnr and werks = v_marc_werks.
loop at it_mard.
write 😕 it_mard-matnr, it_mard-werks, it_mard-lgort ...
endloop.
endcase.
Pls Rewards points if Useful
‎2008 Feb 13 2:30 PM
Hi,
Please refer to the SAP standard demo program:
DEMO_LIST_HIDE
Thanks,
Sriram Ponna.