2007 Apr 21 6:09 AM
Hi,
I am writen code for interactive list. But I am facing a problem is wherever i click on the row, it is showing the next list. But i dont want it..
when i click on the sales order no. it has to show sales order details in the secondary list.. and when i click on the materail no. it has to show material details in the secondary list..
how can i get it..
plz suggest me..
Thanks & Regards,
Dhanunjay.
2007 Apr 21 6:13 AM
Hi,
Herewith i am sending the sample report for interactive list report.
REPORT YMS_ALVINTER.
&----
*& tables declaration
&----
TABLES: VBRK,VBRP.
&----
*& type-pools declaration
&----
TYPE-POOLS: SLIS.
&----
*& data declaration
&----
DATA: G_REPID TYPE SY-REPID.
DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV, "mara
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
WA_LAYOUT TYPE SLIS_LAYOUT_ALV,
WA_EVENT TYPE SLIS_ALV_EVENT,
T_EVENT TYPE SLIS_T_EVENT.
DATA: V_VBELN LIKE VBRK-VBELN,
V_MATNR LIKE VBRP-MATNR.
DATA: BEGIN OF IT_VBRK OCCURS 0,
VBELN LIKE VBRK-VBELN,
WAERK LIKE VBRK-WAERK,
VKORG LIKE VBRK-VKORG,
FKDAT LIKE VBRK-FKDAT,
BUKRS LIKE VBRK-BUKRS,
NETWR LIKE VBRK-NETWR,
END OF IT_VBRK.
DATA: BEGIN OF IT_VBRP OCCURS 0,
VBELN LIKE VBRP-VBELN,
POSNR LIKE VBRP-POSNR,
FKIMG LIKE VBRP-FKIMG,
VRKME LIKE VBRP-VRKME,
NETWR LIKE VBRP-NETWR,
MATNR LIKE VBRP-MATNR,
ARKTX LIKE VBRP-ARKTX,
END OF IT_VBRP.
&----
*& selection screen
&----
SELECTION-SCREEN BEGIN OF BLOCK B WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_VBELN FOR VBRK-VBELN,
S_FKDAT FOR VBRK-FKDAT,
S_MATNR FOR VBRP-MATNR.
SELECTION-SCREEN END OF BLOCK B.
**INITIALIZATION.
INITIALIZATION.
G_REPID = SY-REPID.
S_FKDAT-LOW = SY-DATUM - 200.
S_FKDAT-HIGH = SY-DATUM.
APPEND S_FKDAT.
***AT SELECTION-SCREEN.
AT SELECTION-SCREEN.
IF NOT S_VBELN IS INITIAL.
SELECT SINGLE VBELN FROM VBRK
INTO V_VBELN
WHERE VBELN IN S_VBELN.
IF SY-SUBRC <> 0.
MESSAGE E001(ZZ2).
ENDIF.
ENDIF.
IF NOT S_MATNR IS INITIAL.
SELECT SINGLE MATNR FROM MARA
INTO V_MATNR
WHERE MATNR IN S_MATNR.
IF SY-SUBRC <> 0.
MESSAGE E001(ZZ2).
ENDIF.
ENDIF.
***START-OF-SELECTION.
START-OF-SELECTION.
PERFORM GET_DATA_VBRK.
&----
*& Form GET_DATA_VBRK
&----
text
----
--> p1 text
<-- p2 text
----
FORM GET_DATA_VBRK .
SELECT VBELN
WAERK
VKORG
FKDAT
BUKRS
NETWR
INTO TABLE IT_VBRK
FROM VBRK
WHERE VBELN IN S_VBELN
AND FKDAT IN S_FKDAT.
ENDFORM. " GET_DATA_VBRK
&----
*& Form GET_DATA_VBRP
&----
text
----
--> p1 text
<-- p2 text
----
FORM GET_DATA_VBRP .
SELECT VBELN
POSNR
FKIMG
VRKME
NETWR
MATNR
ARKTX
FROM VBRP
INTO TABLE IT_VBRP
WHERE VBELN = IT_VBRK-VBELN.
ENDFORM. " GET_DATA_VBRP
***END-OF-SELECTION.
END-OF-SELECTION.
PERFORM EVENT_LIST.
PERFORM GET_FIELD_CATALOG.
PERFORM LIST_DISP .
&----
*& Form list_disp
&----
text
----
FORM LIST_DISP .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = 'POPUP'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_VBRK
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " LIST_DISP
&----
*& Form GET_FIELD_CATALOG
&----
text
----
--> p1 text
<-- p2 text
----
FORM GET_FIELD_CATALOG .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = G_REPID
I_INTERNAL_TABNAME = 'IT_VBRK'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = G_REPID
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = IT_FIELDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " GET_FIELD_CATALOG
&----
*& Form event_list
&----
text
----
--> p1 text
<-- p2 text
----
FORM EVENT_LIST .
CLEAR WA_EVENT.
WA_EVENT-NAME = 'USER_COMMAND'.
WA_EVENT-FORM = 'USER_COMMAND'.
APPEND WA_EVENT TO T_EVENT.
CLEAR WA_EVENT.
ENDFORM. " event_list
&----
*& Form user_command
&----
text
----
-->R_UCOMM text
-->RS_SELFIELDtext
----
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
READ TABLE IT_VBRK INDEX RS_SELFIELD-TABINDEX.
PERFORM GET_DATA_VBRP.
PERFORM BUILD_FIELDCATALOG_VBRP .
PERFORM DISPLAY_ALV_VBRP.
ENDCASE.
ENDFORM. "user_command
&----
*& Form BUILD_FIELDCATALOG_VBRP
&----
text
----
--> p1 text
<-- p2 text
----
FORM BUILD_FIELDCATALOG_VBRP .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = G_REPID
I_INTERNAL_TABNAME = 'IT_VBRP'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = G_REPID
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = IT_FIELDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " BUILD_FIELDCATALOG_VBRP
&----
*& Form DISPLAY_ALV_VBRP
&----
text
----
--> p1 text
<-- p2 text
----
FORM DISPLAY_ALV_VBRP .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = IT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_VBRP
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " DISPLAY_ALV_VBRP
Thanks,
Sankar M
2007 Apr 21 6:17 AM
hi,
Refer code below.it will solve ur problem.
AT LINE-SELECTION.
SET PARAMETER ID 'BLN' FIELD itab-belnr.
SET PARAMETER ID 'BUK' FIELD itab-bukrs.
SET PARAMETER ID 'GJR' FIELD itab-gjahr.
SET PARAMETER ID 'BUZ' FIELD itab-buzei.
CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.
Rewards point if helpful.
Santosh
2007 Apr 21 6:55 AM
Hi,
This is simple interactive report. i have to move from basic list to 1st interactive list.
there i am facing this problem.
In basic list i have fields 1.material no. 2.sales order no.3 so item no. 4.material description.
when i click on material no. , it has to fetch the data from mara table and show it in the 1st interactive list. whereas when i click on the sales order and item nos. it has to fetch the data from vbak & vbap tables and show the data in the 1st interactive report..
when i click on the material description, it should not be to 1st interactice list. it should has to stay in the basic list.
Plz suggest me.
Thanks & Regards,
Dhanunjay.
2007 Apr 21 7:46 AM
try this in
data : v_field(30),
v_value(30).
at line-selection.
get cursor field v_field value v_value.
if v_field = 'ITAB_MATNR'.
select......
elseif v_field = 'ITAB-MAKTX'.
select...
endif.
regards
shiba dutta
2007 Apr 21 10:03 AM
Hi..
Just paste this code...this is ur program..
*"Table declarations...................................................
TABLES:
VBAK. " Sales Document Item Data
*"Selection screen elements............................................
SELECTION-SCREEN BEGIN OF BLOCK B1.
SELECT-OPTIONS:
S_SDNUM FOR VBAK-VBELN. " Sales Document
SELECTION-SCREEN END OF BLOCK B1.
"----
Field String declaration to hold sales document data *
"----
DATA:
BEGIN OF FS_SALES,
SALEDOC LIKE VBAK-VBELN, " Sales Document
DATECREA LIKE VBAK-ERDAT, " Date of record creation
NAME LIKE VBAK-ERNAM, " Name of Person who Created
SDCATEG LIKE VBAK-VBTYP, " SD document category
SDTYPE LIKE VBAK-AUART, " Sales Document Type
DBLOCK LIKE VBAK-LIFSK, " Delivary Block
BBLOCK LIKE VBAK-FAKSK, " Billing block
NETVALUE LIKE VBAK-NETWR, " Net value of the document
SALESORG LIKE VBAK-VKORG, " Sales Organization
SOLDTO LIKE VBAK-KUNNR, " Sold-to-party
SDITEM TYPE VBAP-POSNR, " Sales Document Item
MATNUM TYPE VBAP-MATNR, " Material Number
BASEUNIT TYPE VBAP-MEINS, " Base Units of measure
END OF FS_SALES.
"----
Internal table to hold Sales Document header data *
"----
DATA:
T_SALES LIKE STANDARD TABLE
OF FS_SALES.
"----
Internal table to hold Sales Document Item data *
"----
DATA:
T_VBAP TYPE STANDARD TABLE
OF VBAP,
WA_VBAP LIKE LINE OF T_VBAP.
"Data declarations----
DATA:
W_LINES TYPE I. " Number of lines
"----
AT-SELECTION-SCREEN EVENT *
"----
AT SELECTION-SCREEN ON S_SDNUM.
Validate Sales document number
PERFORM VALIDATE_FIELD.
"----
TOP-OF-PAGE EVENT *
"----
TOP-OF-PAGE.
PERFORM LIST_HEADER.
"----
START-OF-SELECTION-SCREEN EVENT *
"----
START-OF-SELECTION.
PERFORM GET_HEADERDATA. " Subroutine to read header dat
"----
END-OF-SELECTION-SCREEN EVENT *
"----
END-OF-SELECTION.
if not t_sales is initial.
PERFORM PRINT_HEADERDATA. " Subroutine diplay basic list
"----
AT LINE-SELECTION-SCREEN EVENT *
"----
AT LINE-SELECTION.
PERFORM GET_SDITEM_DATA. " Reads and prints item data
&----
*& Form GET_HEADER_DATA
&----
This subroutine will fetch the Sales document header details.
----
There are no interface parameters to be passed to this subroutine. *
----
FORM GET_HEADERDATA .
SELECT VBELN " Sales Document
ERDAT " Date of record creation
ERNAM " Name of Person who Created
VBTYP " SD document category
AUART " Sales Document Type
LIFSK " Delivary Block
FAKSK " Billing block
NETWR " Net value of the document
VKORG " Sales Organization
KUNNR " Sold-to-party
INTO TABLE T_SALES
FROM VBAK
WHERE VBELN IN S_SDNUM. " SELECT VBELN
IF SY-SUBRC EQ 0.
Do Nothing.
ENDIF. " IF SY-SUBRC EQ 0
DESCRIBE TABLE T_SALES LINES w_lines.
ENDFORM. " GET_HEADERDATA
&----
*& FORM LIST_HEADER
&----
This subroutine prints Column headings
----
*There are no interface parameters to be passed to this subroutine. *
----
form list_header .
SKIP.
FORMAT COLOR 1.
WRITE:
2'Sales Document'(003) ,
18 'Date Created'(004) ,
34 'CreatorName'(005) ,
48 'SD Category'(006) ,
62 'SD Type'(007),
72 'Delivery'(008) ,
84 'Net Value'(010) ,
100 'Sales-Org.'(012) ,
120 'Soldto'(013) .
FORMAT COLOR OFF.
SKIP.
PERFORM DRAW_TABLE IN PROGRAM yh642_020301
USING 1 1 130 3 3 17 33 47 61 71 83 99 119 8.
endform. " LIST_HEADER
&----
*& Form print_headerdata
&----
This subroutine prints header data on the basic list.
----
No parameters passing to this subroutine.
----
FORM PRINT_HEADERDATA .
LOOP AT T_SALES INTO FS_SALES.
WRITE:
/ FS_SALES-SALEDOC UNDER TEXT-003,
FS_SALES-DATECREA UNDER TEXT-004,
FS_SALES-NAME UNDER TEXT-005,
FS_SALES-SDCATEG UNDER TEXT-006 RIGHT-JUSTIFIED,
FS_SALES-SDTYPE UNDER TEXT-007,
FS_SALES-DBLOCK UNDER TEXT-008,
FS_SALES-BBLOCK UNDER TEXT-009,
FS_SALES-NETVALUE UNDER TEXT-010 CURRENCY VBAK-WAERK
LEFT-JUSTIFIED,
FS_SALES-SALESORG UNDER TEXT-012,
FS_SALES-SOLDTO UNDER TEXT-013.
HIDE: FS_SALES-SALEDOC. " Hides basic list data
ENDLOOP. " ENDLOOP FOR DISPLAY
ADD 2 TO W_LINES.
*****draw_table**************
PERFORM DRAW_TABLE IN PROGRAM yh642_020301
USING 1 1 130 W_LINES 0 17 33 47 61 71 83 99 119 8.
ENDFORM. " PRINT_HEADERDATA
&----
*& FORM GET_SDITEM_DATA
&----
This subroutine gets SDitem data from VBAP table.
----
No parameters are passing to this subroutine.
----
FORM GET_SDITEM_DATA .
DATA:
l_w_lines type i. " No.Of Lines to be drawn
SELECT VBELN " Sales Document
POSNR " Item Number
MATNR " Material Number
MEINS " Base unit
INTO CORRESPONDING FIELDS OF TABLE T_VBAP
FROM VBAP
WHERE VBELN EQ FS_SALES-SALEDOC.
SKIP.
WRITE:
/5 'SD number'(014),
20 'Item'(015),
30 'Material'(016),
40 'Base unit'(017).
IF SY-SUBRC EQ 0.
SKIP.
LOOP AT T_VBAP INTO WA_VBAP.
WRITE:
/ WA_VBAP-VBELN UNDER TEXT-014,
WA_VBAP-POSNR UNDER TEXT-015,
WA_VBAP-MATNR UNDER TEXT-016,
WA_VBAP-MEINS UNDER TEXT-017.
ENDLOOP. " ENDLOOP FOR DISPLAY
DESCRIBE TABLE T_VBAP LINES L_W_LINES.
add 5 to l_w_lines.
****Draws table******
perform draw_table in program yh642_020301
using 4 1 52 L_W_LINES 3 19 29 39 0 0 0 0 0 3.
ELSE.
WRITE: / ' No records correspondinig to selection'(002).
ENDIF. " ENDIF FOR SY-SUBRC
ENDFORM. " GET SD_ITEM_DATA
&----
*& FORM VALIDATE_DATA
&----
This Subroutine Validates the inputs given by user
----
No parameters passing to this subroutine.
----
FORM VALIDATE_FIELD .
IF S_SDNUM IS INITIAL.
MESSAGE E005.
ENDIF. " IF S_SDNUM-LOW...
ENDFORM. " VALIDATE_FIELD
2007 Apr 21 8:12 AM
Hi Dhanunjay
Try this
WRITE:/ wa_itab-matnr,wa_itab-vbeln,wa_itab-vbelp,wa_itab-maktl.
hide_matnr = wa_itab-matnr.
hide_vbeln = wa_itab-vbeln.
HIDE: hide_matnr, hide_vbeln.
clear : hide_matnr, hide_vbeln.
Now SELECT req fields from req tables where matnr = hide_matnr.
or ,as per ur req.
Now SELECT req fields from req tables where vbeln = hide_vbeln.
2008 Jul 16 5:28 AM