09-04-2008 9:41 AM
In my report,from basic list I want to call my customized transaction and want to fill that clicked field to that customised transaction.
problem is :
I am using at line selection.
In basic list I have header then many no of rows of data.
When I click header also it its taking me to cutomise transaction which I dont want.
I want to call my customise transactions after the header information and when i double click it it should take me to customise transaction and that row data should be filled in that transaction.
Can any body suggest me how to do it ?
thanks
kumar
09-04-2008 9:46 AM
Try to use Sy-LILLI : it gives the line from which the event was triggered, starts with 1, so you can write a IF condition in your at line-selection and you can try with SY-LISEL, it will give the contents of the line.
suppose your data starts from 5 th row.
IF SY-LILLI GE 5.
AT LINE-SELECTION.
CALL TRANSACTION...................
ENDIF
With luck,
Pritam.
09-04-2008 9:45 AM
Hi ,
Either you can check SY-LISEL
or if you know after how many lines your item details start .
say suppose it start from 10 line .
if sy-linno >= 10 .
call the customize transaction .
endif.
09-04-2008 9:46 AM
Try to use Sy-LILLI : it gives the line from which the event was triggered, starts with 1, so you can write a IF condition in your at line-selection and you can try with SY-LISEL, it will give the contents of the line.
suppose your data starts from 5 th row.
IF SY-LILLI GE 5.
AT LINE-SELECTION.
CALL TRANSACTION...................
ENDIF
With luck,
Pritam.
09-04-2008 9:49 AM
Hi Kumar,
In At Line Selection call the transaction if sy-lilli value is greater than the no. of lines until header is displayed.
That is, if your header line ends at 6th line in the basic list, then your condition should be: if sy-lilli > 6.
If this condition is satisfied then call the transaction and you can get hte value of that row from the system field sy-lisel.
Eg:
At line-selection.
if sy-lilli > 6.
w_char = sy-lisel.
call transaction <trxn>
endif.
Regards,
Chandra Sekhar.
09-04-2008 9:51 AM
Hi Kumar,
Try to refer the following code :
*" Table declarations...................................................
TABLES :
vbak, " Sales Document: Header Data
vbap. " Sales Document: Item Data
*" Selection Screen Elements...........................................
SELECT-OPTIONS :
s_kunnr FOR vbak-kunnr. " Customer Number
*" Data declarations...................................................
*"--------------------------------------------------------------------*
* Work Variables *
*"--------------------------------------------------------------------*
DATA :
w_fname(20) TYPE c. " Holds Fieldname
*"--------------------------------------------------------------------*
* Structure to hold Sales Document: Header Data *
*"--------------------------------------------------------------------*
DATA :
BEGIN OF fs_vbak,
vbeln LIKE vbak-vbeln, " Sales Document
kunnr LIKE vbak-kunnr, " Customer Number
bstnk LIKE vbak-bstnk, " Customer Purchase Order Number
END OF fs_vbak.
*"--------------------------------------------------------------------*
* Structure to hold Sales Document: Item Data *
*"--------------------------------------------------------------------*
DATA :
BEGIN OF fs_vbap,
vbeln LIKE vbap-vbeln, " Sales Document
posnr LIKE vbap-posnr, " Sales Document Item
matnr LIKE vbap-matnr, " Material Number
kwmeng LIKE vbap-kwmeng, " Cumulative Order Quantity
netpr LIKE vbap-netpr, " Price
END OF fs_vbap.
*"--------------------------------------------------------------------*
* Structure to hold General Data in Customer Master *
*"--------------------------------------------------------------------*
DATA :
BEGIN OF fs_kna1,
kunnr LIKE kna1-kunnr, " Customer Number
name LIKE kna1-name1, " Customer Name
END OF fs_kna1.
*"--------------------------------------------------------------------*
* Internal table to hold Sales Document: Header Data *
*"--------------------------------------------------------------------*
DATA :
t_vbak LIKE
STANDARD TABLE
OF fs_vbak.
*"--------------------------------------------------------------------*
* Internal table to hold Sales Document: Item Data *
*"--------------------------------------------------------------------*
DATA :
t_vbap LIKE
STANDARD TABLE
OF fs_vbap.
*"--------------------------------------------------------------------*
* Internal table to hold General Data in Customer Master *
*"--------------------------------------------------------------------*
DATA :
t_kna1 LIKE
STANDARD TABLE
OF fs_kna1.
*"--------------------------------------------------------------------*
* TOP-OF-PAGE EVENT *
*"--------------------------------------------------------------------*
TOP-OF-PAGE.
PERFORM top_of_page.
*"--------------------------------------------------------------------*
* TOP-OF-PAGE DURING LINE-SELECTION EVENT *
*"--------------------------------------------------------------------*
TOP-OF-PAGE DURING LINE-SELECTION.
PERFORM topofpage_during_linesel.
*"--------------------------------------------------------------------*
* AT SELECTION-SCREEN EVENT *
*"--------------------------------------------------------------------*
AT SELECTION-SCREEN.
PERFORM at_selection_screen.
*"--------------------------------------------------------------------*
* START-OF-SELECTION EVENT *
*"--------------------------------------------------------------------*
START-OF-SELECTION.
PERFORM start_of_selection.
*"--------------------------------------------------------------------*
* AT USER-COMMAND EVENT *
*"--------------------------------------------------------------------*
AT USER-COMMAND.
PERFORM user_command.
*"--------------------------------------------------------------------*
* AT LINE-SELECTION EVENT *
*"--------------------------------------------------------------------*
AT LINE-SELECTION.
PERFORM at_line_selection.
*&---------------------------------------------------------------------*
*& Form top_of_page
*&---------------------------------------------------------------------*
* This Subroutine Performs the Event Top-Of-Page *
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine. *
*----------------------------------------------------------------------*
FORM top_of_page .
WRITE :/50 'Customer Information'(001).
ULINE.
FORMAT COLOR 1.
WRITE :/10 'Customer Number'(002),
40 'Customer Name'(003),
80 'Order number'(004),
100 space.
ENDFORM. " FORM TOP_OF_PAGE
*&---------------------------------------------------------------------*
*& Form TOPOFPAGE_DURING_LINESEL *
*&---------------------------------------------------------------------*
* This Subroutine Performs the Event Top-Of-Page During Line-Selection *
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine. *
*----------------------------------------------------------------------*
FORM topofpage_during_linesel .
WRITE :/50 'Item Details'(007).
ULINE.
FORMAT COLOR 1.
WRITE :/5 'Sales Doc No.'(008),
23 'Sales Doc Item'(009),
42 'Material No.'(010),
59 'Order Qty'(011),
73 'Price'(012),
83 space.
ENDFORM. " FORM TOPOFPAGE_DURING_LINESEL
*&---------------------------------------------------------------------*
*& Form AT_SELECTION_SCREEN *
*&---------------------------------------------------------------------*
* This Subroutine Performs the Required Input Validations *
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine. *
*----------------------------------------------------------------------*
FORM at_selection_screen .
SELECT SINGLE kunnr
FROM vbak
INTO fs_vbak-kunnr
WHERE kunnr IN s_kunnr.
IF sy-subrc NE 0.
MESSAGE e184(bc_global) WITH text-013.
ENDIF. " IF SY-SUBRC NE 0
IF s_kunnr IS INITIAL.
MESSAGE e184(bc_global) WITH text-014.
ENDIF. " IF S_KUNNR IS INITIAL
ENDFORM. " FORM AT_SELECTION_SCREEN
*&---------------------------------------------------------------------*
*& Form start_of_selection
*&---------------------------------------------------------------------*
* This Subroutine Performs the Event START-OF-SELECTION *
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine. *
*----------------------------------------------------------------------*
FORM start_of_selection .
SET PF-STATUS 'YMENU1'.
SELECT vbeln " Sales Document
kunnr " Customer Number
bstnk " Customer Purchase Order Number
FROM vbak
INTO TABLE t_vbak
WHERE kunnr IN s_kunnr.
IF sy-subrc EQ 0.
SELECT kunnr " Customer Number
name1 " Customer Name
FROM kna1
INTO TABLE t_kna1
FOR ALL ENTRIES IN t_vbak
WHERE kunnr = t_vbak-kunnr.
IF sy-subrc EQ 0.
LOOP AT t_vbak INTO fs_vbak.
LOOP AT t_kna1 INTO fs_kna1 WHERE kunnr = fs_vbak-kunnr.
WRITE 😕 fs_vbak-kunnr UNDER text-002,
fs_kna1-name UNDER text-003,
fs_vbak-bstnk UNDER text-004.
HIDE : fs_vbak-kunnr,
fs_vbak-bstnk,
fs_vbak-vbeln.
ENDLOOP. " LOOP AT KNA1 INTO FS_KNA1
ENDLOOP. " LOOP AT T_VBAK INTO FS_VBAK
ENDIF. " IF SY-SUBRC EQ 0
ENDIF. " IF SY-SUBRC EQ 0
ENDFORM. " FORM START_OF_SELECTION
*&---------------------------------------------------------------------*
*& Form AT_LINE_SELECTION
*&---------------------------------------------------------------------*
* This Subroutine performs AT LINE-SELECTION Event *
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine. *
*----------------------------------------------------------------------*
FORM at_line_selection .
IF sy-lsind = 1.
SET PF-STATUS space.
SELECT vbeln " Sales Doc No.
posnr " Sales Doc Item
matnr " Material Number
kwmeng " Cumulative Order Quantity
netpr " Net Price
FROM vbap
INTO TABLE t_vbap
WHERE vbeln = fs_vbak-vbeln.
IF sy-subrc EQ 0.
LOOP AT t_vbap INTO fs_vbap.
WRITE 😕 fs_vbap-vbeln UNDER text-008,
fs_vbap-posnr UNDER text-009,
fs_vbap-matnr UNDER text-010,
49 fs_vbap-kwmeng,
67 fs_vbap-netpr,
83 space.
ENDLOOP. " LOOP AT T_VBAP INTO FS_VBAP
ENDIF. " IF SY-SUBRC EQ 0
ENDIF. " IF SY-LSIND = 1
ENDFORM. " FORM AT_LINE_SELECTION
*&---------------------------------------------------------------------*
*& Form USER_COMMAND *
*&---------------------------------------------------------------------*
* This Subroutine performs operations according to the User Command *
*----------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine. *
*----------------------------------------------------------------------*
FORM user_command .
GET CURSOR FIELD w_fname.
CASE sy-ucomm.
WHEN 'CUSTINFO'.
IF w_fname EQ 'FS_KNA1-KUNNR'.
SET PARAMETER ID 'KUN' FIELD fs_kna1-kunnr.
CALL TRANSACTION 'XD03'.
ELSE.
MESSAGE e184(bc_global) WITH text-005.
ENDIF. " IF W_FNAME EQ 'FS_KNA1-KUNNR'
WHEN 'ORDERINFO'.
IF w_fname EQ 'FS_VBAK-BSTNK'.
SET PARAMETER ID 'AUN' FIELD fs_vbak-bstnk.
CALL TRANSACTION 'VA03'.
ELSE.
MESSAGE e184(bc_global) WITH text-006.
ENDIF. " IF W_FNAME EQ 'FS_VBAK-BSTNK'
ENDCASE. " CASE SY-UCOMM
ENDFORM. " FORM USER_COMMAND
This report is used to Fetch & Display the Customer Number, Name and the Customer Purchase Order Number from Tables VBAK & KNA1.When the user places the cursor on the customer and clicks on the button u2018Customer Infou2019,the User is taken to the Transaction 'XD03'. When the user places the cursor on the order & clicks on the button u2018Order Infou2019, the User is taken to the transacion 'VA03'. When the User selects a line on the List the order details are Displayed
Please relate this to your requirement.
Regards,
Swapna.