Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SY-LISEL

Former Member
0 Kudos
757

Hi,

In my program i had wrote sy-lisel. still when iam double clicking it is not taking that line. plz let me know.

also i wrote no stamdard page heading, but that appears in the output.

This is my program.

REPORT ZAC_TAB23. "LINE-SIZE" 180,

"LINE-COUNT" 26(2),

"NO STANDARD PAGE HEADING".

TYPES:

BEGIN OF TY_KNA1,

KUNNR TYPE KNA1-KUNNR,

LAND1 TYPE KNA1-LAND1,

NAME1 TYPE KNA1-NAME1,

ORT01 TYPE KNA1-ORT01,

END OF TY_KNA1,

BEGIN OF TY_VBAK,

VBELN TYPE VBAK-VBELN,

AUDAT TYPE VBAK-AUDAT,

AUART TYPE VBAK-AUART,

NETWR TYPE VBAK-NETWR,

END OF TY_VBAK,

BEGIN OF TY_VBAP,

POSNR TYPE VBAP-POSNR,

MATNR TYPE VBAP-MATNR,

ARKTX TYPE VBAP-ARKTX,

NETPR TYPE VBAP-NETPR,

NETWR TYPE VBAP-NETWR,

END OF TY_VBAP.

DATA:

ST_KNA1 TYPE TY_KNA1,

IT_KNA1 TYPE TABLE OF TY_KNA1,

ST_VBAK TYPE TY_VBAK,

IT_VBAK TYPE TABLE OF TY_VBAK,

ST_VBAP TYPE TY_VBAP,

IT_VBAP TYPE TABLE OF TY_VBAP.

  • S E L E C T O P T I O N S

SELECT-OPTIONS:

SKUNNR FOR ST_KNA1-KUNNR.

  • T O P O F P A G E

TOP-OF-PAGE.

WRITE:/1 'CUSTOMER NUMBER', 12'CUSTOMER NAME',42 'CITY',62 'COUNTRY'.

ULINE.

  • S T A R T O F S E L E C T I O N.

START-OF-SELECTION.

PERFORM GET_CUSTDATA.

IF IT_KNA1 IS NOT INITIAL.

LOOP AT IT_KNA1 INTO ST_KNA1.

WRITE:/ ST_KNA1-KUNNR,ST_KNA1-LAND1,ST_KNA1-NAME1,ST_KNA1-ORT01.

ENDLOOP.

ELSE.

WRITE:/ 'NO RECORDS FOUND'.

ENDIF.

  • AT LINE SELECTION.

AT LINE-SELECTION.

CASE SY-LSIND.

WHEN 1.

SELECT VBELN AUDAT AUART NETWR FROM VBAK

INTO TABLE IT_VBAK

WHERE KUNNR EQ ST_KNA1-KUNNR.

IF SY-SUBRC EQ 0.

LOOP AT IT_VBAK INTO ST_VBAK.

WRITE:/ ST_VBAK-VBELN,ST_VBAK-AUDAT,ST_VBAK-AUART,ST_VBAK-NETWR.

WRITE:/ SY-LISEL.

ENDLOOP.

ELSE.

MESSAGE S000(0) WITH 'NO RECORDS FOUND FOR CUSTOMER'.

ENDIF.

WHEN 2.

SELECT POSNR MATNR ARKTX NETPR NETWR FROM VBAP

INTO TABLE IT_VBAP.

IF SY-SUBRC EQ 0.

LOOP AT IT_VBAP INTO ST_VBAP.

WRITE:/ ST_VBAP-POSNR,ST_VBAP-MATNR,ST_VBAP-ARKTX,ST_VBAP-NETPR,ST_VBAP-NETWR.

ENDLOOP.

ELSE.

MESSAGE S000(0) WITH 'NO RECORDS FOUND FOR CUSTOMER'.

ENDIF.

ENDCASE.

INCLUDE ZAC_TAB23_GET_CUSTDATAF01.

&----


*& Form GET_CUSTDATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_CUSTDATA .

SELECT KUNNR LAND1 NAME1 ORT01 FROM KNA1

INTO TABLE IT_KNA1

WHERE KUNNR IN SKUNNR.

ENDFORM. " GET_CUSTDATA

1 ACCEPTED SOLUTION

0 Kudos
198

HI,

See the changes in <b>BOLD</b>

<b>REPORT ZAC_TAB23 LINE-SIZE 180 LINE-COUNT 26(2) NO STANDARD PAGE HEADING.</b>

TYPES:

BEGIN OF TY_KNA1,

KUNNR TYPE KNA1-KUNNR,

LAND1 TYPE KNA1-LAND1,

NAME1 TYPE KNA1-NAME1,

ORT01 TYPE KNA1-ORT01,

END OF TY_KNA1,

BEGIN OF TY_VBAK,

VBELN TYPE VBAK-VBELN,

AUDAT TYPE VBAK-AUDAT,

AUART TYPE VBAK-AUART,

NETWR TYPE VBAK-NETWR,

END OF TY_VBAK,

BEGIN OF TY_VBAP,

POSNR TYPE VBAP-POSNR,

MATNR TYPE VBAP-MATNR,

ARKTX TYPE VBAP-ARKTX,

NETPR TYPE VBAP-NETPR,

NETWR TYPE VBAP-NETWR,

END OF TY_VBAP.

DATA:

ST_KNA1 TYPE TY_KNA1,

IT_KNA1 TYPE TABLE OF TY_KNA1,

ST_VBAK TYPE TY_VBAK,

IT_VBAK TYPE TABLE OF TY_VBAK,

ST_VBAP TYPE TY_VBAP,

IT_VBAP TYPE TABLE OF TY_VBAP.

  • S E L E C T O P T I O N S

SELECT-OPTIONS:

SKUNNR FOR ST_KNA1-KUNNR.

  • T O P O F P A G E

TOP-OF-PAGE.

WRITE:/1 'CUSTOMER NUMBER', 12'CUSTOMER NAME',42 'CITY',62 'COUNTRY'.

ULINE.

  • S T A R T O F S E L E C T I O N.

START-OF-SELECTION.

PERFORM GET_CUSTDATA.

IF IT_KNA1 IS NOT INITIAL.

LOOP AT IT_KNA1 INTO ST_KNA1.

WRITE:/ ST_KNA1-KUNNR,ST_KNA1-LAND1,ST_KNA1-NAME1,ST_KNA1-ORT01.

ENDLOOP.

ELSE.

WRITE:/ 'NO RECORDS FOUND'.

ENDIF.

  • AT LINE SELECTION.

AT LINE-SELECTION.

CASE SY-LSIND.

WHEN 1.

<b>WRITE:/ SY-LISEL.</b>

SELECT VBELN AUDAT AUART NETWR FROM VBAK

INTO TABLE IT_VBAK

WHERE KUNNR EQ ST_KNA1-KUNNR.

IF SY-SUBRC EQ 0.

LOOP AT IT_VBAK INTO ST_VBAK.

WRITE:/ ST_VBAK-VBELN,ST_VBAK-AUDAT,ST_VBAK-AUART,ST_VBAK-

NETWR.

<b>HIDE ST_VBAK.</b>

WRITE:/ SY-LISEL.

ENDLOOP.

ELSE.

MESSAGE S000(0) WITH 'NO RECORDS FOUND FOR CUSTOMER'.

ENDIF.

WHEN 2.

SELECT POSNR MATNR ARKTX NETPR NETWR FROM VBAP

INTO TABLE IT_VBAP.

<b>WRITE:/ SY-LISEL.</b>

IF SY-SUBRC EQ 0.

LOOP AT IT_VBAP INTO ST_VBAP.

WRITE:/ ST_VBAP-POSNR,ST_VBAP-MATNR,ST_VBAP-ARKTX,ST_VBAP-

NETPR,ST_VBAP-NETWR.

<b>HIDE ST_VBAP.</b>

ENDLOOP.

ELSE.

MESSAGE S000(0) WITH 'NO RECORDS FOUND FOR CUSTOMER'.

ENDIF.

ENDCASE.

INCLUDE ZAC_TAB23_GET_CUSTDATAF01.

&----


*& Form GET_CUSTDATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_CUSTDATA .

SELECT KUNNR LAND1 NAME1 ORT01 FROM KNA1

INTO TABLE IT_KNA1

WHERE KUNNR IN SKUNNR.

ENDFORM. " GET_CUSTDATA

Regards,

Sesh

7 REPLIES 7

former_member196280
Active Contributor
0 Kudos
198

I see few errors, you did not use <b>hide</b> statement

0 Kudos
199

HI,

See the changes in <b>BOLD</b>

<b>REPORT ZAC_TAB23 LINE-SIZE 180 LINE-COUNT 26(2) NO STANDARD PAGE HEADING.</b>

TYPES:

BEGIN OF TY_KNA1,

KUNNR TYPE KNA1-KUNNR,

LAND1 TYPE KNA1-LAND1,

NAME1 TYPE KNA1-NAME1,

ORT01 TYPE KNA1-ORT01,

END OF TY_KNA1,

BEGIN OF TY_VBAK,

VBELN TYPE VBAK-VBELN,

AUDAT TYPE VBAK-AUDAT,

AUART TYPE VBAK-AUART,

NETWR TYPE VBAK-NETWR,

END OF TY_VBAK,

BEGIN OF TY_VBAP,

POSNR TYPE VBAP-POSNR,

MATNR TYPE VBAP-MATNR,

ARKTX TYPE VBAP-ARKTX,

NETPR TYPE VBAP-NETPR,

NETWR TYPE VBAP-NETWR,

END OF TY_VBAP.

DATA:

ST_KNA1 TYPE TY_KNA1,

IT_KNA1 TYPE TABLE OF TY_KNA1,

ST_VBAK TYPE TY_VBAK,

IT_VBAK TYPE TABLE OF TY_VBAK,

ST_VBAP TYPE TY_VBAP,

IT_VBAP TYPE TABLE OF TY_VBAP.

  • S E L E C T O P T I O N S

SELECT-OPTIONS:

SKUNNR FOR ST_KNA1-KUNNR.

  • T O P O F P A G E

TOP-OF-PAGE.

WRITE:/1 'CUSTOMER NUMBER', 12'CUSTOMER NAME',42 'CITY',62 'COUNTRY'.

ULINE.

  • S T A R T O F S E L E C T I O N.

START-OF-SELECTION.

PERFORM GET_CUSTDATA.

IF IT_KNA1 IS NOT INITIAL.

LOOP AT IT_KNA1 INTO ST_KNA1.

WRITE:/ ST_KNA1-KUNNR,ST_KNA1-LAND1,ST_KNA1-NAME1,ST_KNA1-ORT01.

ENDLOOP.

ELSE.

WRITE:/ 'NO RECORDS FOUND'.

ENDIF.

  • AT LINE SELECTION.

AT LINE-SELECTION.

CASE SY-LSIND.

WHEN 1.

<b>WRITE:/ SY-LISEL.</b>

SELECT VBELN AUDAT AUART NETWR FROM VBAK

INTO TABLE IT_VBAK

WHERE KUNNR EQ ST_KNA1-KUNNR.

IF SY-SUBRC EQ 0.

LOOP AT IT_VBAK INTO ST_VBAK.

WRITE:/ ST_VBAK-VBELN,ST_VBAK-AUDAT,ST_VBAK-AUART,ST_VBAK-

NETWR.

<b>HIDE ST_VBAK.</b>

WRITE:/ SY-LISEL.

ENDLOOP.

ELSE.

MESSAGE S000(0) WITH 'NO RECORDS FOUND FOR CUSTOMER'.

ENDIF.

WHEN 2.

SELECT POSNR MATNR ARKTX NETPR NETWR FROM VBAP

INTO TABLE IT_VBAP.

<b>WRITE:/ SY-LISEL.</b>

IF SY-SUBRC EQ 0.

LOOP AT IT_VBAP INTO ST_VBAP.

WRITE:/ ST_VBAP-POSNR,ST_VBAP-MATNR,ST_VBAP-ARKTX,ST_VBAP-

NETPR,ST_VBAP-NETWR.

<b>HIDE ST_VBAP.</b>

ENDLOOP.

ELSE.

MESSAGE S000(0) WITH 'NO RECORDS FOUND FOR CUSTOMER'.

ENDIF.

ENDCASE.

INCLUDE ZAC_TAB23_GET_CUSTDATAF01.

&----


*& Form GET_CUSTDATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_CUSTDATA .

SELECT KUNNR LAND1 NAME1 ORT01 FROM KNA1

INTO TABLE IT_KNA1

WHERE KUNNR IN SKUNNR.

ENDFORM. " GET_CUSTDATA

Regards,

Sesh

Former Member
0 Kudos
198

Hi Ram,

Here u r getting the line in sy-lisel.

here u write 'WRITE:/ SY-LISEL.' inside IF condtion which is not satisfying. thats y it is not printing.

just write like this and execute

WHEN 1.

WRITE:/ SY-LISEL.

*SELECT VBELN AUDAT AUART NETWR FROM VBAK

*INTO TABLE IT_VBAK

*WHERE KUNNR EQ ST_KNA1-KUNNR.

*IF SY-SUBRC EQ 0.

*LOOP AT IT_VBAK INTO ST_VBAK.

*WRITE:/ ST_VBAK-VBELN,ST_VBAK-AUDAT,ST_VBAK-AUART,ST_VBAK-NETWR.

*WRITE:/ SY-LISEL.

*ENDLOOP.

*ELSE.

*MESSAGE S000(0) WITH 'NO RECORDS FOUND FOR CUSTOMER'.

*ENDIF.

Reward if useful

Regards,

Nikhil

Former Member
0 Kudos
198

Hi,

It might not be taking the right line as it would count the lines from the top which might have some extra line check in debugger and see what line it is taking and make adjustment in your code accordingly.

Regards,

Himanshu

Former Member
0 Kudos
198

hi,

Once check it.Its giving for me.

former_member235056
Active Contributor
0 Kudos
198

Hi,

REPORT ZAC_TAB23 <b>LINE-SIZE 180 LINE-COUNT 26(2) NO STANDARD PAGE HEADING.</b>

TYPES:

BEGIN OF TY_KNA1,

KUNNR TYPE KNA1-KUNNR,

LAND1 TYPE KNA1-LAND1,

NAME1 TYPE KNA1-NAME1,

ORT01 TYPE KNA1-ORT01,

END OF TY_KNA1,

BEGIN OF TY_VBAK,

VBELN TYPE VBAK-VBELN,

AUDAT TYPE VBAK-AUDAT,

AUART TYPE VBAK-AUART,

NETWR TYPE VBAK-NETWR,

END OF TY_VBAK,

BEGIN OF TY_VBAP,

POSNR TYPE VBAP-POSNR,

MATNR TYPE VBAP-MATNR,

ARKTX TYPE VBAP-ARKTX,

NETPR TYPE VBAP-NETPR,

NETWR TYPE VBAP-NETWR,

END OF TY_VBAP.

DATA:

ST_KNA1 TYPE TY_KNA1,

IT_KNA1 TYPE TABLE OF TY_KNA1,

ST_VBAK TYPE TY_VBAK,

IT_VBAK TYPE TABLE OF TY_VBAK,

ST_VBAP TYPE TY_VBAP,

IT_VBAP TYPE TABLE OF TY_VBAP.

  • S E L E C T O P T I O N S

SELECT-OPTIONS:

SKUNNR FOR ST_KNA1-KUNNR.

  • T O P O F P A G E

TOP-OF-PAGE.

WRITE:/1 'CUSTOMER NUMBER', 12'CUSTOMER NAME',42 'CITY',62 'COUNTRY'.

ULINE.

  • S T A R T O F S E L E C T I O N.

START-OF-SELECTION.

PERFORM GET_CUSTDATA.

IF IT_KNA1 IS NOT INITIAL.

LOOP AT IT_KNA1 INTO ST_KNA1.

WRITE:/ ST_KNA1-KUNNR,ST_KNA1-LAND1,ST_KNA1-NAME1,ST_KNA1-ORT01.

ENDLOOP.

ELSE.

WRITE:/ 'NO RECORDS FOUND'.

ENDIF.

  • AT LINE SELECTION.

AT LINE-SELECTION.

CASE SY-LSIND.

WHEN 1.

<b>WRITE:/ SY-LISEL.</b>

SELECT VBELN AUDAT AUART NETWR FROM VBAK

INTO TABLE IT_VBAK

WHERE KUNNR EQ ST_KNA1-KUNNR.

IF SY-SUBRC EQ 0.

LOOP AT IT_VBAK INTO ST_VBAK.

WRITE:/ ST_VBAK-VBELN,ST_VBAK-AUDAT,ST_VBAK-AUART,ST_VBAK-NETWR.

ENDLOOP.

ELSE.

MESSAGE S000(0) WITH 'NO RECORDS FOUND FOR CUSTOMER'.

ENDIF.

WHEN 2.

SELECT POSNR MATNR ARKTX NETPR NETWR FROM VBAP

INTO TABLE IT_VBAP.

IF SY-SUBRC EQ 0.

LOOP AT IT_VBAP INTO ST_VBAP.

WRITE:/ ST_VBAP-POSNR,ST_VBAP-MATNR,ST_VBAP-ARKTX,ST_VBAP-NETPR,ST_VBAP-NETWR.

ENDLOOP.

ELSE.

MESSAGE S000(0) WITH 'NO RECORDS FOUND FOR CUSTOMER'.

ENDIF.

ENDCASE.

INCLUDE ZAC_TAB23_GET_CUSTDATAF01.

&----


*& Form GET_CUSTDATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_CUSTDATA .

SELECT KUNNR LAND1 NAME1 ORT01 FROM KNA1

INTO TABLE IT_KNA1

WHERE KUNNR IN SKUNNR.

ENDFORM. " GET_CUSTDATA

Pls reward points.

Regards,

Ameet

Former Member
0 Kudos
198

hi,

i found few mistakes in your code......

1) **** declare thables...

TABLES: kna1, vbak, vbap

2) **** select statements*********

SELECT-OPTIONS: SKUNNR FOR ST_KNA1-KUNNR.

i didn't get what is ST_KNA1-KUNNR.

you declare the select statement like this and try...

SELECT-OPTIONS: SKUNNR FOR KNA1-KUNNR.

3) the AT LINE-SELECTION statement will trigger only when you DOUBLE click on basic list or secondary list or when ever you press f2 function key.......

you write the SY-LISEL system field, it holds the all the user selected line data..

for genarating secondary list.........

in your code i didn't find any code for genarating secondary list...., for genarating secondary list you use these statement..

****declare variables for holding selected data

DATA: field1(10) type c

value1 type n.

GET CURSOR FIELD field1 VALUE value1.

AT LINE-SELECTION.

CASE SY-LSIND.

WHEN 1.

SELECT VBELN AUDAT AUART NETWR FROM VBAK

INTO TABLE IT_VBAK

WHERE KUNNR EQ value1.

use the same logic for genarating next secondary lists..

<b>or</b>

if you use SY-LISEL field, it containsa all the user selected line data. in that you find exactly where your required field value is exisisting and pass this value to select query..

DATA: <var> type <data-element>.

var = SY-LISEL(n). " length or

var =SY-LISEL<offset>(length). " for exact finding the required field.

regards,

Ashok Reddy