Skip to Content
author's profile photo Former Member
Former Member

sap reoprts

hi guru

how to developed and ALV reports to generate customer sales information?

Thanks

regards

manas

Edited by: manas das on Mar 19, 2008 9:06 AM

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Mar 19, 2008 at 08:10 AM

    please state your requirement clearly

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 19, 2008 at 08:10 AM

    hi ,

    REPORT ZPURCHASE_ORDER.

    ***********************************************************************

    • TYPE-POOLS DECLARATION

    ***********************************************************************

    TYPE-POOLS:

    SLIS.

    ***********************************************************************

    • DATA DECLARATIONS

    ***********************************************************************

    DATA:

    W_EBELN TYPE EKKO-EBELN,

    W_PROG TYPE SY-REPID,

    T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

    FS_FIELDCAT LIKE LINE OF T_FIELDCAT,

    T_EVENTCAT TYPE SLIS_T_EVENT,

    W_EVENTCAT LIKE LINE OF T_EVENTCAT.

    ***********************************************************************

    • SELECT-OPTIONS DECLARATION

    ***********************************************************************

    SELECT-OPTIONS:

    S_EBELN FOR W_EBELN.

    ***********************************************************************

    • INTERNAL TABLE AND FIELD-STRING DECLARATIONS

    ***********************************************************************

    DATA:

    T_EKKO LIKE

    STANDARD TABLE

    OF EKKO,

    FS_EKKO LIKE LINE OF T_EKKO.

    DATA:

    T_EKPO LIKE

    STANDARD TABLE

    OF EKPO,

    FS_EKPO LIKE LINE OF T_EKPO.

    ***********************************************************************

    • START-OF-SELECTION

    ***********************************************************************

    START-OF-SELECTION.

    SELECT *

    FROM EKKO

    INTO TABLE T_EKKO

    WHERE EBELN IN S_EBELN.

    W_PROG = SY-REPID.

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

    EXPORTING

    I_CALLBACK_PROGRAM = W_PROG

    I_CALLBACK_USER_COMMAND = 'PICK'

    I_STRUCTURE_NAME = 'EKKO'

    TABLES

    T_OUTTAB = T_EKKO

    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.

    &----


    *& Form pick

    &----


    • -->UCOMM text

    • -->SELFIELD text

    ----


    FORM PICK USING COMMAND LIKE SY-UCOMM

    SELFIELD TYPE SLIS_SELFIELD.

    READ TABLE T_EKKO INTO FS_EKKO INDEX SELFIELD-TABINDEX.

    CASE COMMAND.

    WHEN '&IC1'.

    SELECT *

    FROM EKPO

    INTO TABLE T_EKPO

    WHERE EBELN EQ FS_EKKO-EBELN.

    W_PROG = SY-REPID.

    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

    EXPORTING

    I_STRUCTURE_NAME = 'EKPO'

    CHANGING

    CT_FIELDCAT = T_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.

    DELETE T_FIELDCAT WHERE FIELDNAME EQ 'EBELN'.

    DELETE T_FIELDCAT WHERE FIELDNAME EQ 'BUKRS'.

    DELETE T_FIELDCAT WHERE FIELDNAME EQ 'LGORT'.

    DELETE T_FIELDCAT WHERE FIELDNAME EQ 'WERKS'.

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

    EXPORTING

    I_CALLBACK_PROGRAM = W_PROG

    IT_FIELDCAT = T_FIELDCAT

    IT_EVENTS = T_EVENTCAT

    TABLES

    T_OUTTAB = T_EKPO

    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.

    ENDCASE. " CASE COMMAND

    ENDFORM. " FORM PICK

    FORM T_EVENTCAT.

    W_EVENTCAT-NAME = 'TOP_OF_PAGE'.

    W_EVENTCAT-FORM = 'TOP'.

    APPEND W_EVENTCAT TO T_EVENTCAT.

    ENDFORM.

    FORM TOP.

    READ TABLE T_EKPO INTO FS_EKPO INDEX 1.

    WRITE:/ 'Purchase Document Number'(001),30 FS_EKPO-EBELN,

    / 'Company Code'(002), 30 FS_EKPO-BUKRS,

    / 'Plant'(003), 30 FS_EKPO-WERKS,

    / 'Storage Location'(004),30 FS_EKPO-LGORT.

    ENDFORM.

    regards,

    venkat.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 19, 2008 at 08:15 AM

    hi,

    table for customer sales info is knvv.

    goto se11 and type knvv and click display. u wil get the fields of the table.

    in the below sample replace ' vbap ' and put the required table name, in ur case its ' knvv '. place the required field names from ' knvv ' in internal table declaration.

    sample code for alv.

    REPORT Z50911_ALV_REP.

    tables: vbap.

    type-pools: slis.

    select-options: salesdoc for vbap-posnr.

    data: begin of vbap_it occurs 0,

    matnr type vbap-matnr,

    matkl type vbap-matkl,

    netwr type vbap-netwr,

    end of vbap_it.

    data: i_fieldcat type slis_t_fieldcat_alv.

    AT SELECTION-SCREEN.

    if salesdoc-low LT 10 or

    salesdoc-high GT 40.

    message e000(01) with 'enter values within range 10-40'.

    endif.

    perform get_details.

    perform get_fieldcat using i_fieldcat.

    perform display_details.

    form get_details.

    select matnr

    matkl

    netwr

    from vbap into table vbap_it

    where posnr in salesdoc.

    endform.

    form get_fieldcat using fp_i_fieldcat type slis_t_fieldcat_alv.

    data: loc_fieldcat type slis_fieldcat_alv.

    clear loc_fieldcat.

    loc_fieldcat-col_pos = 1.

    loc_fieldcat-fieldname = 'MATNR'.

    loc_fieldcat-seltext_l = 'material number'.

    loc_fieldcat-ref_fieldname = 'MATNR'.

    loc_fieldcat-ref_tabname = 'vbap'.

    append loc_fieldcat to fp_i_fieldcat.

    clear loc_fieldcat.

    loc_fieldcat-col_pos = 2.

    loc_fieldcat-fieldname = 'MATKL'.

    loc_fieldcat-seltext_l = 'MATERIALGROUP'.

    loc_fieldcat-ref_fieldname = 'MATKL'.

    loc_fieldcat-ref_tabname = 'vbap'.

    append loc_fieldcat to fp_i_fieldcat.

    clear loc_fieldcat.

    loc_fieldcat-col_pos = 3.

    loc_fieldcat-fieldname = 'NETWR'.

    loc_fieldcat-seltext_l = 'netvalue'.

    loc_fieldcat-ref_fieldname = 'NETWR'.

    loc_fieldcat-ref_tabname = 'vbap'.

    append loc_fieldcat to fp_i_fieldcat.

    clear loc_fieldcat.

    endform.

    form display_details.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    • I_INTERFACE_CHECK = ' '

    • I_BYPASSING_BUFFER = ' '

    • I_BUFFER_ACTIVE = ' '

    I_CALLBACK_PROGRAM = sy-CPROG

    • 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 = i_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

    • I_HTML_HEIGHT_TOP = 0

    • I_HTML_HEIGHT_END = 0

    • IT_ALV_GRAPHICS =

    • IT_HYPERLINK =

    • IT_ADD_FIELDCAT =

    • IT_EXCEPT_QINFO =

    • IR_SALV_FULLSCREEN_ADAPTER =

    • E_EXIT_CAUSED_BY_CALLER =

    • ES_EXIT_CAUSED_BY_USER =

    TABLES

    T_OUTTAB = vbap_it

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.