2008 Jun 25 10:02 AM
hi,
i want to make a report in whihc i want to use at line selection init,but i had never used it.can anybody provide me example of it?
2008 Jun 25 10:04 AM
hiiii
see the example given below
TABLES:
vbak, "Sales Document :: Header Data
vbap. "Sales Document : Item Data
DATA:
w_vbeln TYPE vbak-vbeln.
***********************************************************************
* INITIALIZATION. *
***********************************************************************
INITIALIZATION.
SELECTION-SCREEN BEGIN OF BLOCK p1 WITH FRAME TITLE text-002.
SELECT-OPTIONS
s_vbeln FOR w_vbeln.
SELECTION-SCREEN END OF BLOCK p1 .
***********************************************************************
* STRUCTURE DECLARATION *
***********************************************************************
TYPES:
BEGIN OF type_s_document,
vbeln LIKE vbak-vbeln, "Sales Document
erdat LIKE vbak-erdat, "Date-the record was created
ernam LIKE vbak-ernam, "Name of Person-created Object
vbtyp LIKE vbak-vbtyp, "SD document category
auart LIKE vbak-auart, "Sales Document Type
lifsk LIKE vbak-lifsk, "Delivery block (document header)
faksk LIKE vbak-faksk, "Billing block in SD document
netwr LIKE vbak-netwr, "Net Value of the Sales
vkorg LIKE vbak-vkorg, "Sales Organization
kunnr LIKE vbak-kunnr, "Sold-to party
posnr LIKE vbap-posnr, "Sales Document Item
matnr LIKE vbap-matnr, "Material Number
meins LIKE vbap-meins, "Base Unit of Measure
END OF type_s_document.
***********************************************************************
* INTERNAL TABLE DECLARATION *
***********************************************************************
* types:
* p_document TYPE
* STANDARD TABLE
* OF type_s_document.
data:
t_document type
STANDARD TABLE
OF type_s_document,
fs_document TYPE type_s_document.
***********************************************************************
* START OF SELECTION *
***********************************************************************
START-OF-SELECTION.
PERFORM get_document_detail. "CALL SUBROUTINE
PERFORM read_document_detail. "CALL SUBROUTINE
***********************************************************************
* AT LINE SELECTION *
***********************************************************************
AT LINE-SELECTION.
PERFORM detail_list.
*&---------------------------------------------------------------------
*
*& Form get_document_detail
*&---------------------------------------------------------------------
*
* text
*----------------------------------------------------------------------
*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------
*
***********************************************************************
* FORM FOR GETTING DATA INTO INTERNAL TABLE *
***********************************************************************
FORM get_document_detail .
SELECT
vbeln "Sales Document
erdat "Date-the record was created
ernam "Name of Person-created Object
vbtyp "SD document category
auart "Sales Document Type
lifsk "Delivery block (document header)
faksk "Billing block in SD document
netwr "Net Value of the Sales
vkorg "Sales Organization
kunnr "Sold-to party
INTO CORRESPONDING FIELDS OF TABLE t_document
FROM vbak WHERE vbeln IN s_vbeln.
ENDFORM. " get_document_detail
read_document_detail
FORM read_document_detail .
LOOP AT t_document INTO fs_document.
WRITE:
/20 fs_document-vbeln,
fs_document-erdat,
fs_document-ernam,
fs_document-vbtyp,
fs_document-auart,
fs_document-lifsk,
fs_document-faksk,
fs_document-netwr,
fs_document-vkorg,
fs_document-kunnr,
fs_document-posnr,
fs_document-matnr,
fs_document-meins.
HIDE fs_document-vbeln.
ENDLOOP.
ENDFORM. " read_document_detail
FORM detail_list .
SELECT * FROM vbap INTO CORRESPONDING FIELDS OF TABLE t_document WHERE
vbeln = fs_document-vbeln.
LOOP AT t_document INTO fs_document.
WRITE:
/15 fs_document-vbeln,
25 fs_document-posnr,
35 fs_document-matnr,
45 fs_document-meins.
ENDLOOP.
ENDFORM. " detail_list
regards
twinkal
2008 Jun 25 10:04 AM
hiiii
see the example given below
TABLES:
vbak, "Sales Document :: Header Data
vbap. "Sales Document : Item Data
DATA:
w_vbeln TYPE vbak-vbeln.
***********************************************************************
* INITIALIZATION. *
***********************************************************************
INITIALIZATION.
SELECTION-SCREEN BEGIN OF BLOCK p1 WITH FRAME TITLE text-002.
SELECT-OPTIONS
s_vbeln FOR w_vbeln.
SELECTION-SCREEN END OF BLOCK p1 .
***********************************************************************
* STRUCTURE DECLARATION *
***********************************************************************
TYPES:
BEGIN OF type_s_document,
vbeln LIKE vbak-vbeln, "Sales Document
erdat LIKE vbak-erdat, "Date-the record was created
ernam LIKE vbak-ernam, "Name of Person-created Object
vbtyp LIKE vbak-vbtyp, "SD document category
auart LIKE vbak-auart, "Sales Document Type
lifsk LIKE vbak-lifsk, "Delivery block (document header)
faksk LIKE vbak-faksk, "Billing block in SD document
netwr LIKE vbak-netwr, "Net Value of the Sales
vkorg LIKE vbak-vkorg, "Sales Organization
kunnr LIKE vbak-kunnr, "Sold-to party
posnr LIKE vbap-posnr, "Sales Document Item
matnr LIKE vbap-matnr, "Material Number
meins LIKE vbap-meins, "Base Unit of Measure
END OF type_s_document.
***********************************************************************
* INTERNAL TABLE DECLARATION *
***********************************************************************
* types:
* p_document TYPE
* STANDARD TABLE
* OF type_s_document.
data:
t_document type
STANDARD TABLE
OF type_s_document,
fs_document TYPE type_s_document.
***********************************************************************
* START OF SELECTION *
***********************************************************************
START-OF-SELECTION.
PERFORM get_document_detail. "CALL SUBROUTINE
PERFORM read_document_detail. "CALL SUBROUTINE
***********************************************************************
* AT LINE SELECTION *
***********************************************************************
AT LINE-SELECTION.
PERFORM detail_list.
*&---------------------------------------------------------------------
*
*& Form get_document_detail
*&---------------------------------------------------------------------
*
* text
*----------------------------------------------------------------------
*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------
*
***********************************************************************
* FORM FOR GETTING DATA INTO INTERNAL TABLE *
***********************************************************************
FORM get_document_detail .
SELECT
vbeln "Sales Document
erdat "Date-the record was created
ernam "Name of Person-created Object
vbtyp "SD document category
auart "Sales Document Type
lifsk "Delivery block (document header)
faksk "Billing block in SD document
netwr "Net Value of the Sales
vkorg "Sales Organization
kunnr "Sold-to party
INTO CORRESPONDING FIELDS OF TABLE t_document
FROM vbak WHERE vbeln IN s_vbeln.
ENDFORM. " get_document_detail
read_document_detail
FORM read_document_detail .
LOOP AT t_document INTO fs_document.
WRITE:
/20 fs_document-vbeln,
fs_document-erdat,
fs_document-ernam,
fs_document-vbtyp,
fs_document-auart,
fs_document-lifsk,
fs_document-faksk,
fs_document-netwr,
fs_document-vkorg,
fs_document-kunnr,
fs_document-posnr,
fs_document-matnr,
fs_document-meins.
HIDE fs_document-vbeln.
ENDLOOP.
ENDFORM. " read_document_detail
FORM detail_list .
SELECT * FROM vbap INTO CORRESPONDING FIELDS OF TABLE t_document WHERE
vbeln = fs_document-vbeln.
LOOP AT t_document INTO fs_document.
WRITE:
/15 fs_document-vbeln,
25 fs_document-posnr,
35 fs_document-matnr,
45 fs_document-meins.
ENDLOOP.
ENDFORM. " detail_list
regards
twinkal
2008 Jun 25 10:16 AM
hi,
i want to have a example which does not conatin work area.
can anybody provide me example for it?
2008 Jun 25 10:05 AM
Hi,
For interactive lists..........it defines what must happen when u select a line in list/double click a line in list............
This sample hode ll help u to understand it better.
DATA : BEGIN OF itab OCCURS 0,
state TYPE char20,
city TYPE char18,
flag,
END OF itab.
DATA disptab LIKE itab OCCURS 0.
DATA sel_lin TYPE char20.
START-OF-SELECTION.
itab-state = 'Tamil Nadu'.
itab-city = 'Chennai'.
APPEND itab.
itab-state = 'Tamil Nadu'.
itab-city = 'Coimbatore'.
APPEND itab.
itab-state = 'West Bengal'.
itab-city = 'Kolkata'.
APPEND itab.
itab-state = 'West Bengal'.
itab-city = 'Durgapur'.
APPEND itab.
END-OF-SELECTION.
LOOP AT itab.
AT NEW state.
WRITE /3 itab-state COLOR 4 HOTSPOT.
ENDAT.
ENDLOOP.
AT LINE-SELECTION.
MOVE sy-lisel+2(20) TO sel_lin.
LOOP AT itab.
AT NEW state.
WRITE /3 itab-state COLOR 4 HOTSPOT.
ENDAT.
IF itab-flag 'X'.
IF itab-state = sel_lin.
itab-flag = 'X'.
ENDIF.
ELSE.
IF itab-state = sel_lin.
itab-flag = ' '.
ENDIF.
ENDIF.
IF itab-flag = 'X'.
WRITE /5 itab-city COLOR 2.
ENDIF.
MODIFY itab.
CLEAR itab.
ENDLOOP.
PS:Do Award points...
2008 Jun 25 10:31 AM
Hi,
Given below is the sampls code which doesnt contain the explicit work area.
DATA :
BEGIN OF itab OCCURS 0,
num TYPE i,
END OF itab.
START-OF-SELECTION.
DO.
IF sy-index EQ 10 .
EXIT.
ENDIF.
itab-num = sy-index.
APPEND itab.
ENDDO.
WRITE : ' Click on this line to go the second list'.
AT LINE-SELECTION.
LOOP AT itab.
WRITE : / itab-num.
ENDLOOP.
Trust this helps.
Warm Regards
R Adarsh