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

alv

hi

pls check this code

not display output

hi anji pls check this code and how to send points also tell me

&----


*& Report ZSAMP_REP *

*& *

&----


*& *

*& *

&----


REPORT zsamp_rep .

TABLES :vbak,vbap.

TYPE-POOLS : slis.

*structure of table vbak

TYPES: BEGIN OF t_tab1 ,

vbeln TYPE vbak-vbeln, "sales document

vkorg TYPE vbak-vkorg, "sales organization

vkgrp TYPE vbak-vkgrp, "sales group,

kunnr TYPE vbak-kunnr, "sales-to party

END OF t_tab1.

*structure of table vbap

TYPES: BEGIN OF t_tab2,

matnr TYPE vbap-matnr, "matrial number

posnr TYPE vbap-posnr, "sales document item,

matkl TYPE vbap-matkl, "matrial group,

werks TYPE vbap-werks, "plant own(or) external

stlnr TYPE vbap-stlnr, "bill of materail.

END OF t_tab2.

*internal table of vbak

DATA : i_header TYPE STANDARD TABLE OF t_tab1,

wa_header TYPE t_tab1,

*internal table of vbap

i_item TYPE STANDARD TABLE OF t_tab2,

wa_item TYPE t_tab2.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE titl.

SELECT-OPTIONS: s_vbeln FOR vbak-vbeln.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE titl1.

PARAMETERS : rb_rep RADIOBUTTON GROUP rbg1 DEFAULT 'X',

rb_alv RADIOBUTTON GROUP rbg1 .

SELECTION-SCREEN END OF BLOCK b2.

DATA: t_keyinfo TYPE slis_keyinfo_alv,

t_fieldcat TYPE STANDARD TABLE OF slis_fieldcat_alv,

wa_events TYPE slis_alv_event,

wa_fieldcat TYPE slis_fieldcat_alv,

wa_alv_sort TYPE slis_sortinfo_alv,

x_print TYPE slis_print_alv.

CONSTANTS : c_header TYPE slis_tabname VALUE 'i_header',

c_item TYPE slis_tabname VALUE 'i_item'.

START-OF-SELECTION.

*get data

PERFORM get_data.

*display the data

PERFORM popl_data.

&----


*& Form get_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM get_data .

SELECT vbeln

vkorg

vkgrp

kunnr FROM vbak INTO TABLE i_header WHERE vbeln IN s_vbeln.

IF sy-subrc = 0.

SORT i_header BY vbeln .

SELECT

matnr

posnr

matkl

werks

stlnr FROM vbap INTO TABLE i_item WHERE vbeln IN s_vbeln.

SORT i_item BY matnr.

ENDIF.

ENDFORM. " get_data

&----


*& Form popl_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM popl_data .

IF rb_rep IS NOT INITIAL .

FORMAT COLOR = 3 INTENSIFIED OFF INVERSE OFF.

WRITE :1'sales docu'(001),

12 'sales org'(002),

24 'sales group'(003),

35 'sales-to party'(004).

FORMAT COLOR = 8 INTENSIFIED ON INVERSE OFF .

WRITE :/5 'matrial number'(005),

20 'sales document item'(006),

32 'materialgroup'(007),

48 'plant'(008),

56 'bill of materail'(009).

FORMAT COLOR = 3 INTENSIFIED OFF INVERSE OFF .

LOOP AT i_header INTO wa_header.

WRITE :/1 wa_header-vbeln,

12 wa_header-vkorg,

24 wa_header-vkgrp,

35 wa_header-kunnr.

ENDLOOP.

FORMAT COLOR = 8 INTENSIFIED ON INVERSE OFF .

LOOP AT i_item INTO wa_item.

WRITE:/5 wa_item-matnr,

20 wa_item-posnr,

32 wa_item-matkl,

48 wa_item-werks,

56 wa_item-stlnr .

ENDLOOP.

ELSE.

IF NOT rb_alv IS INITIAL.

PERFORM filed_catlog.

IF i_header[] IS NOT INITIAL.

PERFORM alv_disp TABLES

  • i_header

  • i_item

t_fieldcat

USING x_print.

ENDIF.

ENDIF.

ENDIF.

ENDFORM. " popl_data

*initialization

INITIALIZATION.

titl = 'sales order'.

titl1 = 'output options'.

&----


*& Form filed_catlog

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM filed_catlog .

*filed lengths

CONSTANTS:lc_1(1) TYPE c VALUE '1',

lc_12(2) TYPE c VALUE '12',

lc_24(2) TYPE c VALUE '24',

lc_35(2) TYPE c VALUE '35',

lc_5(1) TYPE c VALUE '5',

lc_22(2) TYPE c VALUE '22',

lc_32(2) TYPE c VALUE '32',

lc_48(2) TYPE c VALUE '48',

lc_56(2) TYPE c VALUE '56',

*filed names

lc_vbeln TYPE slis_fieldname VALUE 'vbeln',

lc_vkorg TYPE slis_fieldname VALUE 'vkorg',

lc_vkgrp TYPE slis_fieldname VALUE 'vkgrp',

lc_kunnr TYPE slis_fieldname VALUE 'kunnr',

lc_matnr TYPE slis_fieldname VALUE 'matnr',

lc_posnr TYPE slis_fieldname VALUE 'posnr',

lc_matkl TYPE slis_fieldname VALUE 'matkl',

lc_werks TYPE slis_fieldname VALUE 'werks',

lc_stlnr TYPE slis_fieldname VALUE 'stlnr'.

*SO document

PERFORM f_fill_fields TABLES t_fieldcat

USING c_header lc_vbeln text-001 lc_1 space space.

PERFORM f_fill_fields TABLES t_fieldcat

USING c_header lc_vkorg text-002 lc_12 space space.

PERFORM f_fill_fields TABLES t_fieldcat

USING c_header lc_vkgrp text-003 lc_24 space space.

PERFORM f_fill_fields TABLES t_fieldcat

USING c_header lc_kunnr text-004 lc_35 space space.

PERFORM f_fill_fields TABLES t_fieldcat

USING c_item lc_matnr text-005 lc_5 space space.

PERFORM f_fill_fields TABLES t_fieldcat

USING c_item lc_posnr text-006 lc_22 space space.

PERFORM f_fill_fields TABLES t_fieldcat

USING c_item lc_matkl text-007 lc_32 space space.

PERFORM f_fill_fields TABLES t_fieldcat

USING c_item lc_werks text-008 lc_48 space space.

PERFORM f_fill_fields TABLES t_fieldcat

USING c_item lc_stlnr text-009 lc_56 space space.

ENDFORM. " filed_catlog

&----


*& Form f_fill_fields

&----


  • text

----


  • -->P_T_FIELDCAT text

  • -->P_C_HEADER text

  • -->P_LC_VBELN text

  • -->P_TEXT_001 text

  • -->P_LC_1 text

  • -->P_SPACE text

  • -->P_SPACE text

----


FORM f_fill_fields TABLES p_t_fieldcat LIKE t_fieldcat

USING p_tabname TYPE any

p_fieldname TYPE any

p_sel_text_l TYPE any

p_length TYPE any

p_hot TYPE any

p_zero TYPE any.

wa_fieldcat-tabname = p_tabname.

wa_fieldcat-fieldname = p_fieldname.

wa_fieldcat-seltext_l = p_sel_text_l.

wa_fieldcat-edit = 'x'.

wa_fieldcat-outputlen = p_length.

wa_fieldcat-hotspot = p_hot.

wa_fieldcat-no_zero = p_zero.

APPEND wa_fieldcat TO p_t_fieldcat.

CLEAR wa_fieldcat.

ENDFORM. " f_fill_fields

&----


*& Form alv_disp

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM alv_disp TABLES

  • p_t_header LIKE i_header

  • p_t_item LIKE i_item

p_t_fieldcat LIKE t_fieldcat

USING p_x_print TYPE slis_print_alv.

DATA : l_repid TYPE sy-repid.

l_repid = sy-repid.

t_keyinfo-header01 = 'vbeln'.

t_keyinfo-item01 = 'matnr'.

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

EXPORTING

i_callback_program = l_repid

it_fieldcat = p_t_fieldcat[]

i_default = 'X'

i_tabname_header = 'i_header'

i_tabname_item = 'i_item'

is_keyinfo = t_keyinfo

is_print = p_x_print

TABLES

t_outtab_header = i_header[]

t_outtab_item = i_item[].

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. " alv_disp

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 23, 2007 at 03:28 PM

    In the call to REUSE_ALV_HIERSEQ_LIST_DISPLAY, use upper case for the values of I_TABNAME_HEADER and I_TABNAME_ITEM.

    John

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 24, 2007 at 09:33 AM

    hi,

    what u exactly want to do?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 24, 2007 at 11:02 AM

    PL RUN THE FOLLOWING CODE .THIS CODE IS ERROR FREE AND DISPLAY ALSO

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

    &----


    *& Report ZSAMP_REP *

    *& *

    &----


    *& *

    *& *

    &----


    REPORT ZSAMP_REP .

    TYPE-POOLS : slis.

    TABLES :vbak,vbap.

    *structure of table vbak

    TYPES: BEGIN OF t_tab1 ,

    vbeln TYPE vbak-vbeln, "sales document

    vkorg TYPE vbak-vkorg, "sales organization

    vkgrp TYPE vbak-vkgrp, "sales group,

    kunnr TYPE vbak-kunnr, "sales-to party

    END OF t_tab1.

    *structure of table vbap

    TYPES: BEGIN OF t_tab2,

    matnr TYPE vbap-matnr, "matrial number

    posnr TYPE vbap-posnr, "sales document item,

    matkl TYPE vbap-matkl, "matrial group,

    werks TYPE vbap-werks, "plant own(or) external

    stlnr TYPE vbap-stlnr, "bill of materail.

    END OF t_tab2.

    *internal table of vbak

    DATA : i_header TYPE STANDARD TABLE OF t_tab1,

    wa_header TYPE t_tab1,

    *internal table of vbap

    i_item TYPE STANDARD TABLE OF t_tab2,

    wa_item TYPE t_tab2.

    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE titl.

    SELECT-OPTIONS: s_vbeln FOR vbak-vbeln.

    SELECTION-SCREEN END OF BLOCK b1.

    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE titl1.

    PARAMETERS : rb_rep RADIOBUTTON GROUP rbg1 DEFAULT 'X',

    rb_alv RADIOBUTTON GROUP rbg1 .

    SELECTION-SCREEN END OF BLOCK b2.

    DATA: t_keyinfo TYPE slis_keyinfo_alv,

    t_fieldcat TYPE STANDARD TABLE OF slis_fieldcat_alv,

    wa_events TYPE slis_alv_event,

    wa_fieldcat TYPE slis_fieldcat_alv,

    wa_alv_sort TYPE slis_sortinfo_alv,

    x_print TYPE slis_print_alv.

    CONSTANTS : c_header TYPE slis_tabname VALUE 'i_header',

    c_item TYPE slis_tabname VALUE 'i_item'.

    START-OF-SELECTION.

    *get data

    PERFORM get_data.

    *display the data

    PERFORM popl_data.

    &----


    *& Form get_data

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM get_data .

    SELECT vbeln

    vkorg

    vkgrp

    kunnr FROM vbak INTO TABLE i_header WHERE vbeln IN s_vbeln.

    IF sy-subrc = 0.

    SORT i_header BY vbeln .

    SELECT

    matnr

    posnr

    matkl

    werks

    stlnr FROM vbap INTO TABLE i_item WHERE vbeln IN s_vbeln.

    SORT i_item BY matnr.

    ENDIF.

    ENDFORM. " get_data

    &----


    *& Form popl_data

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM popl_data .

    IF NOT rb_rep IS INITIAL .

    FORMAT COLOR = 3 INTENSIFIED OFF INVERSE OFF.

    WRITE :1'sales docu'(001),

    12 'sales org'(002),

    24 'sales group'(003),

    35 'sales-to party'(004).

    FORMAT COLOR = 8 INTENSIFIED ON INVERSE OFF .

    WRITE :/5 'matrial number'(005),

    20 'sales document item'(006),

    32 'materialgroup'(007),

    48 'plant'(008),

    56 'bill of materail'(009).

    FORMAT COLOR = 3 INTENSIFIED OFF INVERSE OFF .

    LOOP AT i_header INTO wa_header.

    WRITE :/1 wa_header-vbeln,

    12 wa_header-vkorg,

    24 wa_header-vkgrp,

    35 wa_header-kunnr.

    ENDLOOP.

    FORMAT COLOR = 8 INTENSIFIED ON INVERSE OFF .

    LOOP AT i_item INTO wa_item.

    WRITE:/5 wa_item-matnr,

    20 wa_item-posnr,

    32 wa_item-matkl,

    48 wa_item-werks,

    56 wa_item-stlnr .

    ENDLOOP.

    ELSE.

    IF NOT rb_alv IS INITIAL.

    PERFORM filed_catlog.

    IF NOT i_header[] IS INITIAL.

    PERFORM alv_disp TABLES

    • i_header

    • i_item

    t_fieldcat

    USING x_print.

    ENDIF.

    ENDIF.

    ENDIF.

    ENDFORM. " popl_data

    *initialization

    INITIALIZATION.

    titl = 'sales order'.

    titl1 = 'output options'.

    &----


    *& Form filed_catlog

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM filed_catlog .

    *filed lengths

    CONSTANTS:lc_1(1) TYPE c VALUE '1',

    lc_12(2) TYPE c VALUE '12',

    lc_24(2) TYPE c VALUE '24',

    lc_35(2) TYPE c VALUE '35',

    lc_5(1) TYPE c VALUE '5',

    lc_22(2) TYPE c VALUE '22',

    lc_32(2) TYPE c VALUE '32',

    lc_48(2) TYPE c VALUE '48',

    lc_56(2) TYPE c VALUE '56',

    *filed names

    lc_vbeln TYPE slis_fieldname VALUE 'vbeln',

    lc_vkorg TYPE slis_fieldname VALUE 'vkorg',

    lc_vkgrp TYPE slis_fieldname VALUE 'vkgrp',

    lc_kunnr TYPE slis_fieldname VALUE 'kunnr',

    lc_matnr TYPE slis_fieldname VALUE 'matnr',

    lc_posnr TYPE slis_fieldname VALUE 'posnr',

    lc_matkl TYPE slis_fieldname VALUE 'matkl',

    lc_werks TYPE slis_fieldname VALUE 'werks',

    lc_stlnr TYPE slis_fieldname VALUE 'stlnr'.

    *SO document

    PERFORM f_fill_fields TABLES t_fieldcat

    USING c_header lc_vbeln text-001 lc_1 space space.

    PERFORM f_fill_fields TABLES t_fieldcat

    USING c_header lc_vkorg text-002 lc_12 space space.

    PERFORM f_fill_fields TABLES t_fieldcat

    USING c_header lc_vkgrp text-003 lc_24 space space.

    PERFORM f_fill_fields TABLES t_fieldcat

    USING c_header lc_kunnr text-004 lc_35 space space.

    PERFORM f_fill_fields TABLES t_fieldcat

    USING c_item lc_matnr text-005 lc_5 space space.

    PERFORM f_fill_fields TABLES t_fieldcat

    USING c_item lc_posnr text-006 lc_22 space space.

    PERFORM f_fill_fields TABLES t_fieldcat

    USING c_item lc_matkl text-007 lc_32 space space.

    PERFORM f_fill_fields TABLES t_fieldcat

    USING c_item lc_werks text-008 lc_48 space space.

    PERFORM f_fill_fields TABLES t_fieldcat

    USING c_item lc_stlnr text-009 lc_56 space space.

    ENDFORM. " filed_catlog

    &----


    *& Form f_fill_fields

    &----


    • text

    ----


    • -->P_T_FIELDCAT text

    • -->P_C_HEADER text

    • -->P_LC_VBELN text

    • -->P_TEXT_001 text

    • -->P_LC_1 text

    • -->P_SPACE text

    • -->P_SPACE text

    ----


    FORM f_fill_fields TABLES p_t_fieldcat LIKE t_fieldcat

    USING p_tabname TYPE any

    p_fieldname TYPE any

    p_sel_text_l TYPE any

    p_length TYPE any

    p_hot TYPE any

    p_zero TYPE any.

    wa_fieldcat-tabname = P_TABNAME.

    wa_fieldcat-fieldname = P_FIELDNAME.

    wa_fieldcat-seltext_l = P_SEL_TEXT_l.

    wa_fieldcat-edit = 'x'.

    wa_fieldcat-outputlen = P_LENGTH.

    wa_fieldcat-hotspot = P_HOT.

    wa_fieldcat-no_zero = P_ZERO.

    APPEND wa_fieldcat TO P_T_FIELDCAT.

    CLEAR wa_fieldcat.

    ENDFORM. " f_fill_fields

    &----


    *& Form alv_disp

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM alv_disp TABLES

    • p_t_header LIKE i_header

    • p_t_item LIKE i_item

    p_t_fieldcat LIKE t_fieldcat

    USING p_x_print TYPE slis_print_alv.

    DATA : l_repid TYPE sy-repid.

    l_repid = sy-repid.

    t_keyinfo-header01 = 'vbeln'.

    t_keyinfo-item01 = 'matnr'.

    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

    EXPORTING

    i_callback_program = L_REPID

    it_fieldcat = P_T_FIELDCAT[]

    i_default = 'X'

    i_tabname_header = 'I_HEADER'

    i_tabname_item = 'I_ITEM'

    is_keyinfo = T_KEYINFO

    is_print = P_X_PRINT

    TABLES

    t_outtab_header = I_HEADER[]

    t_outtab_item = I_ITEM[].

    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. " alv_disp

    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.