Skip to Content
avatar image
Former Member

Sy-Lsind

Hi,

iam executing the following program.

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.

SELECT-OPTIONS:

SKUNNR FOR ST_KNA1-KUNNR.

START-OF-SELECTION.

PERFORM GETCUST_DATA.

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.

ENDIF.

TOP-OF-PAGE.

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

AT LINE-SELECTION.

<b>CASE SY-LSIND.

WHEN 1.

WRITE:/ 'READY TO DISPLAY SALES DETAILS'.</b>

ENDCASE.

Here when 1 . I have to get the above message.

Else i want to write the statement, no sales details.

how to write that else condition here.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

10 Answers

  • Best Answer
    Aug 16, 2007 at 10:25 AM

    Hi..

    This is the code .. check the Changes in BOLD

    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.

    SELECT-OPTIONS:

    SKUNNR FOR ST_KNA1-KUNNR.

    START-OF-SELECTION.

    PERFORM GETCUST_DATA.

    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.

    <b>HIDE ST_KNA1-KUNNR.</b>

    ENDLOOP.

    <b>CLEAR: ST_KNA1.</b>

    ENDIF.

    TOP-OF-PAGE.

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

    AT LINE-SELECTION.

    CASE SY-LSIND.

    <b>WHEN 1.

    IF ST_KNA1-KUNNR IS NOT INITIAL.

    SELECT VBELN AUDAT AUART NETWR FROM VBAK

    INTO TABLE IT_VBAK

    WHERE KUNNR = ST_KNA1-KUNNR.

    IF SY-SUBRC = 0.

    WRITE:/ 'READY TO DISPLAY SALES DETAILS'.

    ELSE.

    WRITE:/ 'NO SALES DATA FOUND'.

    ENDIF.

    ENDCASE.</b>

    <b>Reward if Helpful</b>

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 16, 2007 at 10:20 AM

    CASE SY-LSIND.

    WHEN 1.

    WRITE:/ 'READY TO DISPLAY SALES DETAILS'.

    when others.

    write:/ 'no sales details'.

    ENDCASE.

    reward points if it helps

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 16, 2007 at 10:22 AM

    Hi Rams

    AT LINE-SELECTION.

    CASE SY-LSIND.

    WHEN 1.

    WRITE:/ 'READY TO DISPLAY SALES DETAILS'.

    when others.

    write:/ ' no sales order'.

    ENDCASE.

    reward points to all helpful answers

    kiran.M

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 16, 2007 at 10:22 AM

    Use following code :

    CASE SY-LSIND.

    WHEN 1.

    WRITE:/ 'READY TO DISPLAY SALES DETAILS'.

    WHIN 2.

    WRITE:/ 'NO SALES DETAILS'.

    ENDCASE.

    Reward points if helpful.

    Regards.

    Srikanta Gope

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 16, 2007 at 10:22 AM

    HI,

    CASE SY-LSIND.

    WHEN 1.

    WRITE:/ 'READY TO DISPLAY SALES DETAILS'.

    WHEN OTHERS.

    Write:/ 'no sales details'.

    ENDCASE.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 16, 2007 at 10:22 AM

    Hi

    Give like this.

    Case sy-lsind.

    when others.

    write:/ 'No Sales Details'.

    endcase.

    Here when sy-lsind is not equal to 1 it will display the above write statement.

    Regards

    Haritha.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 16, 2007 at 10:22 AM

    hi,

    write

    when others.

    write:/ 'no sales details'.

    regards,

    nagaraj

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 16, 2007 at 10:23 AM

    Hi

    CASE SY-LSIND.

    WHEN 1.

    WRITE:/ 'READY TO DISPLAY SALES DETAILS'.

    <b>when Others:

    Write:/ 'No Sales details'.</b>

    ENDCASE.

    it would be better if you use..if else here..

    if sy-lsind = '1'.

    WRITE:/ 'READY TO DISPLAY SALES DETAILS'.

    else.

    Write:/ 'No Sales details'.

    endif.

    Regards

    Suruchi

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 16, 2007 at 10:56 AM

    if SY-LSIND eq 1.

    WRITE:/ 'READY TO DISPLAY SALES DETAILS'.

    else.

    write:/ 'No data to display'.

    Endif.

    Reward points if useful.

    Get back in case of query....

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 16, 2007 at 10:21 AM

    Hi,

    AT LINE-SELECTION.
    
    IF SY-LSIND EQ 1.
    WRITE:/ 'READY TO DISPLAY SALES DETAILS'.
    ELSE.
      WRITE :/ 'XXXXXXXXXXXXXXX'.
    ENDIF.
    
    

    ArS

    Add comment
    10|10000 characters needed characters exceeded