Skip to Content
avatar image
Former Member

CALL transaction in ALV

Hi Experts,

I have created an ALV report which is working fine. now i have ot make it interactive but i am not getting where i have to add the code fr events etc. Requirements is whe User clicks on material it wil call MM03, when user click on Sales order it wil call VA03 wiht the corresponding values.

Below is the report created by me, can you please tell me where to add the code. I read so many threads in SDN but no one says where to write the interactive code, few gave a demo report but tht even not working fine. By those reports its nt clear to me where i have to call reuse alv events get FM or do i only need to put the user command in grid displya FM.

In my report i am using a perform for it_event which is for TOP of PAGE, please have a look on my existing report & answer accordingly.

&----


*& TABLES

&----


TABLES: AFKO, AFPO, AFVC, AFVV, T001W, VBEP.

TYPE-POOLS: slis.

&----


*& DATA DECLARATIONS

&----


DATA : t1 TYPE p ,

d1 TYPE i ,

age TYPE i ,

l_date type sy-datum,

i_date1 TYPE sy-datum,

i_time1 TYPE sy-uzeit.

DATA : v_repid LIKE sy-repid.

DATA : rem TYPE i.

&----


*& Internal Table declaration

&----


DATA : it_heading TYPE slis_t_listheader WITH HEADER LINE.

DATA : it_fcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.

DATA : lay TYPE slis_layout_alv.

DATA : it_sort_subtotal TYPE slis_t_sortinfo_alv WITH HEADER LINE.

DATA : it_event TYPE slis_t_event WITH HEADER LINE.

DATA : i_events TYPE slis_t_event,

w_events TYPE slis_alv_event.

DATA : BEGIN OF IT_AFVV OCCURS 0,

aplzl like afvv-aplzl,

aufpl like afvv-aufpl,

fsavd like afvv-fsavd,

vgw03 like afvv-vgw03,

END OF IT_AFVV.

DATA : BEGIN OF IT_AFVC OCCURS 0,

aufpl like afvc-aufpl,

werks like afvc-werks,

END OF IT_AFVC.

DATA : BEGIN OF IT_AFKO OCCURS 0,

aufnr like afko-aufnr,

plnbez like afko-plnbez,

maufnr like afko-maufnr,

aufpl like afko-aufpl,

END OF IT_AFKO.

DATA : BEGIN OF IT_VBEP OCCURS 0,

VBELN LIKE VBEP-VBELN,

POSNR LIKE VBEP-POSNR,

EDATU LIKE VBEP-EDATU,

END OF IT_VBEP.

DATA : BEGIN OF IT_AFPO OCCURS 0,

aufnr like afpo-aufnr,

kdauf like afpo-kdauf,

kdpos like afpo-kdpos,

pgmng like afpo-pgmng,

amein like afpo-amein,

matnr like afpo-matnr,

END OF IT_AFPO.

DATA : BEGIN OF IT_MARC OCCURS 0,

MATNR LIKE MARC-MATNR,

MATGR LIKE MARC-MATGR,

END OF IT_MARC.

DATA : BEGIN OF gt_final OCCURS 0,

matgr like marc-matgr,

vgw03 like afvv-vgw03,

fsavd like afvv-fsavd,

edatu type vbep-edatu,

item_no type i,

aufnr like afko-aufnr,

kdauf like afpo-kdauf,

kdpos like afpo-kdpos,

pgmng like afpo-pgmng,

amein like afpo-amein,

c_matnr like afpo-matnr,

c_maktx like makt-maktx,

matnr like afpo-matnr,

maktx like makt-maktx,

cut(1) TYPE c,

probs type Char40,

END OF gt_final.

&----


*& SELECTION SCREEN

&----


SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.

SELECT-OPTIONS : p_plant FOR t001W-werks OBLIGATORY .

SELECT-OPTIONS : p_date FOR AFVV-fsavd OBLIGATORY .

*SELECT-OPTIONS : p_rfgrp FOR afvc-rfgrp.

SELECT-OPTIONS : p_rfsch FOR afvc-rfsch.

SELECTION-SCREEN END OF BLOCK b1 .

&----


*& INITIALIZATION

&----


INITIALIZATION.

&----


*& AT SELECTION SCREEN

&----


AT SELECTION-SCREEN.

*--Validate plant

SELECT SINGLE * FROM t001w WHERE werks IN p_plant.

IF sy-subrc NE 0.

MESSAGE e001(319) WITH 'Plant does not Exist!'.

ENDIF.

&----


*& START OF SELECTION

&----


START-OF-SELECTION.

*--get data into internal table from database

PERFORM data_retrieve.

*--get data into final internal table after aging calculation.

PERFORM get_final.

*--get data from final internal table as per the radio button selected in selection screen

  • PERFORM selection_screen.

&----


*& END OF SELECTION

&----


END-OF-SELECTION.

*--display data in ALV form.

PERFORM data_display_alv.

&----


*& Form data_retrieve

&----


  • To Retrieve data from tables

----


FORM data_retrieve .

  • AFVV selection

SELECT aplzl aufpl fsavd vgw03

FROM AFVV

INTO TABLE it_afvv

WHERE fsavd IN p_date.

IF NOT it_afvv[] IS INITIAL.

  • afvc selection

SELECT aufpl werks

FROM AFVC

INTO TABLE it_afvc

FOR ALL ENTRIES IN it_afvv

WHERE aufpl EQ it_afvv-aufpl

AND aplzl EQ it_afvv-aplzl

AND werks IN p_plant

AND rfgrp EQ '3'

AND rfsch IN p_rfsch.

IF NOT it_afvc[] IS INITIAL.

  • afko selection

SELECT aufnr plnbez maufnr aufpl

FROM afko

INTO TABLE it_afko

FOR ALL ENTRIES IN it_afvc

WHERE aufpl EQ it_afvc-aufpl.

  • GROUP BY PLNBEZ AUFNR maufnr aufpl.

IF NOT it_afko[] IS INITIAL.

  • afpo selection

SELECT aufnr kdauf kdpos pgmng amein matnr

FROM afpo

INTO TABLE it_afpo

FOR ALL ENTRIES IN it_afko

WHERE aufnr EQ it_afko-aufnr.

  • SELECT aufnr matnr

  • FROM afpo

  • INTO TBALE it_afpo2

  • FOR all entries in it-afko

  • WHERE aufnr = maufnr.

IF NOT it_afpo[] IS INITIAL.

SELECT MATNR MATGR FROM MARC INTO TABLE IT_MARC

FOR ALL ENTRIES IN IT_AFPO

WHERE MATNR EQ IT_AFPO-MATNR.

SELECT VBELN POSNR EDATU FROM VBEP INTO TABLE IT_VBEP

FOR ALL ENTRIES IN IT_AFPO

WHERE VBELN EQ IT_AFPO-KDAUF

AND POSNR EQ IT_AFPO-KDPOS.

IF sy-subrc <> 0.

MESSAGE i001(319) WITH 'No Data exist for the given combination !' .

EXIT.

ENDIF.

endif.

ENDIF.

ENDIF.

ENDIF.

ENDFORM. " data_retrieve.

&----


*& Form ale_event_top_of_page

&----


  • Heading in ALV

----


FORM ale_event_top_of_page.

DATA l_date(10).

WRITE sy-datum TO l_date.

DATA : t_plant TYPE string.

PERFORM alv_heading

USING 'H' '' 'XYZ COMPANY LTD'.

PERFORM alv_heading

USING 'S' 'Title' sy-title.

PERFORM alv_heading

USING 'S' 'Date' l_date.

*****To display Plant range in ALV report if range selected

IF p_plant-high IS NOT INITIAL.

CONCATENATE p_plant-low 'To' p_plant-high INTO t_plant SEPARATED BY space.

ELSE.

MOVE p_plant-low TO t_plant.

ENDIF.

CONDENSE t_plant.

PERFORM alv_heading

USING 'S' 'Plant' t_plant.

*--for heading of ALV

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = it_heading[].

CLEAR it_heading[].

ENDFORM. " ALE_EVENT_TOP_OF_PAGE

&----


*& Form data_display_alv

&----


  • display data in ALV form

----


FORM data_display_alv.

DATA: v_repid LIKE sy-repid.

PERFORM alv_events USING 'TOP_OF_PAGE' 'ALE_EVENT_TOP_OF_PAGE'.

PERFORM alv_declare_key_fields.

PERFORM alv_layout.

PERFORM alv_it_sort_subtotal.

PERFORM event_get.

PERFORM alv_grid_display.

ENDFORM. " data_display_alv

&----


*& Form alv_events

&----


FORM alv_events USING name

form.

CLEAR it_event.

it_event-name = name.

it_event-form = form.

APPEND it_event.

ENDFORM. " alv_events

&----


*& Form alv_declare_key_fields

&----


  • Declaring fields to display in ALV

----


FORM alv_declare_key_fields .

PERFORM ale_field_catagory

USING '1' 'ITEM_NO' '' '' 'X' '' '' 'L' '' '' '' '' 'Item No.'.

PERFORM ale_field_catagory

USING '8' 'AUFNR' '' '' '' '' '' 'L' '' '' '' '' 'Order'.

PERFORM ale_field_catagory

USING '9' 'KDAUF' '' '' '' '' '' 'L' '' '' '' '' 'Sales Order'.

PERFORM ale_field_catagory

USING '10' 'KDPOS' '' '' '' '' '' 'L' '' '' '' '' 'Item'.

PERFORM ale_field_catagory

USING '11' 'PGMNG' '' '' '' '' '' 'L' '' '' '' '' 'Quantity'.

PERFORM ale_field_catagory

USING '12' 'AMEIN' '' '' '' '' '' 'L' '' '' '' '' 'Unit'.

PERFORM ale_field_catagory

USING '13' 'C_MATNR' '' '' '' '' '' 'L' '' '' '' '' 'Config. Material'.

PERFORM ale_field_catagory

USING '14' 'C_MAKTX' '' '' '' '' '' 'L' '' '' '' '' 'Description'.

  • PERFORM ale_field_catagory

  • USING '15' 'AUFNR' '' '' '' '' '' 'L' '' '' '' '' 'Order'.

PERFORM ale_field_catagory

USING '3' 'MATNR' '' '' '' '' '' 'L' '' 'X' '' '' 'Material'.

PERFORM ale_field_catagory

USING '4' 'MAKTX' '' '' '' '' '' 'L' '' '' '' '' 'Description'.

ENDFORM. " alv_declare_key_fields

&----


*& Form ale_field_catagory

&----


  • field display catlog

----


  • -->P_0404 text

  • -->P_0405 text

  • -->P_0406 text

  • -->P_0407 text

  • -->P_0408 text

  • -->P_0409 text

  • -->P_0410 text

  • -->P_0411 text

  • -->P_0412 text

  • -->P_0413 text

  • -->P_0414 text

  • -->P_0415 text

----


FORM ale_field_catagory USING col_pos

fieldname

key

no_zero

do_sum

edit_mask

check

just

no_sum

hotspot

emphasize

icon

htext.

CLEAR it_fcat.

it_fcat-col_pos = col_pos .

it_fcat-fieldname = fieldname.

it_fcat-key = key.

it_fcat-no_zero = no_zero.

it_fcat-do_sum = do_sum.

it_fcat-edit_mask = edit_mask.

it_fcat-checkbox = check.

it_fcat-just = just.

it_fcat-no_sum = no_sum.

it_fcat-hotspot = hotspot.

it_fcat-emphasize = emphasize.

it_fcat-icon = icon.

it_fcat-seltext_l = htext.

APPEND it_fcat.

ENDFORM. " ale_field_catagory

&----


*& Form alv_layout

&----


  • For ALV Layout

----


FORM alv_layout .

lay-zebra = 'X'.

lay-f2code = '&ETA'.

lay-detail_popup = 'X'.

ENDFORM. " alv_layout

&----


*& Form alv_it_sort_subtotal

&----


  • sort & subtotal

----


*

FORM alv_it_sort_subtotal .

PERFORM ale_sort

USING 'MATNR' 'X' 'X'.

ENDFORM. " alv_it_sort_subtotal

&----


*& Form ale_sort

&----


  • text

----


  • -->P_0734 text

  • -->P_0735 text

  • -->P_0736 text

----


FORM ale_sort USING fieldname

subtotal

up.

CLEAR it_sort_subtotal.

it_sort_subtotal-fieldname = fieldname.

it_sort_subtotal-subtot = subtotal.

it_sort_subtotal-up = up.

APPEND it_sort_subtotal.

ENDFORM. " ale_sort

&----


*& Form alv_grid_display

&----


  • ALV Display in grid form

----


FORM alv_grid_display .

v_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = v_repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

is_layout = lay

it_fieldcat = it_fcat[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

it_sort = it_sort_subtotal[]

it_events = it_event[]

TABLES

t_outtab = gt_final[]

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

&----


*& Form alv_heading

&----


  • text

----


FORM alv_heading USING typ

key

info.

CLEAR it_heading.

it_heading-typ = typ.

it_heading-key = key.

it_heading-info = info.

APPEND it_heading.

.

ENDFORM. " alv_heading

&----


*& Form get_final

&----


  • Get values in final internal table

----


FORM get_final.

DATA: i_day like dtresr-weekday.

LOOP AT it_afko .

***filling final internal table with gt_allow_sl3 table

gt_final-aufnr = it_afko-aufnr.

READ TABLE it_afpo WITH KEY aufnr = it_afko-aufnr.

READ TABLE it_marc with key matnr = it_afpo-matnr.

READ TABLE it_afvv WITH KEY Aufpl = it_afko-aufpl.

READ TABLE it_vbep WIth KEY vbeln = it_afpo-kdauf posnr = it_afpo-kdpos.

gt_final-matgr = it_marc-matgr.

gt_final-vgw03 = it_afvv-vgw03.

gt_final-fsavd = it_afvv-fsavd.

gt_final-edatu = it_vbep-edatu.

gt_final-item_no = '1'.

gt_final-kdauf = it_afpo-kdauf.

gt_final-kdpos = it_afpo-kdpos.

gt_final-pgmng = it_afpo-pgmng.

gt_final-amein = it_afpo-amein.

gt_final-matnr = it_afpo-matnr.

CALL FUNCTION 'SUPO_MD_MATERIAL_GET_TEXT'

EXPORTING

EV_MATNR = gt_final-matnr

EV_LANGU = 'EN'

IMPORTING

EV_MATTEXT = gt_final-maktx

EXCEPTIONS

NO_TEXT_FOUND = 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.

IF it_afko-maufnr EQ SPACE.

gt_final-c_matnr = it_afko-plnbez.

ELSE.

READ TABLE IT_AFPO WITH KEY AUFNR = IT_AFKO-MAUFNR.

gt_final-c_matnr = it_afpo-matnr.

ENDIF.

CALL FUNCTION 'SUPO_MD_MATERIAL_GET_TEXT'

EXPORTING

EV_MATNR = gt_final-c_matnr

EV_LANGU = 'EN'

IMPORTING

EV_MATTEXT = gt_final-c_maktx

EXCEPTIONS

NO_TEXT_FOUND = 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.

APPEND gt_final.

CLEAR :it_afko, it_afpo.

SORT gt_FINAL ASCENDING BY MATNR.

ENDLOOP.

ENDFORM. "get_final

Regards,

Nik

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Feb 27, 2008 at 04:00 AM

    Hi Nikhil,

    For Interactive ALV you need to call the event "USER_COMMAND, it is same as the event "TOP_OF_PAGE" but coding differs. And you have to add the code after u have filled the field catalog and before calling the ALV Grid FM.

    Below is the code which will match exactly for ur requirement.

    PERFORM define_events1.

    &----


    *& Form define_events1

    &----


    • events for user command

    ----


    FORM define_events1.

    s_event-name = slis_ev_user_command.

    s_event-form = 'USER_COMMAND'.

    APPEND s_event TO t_events.

    CLEAR s_event.

    ENDFORM. " define_events1

    &----


    *& Form USER_COMMAND

    &----


    • User command output

    ----


    FORM user_command USING ucom LIKE sy-ucomm

    fldinfo TYPE slis_selfield.

    DATA: l_tabix TYPE sy-tabix.

    CLEAR l_tabix.

    l_tabix = fldinfo-tabindex.

    SORT t_final BY vbeln.

    CLEAR t_final.

    READ TABLE t_final INDEX l_tabix.

    IF fldinfo-fieldname = 'KUNNR'.

    SET PARAMETER ID 'KUN' FIELD t_final-kunnr.

    CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.

    ELSEIF fldinfo-fieldname = 'MATNR'.

    SET PARAMETER ID 'MAT' FIELD t_final-matnr.

    CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.

    ELSEIF fldinfo-fieldname = 'VBELN'.

    SET PARAMETER ID 'AUN' FIELD t_final-vbeln.

    CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.

    ENDIF.

    ENDFORM. "user_command

    Hope this answers ur question...

    Regards,

    Asif

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Try it this way:

      IF rs_selfield-sel_tab_field = '<itab>-MATNR'.   " Use field SEL_TAB_FIELD of structure SLIS_SELFIELD and use the Intenal table and field
      
         SET PARAMETER ID 'MAT' FIELD gt_final-matnr.
         CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
      
      ELSEIF rs_selfield-sel_tab_field = '<itab>-KDPOS'.
      
         SET PARAMETER ID 'AUN' FIELD gt_final-kdpos.
         CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
      
      ENDIF.
      Here <itab> is the internal table which you use for display.

  • avatar image
    Former Member
    Feb 27, 2008 at 04:02 AM

    HI

    SEE THIS REPORT WHERE I HAD CALLED A TRANSACTION XD03 WHEN I DOUBLE CLICK ON ANY LINE

    &----


    *& Report ZNNR_SAMPLEALV

    *&

    &----


    *&

    *&

    &----


    REPORT ZNNR_SAMPLEALV.

    TYPE-POOLS : slis.

    *ALV Formatting tables /structures

    DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.

    DATA: gt_events TYPE slis_t_event.

    DATA: gs_layout TYPE slis_layout_alv.

    DATA: gt_page TYPE slis_t_listheader.

    DATA: gs_page TYPE slis_listheader.

    DATA: v_repid LIKE sy-repid.

    *ALV Formatting work area

    DATA: w_fieldcat TYPE slis_fieldcat_alv.

    DATA: w_events TYPE slis_alv_event.

    DATA: gt_bsid TYPE TABLE OF bsid WITH HEADER LINE.

    INITIALIZATION.

    PERFORM build_events.

    PERFORM build_page_header.

    START-OF-SELECTION.

    *perform build_comment. "top_of_page - in initialization at present

    SELECT * FROM bsid INTO TABLE gt_bsid UP TO 10 ROWS.

    *perform populate_for_fm using '1' '3' 'BUKRS' '8' 'GT_BSID' 'Whee'.

    *USING = Row, Column, Field name, display length, table name, heading

    *OR

    PERFORM build_fieldcat.

    gs_layout-zebra = 'X'.

    *top of page event does not work without I_callback_program

    v_repid = sy-repid.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    i_callback_program = v_repid

    i_structure_name = 'BSID'

    • i_background_id = 'ALV_BACKGROUND'

    i_grid_title = 'This is the grid title'

    • I_GRID_SETTINGS =

    is_layout = gs_layout

    it_fieldcat = gt_fieldcat[]

    it_events = gt_events[]

    TABLES

    t_outtab = gt_bsid.

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

    • Form..............: populate_for_fm

    • Description.......: Populates fields for function module used in ALV

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

    FORM populate_for_fm USING p_row

    p_col

    p_fieldname

    p_len

    p_table

    p_desc.

    w_fieldcat-row_pos = p_row. "Row Position

    w_fieldcat-col_pos = p_col. "Column Position

    w_fieldcat-fieldname = p_fieldname. "Field name

    w_fieldcat-outputlen = p_len. "Column Lenth

    w_fieldcat-tabname = p_table. "Table name

    w_fieldcat-reptext_ddic = p_desc. "Field Description

    w_fieldcat-input = '1'.

    APPEND w_fieldcat TO gt_fieldcat.

    CLEAR w_fieldcat.

    ENDFORM. " populate_for_fm

    &----


    *& Form build_events

    &----


    FORM build_events.

    DATA: ls_event TYPE slis_alv_event.

    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

    EXPORTING

    i_list_type = 0

    IMPORTING

    et_events = gt_events.

    READ TABLE gt_events

    WITH KEY name = slis_ev_user_command

    INTO ls_event.

    IF sy-subrc = 0.

    MOVE slis_ev_user_command TO ls_event-form.

    APPEND ls_event TO gt_events.

    ENDIF.

    READ TABLE gt_events

    WITH KEY name = slis_ev_top_of_page

    INTO ls_event.

    IF sy-subrc = 0.

    MOVE slis_ev_top_of_page TO ls_event-form.

    APPEND ls_event TO gt_events.

    ENDIF.

    ENDFORM. " build_events

    &----


    *& Form USER_COMMAND

    &----


    • When user command is called it uses 2 parameters. The itab

    • passed to the ALV is in whatever order it currently is on screen.

    • Therefore, you can read table itab index rs_selfield-tabindex to get

    • all data from the table. You can also check r_ucomm and code

    • accordingly.

    &----


    FORM user_command USING r_ucomm LIKE sy-ucomm

    rs_selfield TYPE slis_selfield.

    READ TABLE gt_bsid INDEX rs_selfield-tabindex.

    • error checking etc.*

    SET PARAMETER ID 'KUN' FIELD gt_bsid-kunnr.

    CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.

    ENDFORM. "user_command

    &----


    *& Form top_of_page

    &----


    • Your own company logo can go here if it has been saved (OAOR)

    • If the logo is larger than the size of the headings in gt_page,

    • the window will not show full logo and will have a scroll bar. Thus,

    • it is a good idea to have a standard ALV header if you are going to

    • use logos in your top of page.

    &----


    FORM top_of_page.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    it_list_commentary = gt_page

    i_logo = 'ENJOYSAP_LOGO'.

    ENDFORM. "top_of_page

    &----


    *& Form build_fieldcat

    &----


    *Many and varied fields are available here. Have a look at documentation

    *for FM REUSE_ALV_LIST_DISPLAY and REUSE_ALV_FIELDCATALOG_MERGE

    ----


    FORM build_fieldcat.

    w_fieldcat-fieldname = 'BUDAT'.

    w_fieldcat-seltext_m = 'Dte pst'.

    w_fieldcat-ddictxt(1) = 'M'.

    w_fieldcat-edit = 'x'.

    • Can change the position of fields if you do not want them in order

    • of the DDIC or itab

    • w_fieldcat-row_pos = '1'.

    • w_fieldcat-col_pos = '10'.

    APPEND w_fieldcat TO gt_fieldcat.

    CLEAR w_fieldcat.

    ENDFORM. " build_fieldcat

    &----


    *& Form build_page_header

    &----


    • gt_page is used in top of page (ALV subroutine - NOT event)

    • *H = Header, S = Selection, A = Action

    ----


    FORM build_page_header.

    • For Headers, Key is not printed and is irrelevant. Will not cause

    • a syntax error, but is not used.

    gs_page-typ = 'H'.

    gs_page-info = 'Header 1'.

    APPEND gs_page TO gt_page.

    gs_page-typ = 'H'.

    gs_page-info = 'Header 2'.

    APPEND gs_page TO gt_page.

    • For Selections, the Key is printed (bold). It can be anything up to 20

    • bytes. It gets printed in order of code here, not by key value.

    gs_page-typ = 'S'.

    gs_page-key = 'And the winner is:'.

    gs_page-info = 'Selection 1'.

    APPEND gs_page TO gt_page.

    gs_page-typ = 'S'.

    gs_page-key = 'Runner up:'.

    gs_page-info = 'Selection 2'.

    APPEND gs_page TO gt_page.

    • For Action, Key is also irrelevant.

    gs_page-typ = 'A'.

    gs_page-info = 'Action goes here'.

    APPEND gs_page TO gt_page.

    ENDFORM. " build_page_header

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 27, 2008 at 08:39 AM

    Nikhil,

    This will work ....

    In your FM REUSE_ALV_GRID_DISPLAY you have missed Usercommand

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    i_callback_program = ws_repid

    i_callback_user_command = 'USER_COMMAND'

    is_layout = gs_layout

    it_fieldcat = gt_fieldcat_alv[]

    i_default = 'A'

    i_save = g_save

    is_variant = gx_variant

    TABLES

    t_outtab = it_final.

    IF sy-subrc <> 0.

    ENDIF.

    ENDFORM. " data_display

    &----


    *& Form USER_COMMAND

    &----


    FORM user_command USING r_ucomm LIKE sy-ucomm

    rs_selfield TYPE slis_selfield.

    IF rs_selfield-sel_tab_field = '<it_final>-MATNR'. " Use field SEL_TAB_FIELD of structure SLIS_SELFIELD and use the Intenal table and field

    SET PARAMETER ID 'MAT' FIELD gt_final-matnr.

    CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.

    ELSEIF rs_selfield-sel_tab_field = '<it_final>-KDPOS'.

    SET PARAMETER ID 'AUN' FIELD gt_final-kdpos.

    CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.

    ENDIF.

    ENDFORM. "user_command

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Using CALL TRANSACTION we can skip first screen by passing the required values via Parameter ID's. Here in your case you need to select specific view and skip the screen. So you want to skip the second screen of the transaction, so i guess you can not do it without BDC.

  • avatar image
    Former Member
    Feb 28, 2008 at 06:11 AM

    This piece of code is for defining ALV using FM,On clicking the filed, a transaction is called.& for another field LONG TEXT is displayed.Hope it clears ur doubt.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    i_bypassing_buffer = 'X'

    i_callback_program = sy-repid

    i_callback_user_command = 'USER_COMMAND'

    is_layout = layout

    it_fieldcat = lt_fcat

    i_save = 'A'

    i_callback_top_of_page = 'TOP_OF_PAGE'

    TABLES

    t_outtab = lit_alv

    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 user_command USING r_ucomm LIKE sy-ucomm

    rs_selfield TYPE slis_selfield.

    CASE rs_selfield-fieldname.

    WHEN 'ICON'.

    CALL FUNCTION 'READ_TEXT'

    EXPORTING

    id = 'LTXT'

    language = sy-langu

    name = v_name

    object = 'QMSM'

    TABLES

    lines = lit_lines

    EXCEPTIONS

    id = 1

    language = 2

    name = 3

    not_found = 4

    object = 5

    reference_check = 6

    wrong_access_to_archive = 7

    OTHERS = 8.

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    lit_header-tdobject = 'QMSM'.

    lit_header-tdname = v_name.

    lit_header-tdid = 'LTXT'.

    lit_header-tdspras = sy-langu.

    lit_header-tdlinesize = 72.

    CALL FUNCTION 'EDIT_TEXT'

    EXPORTING

    display = 'X'

    header = lit_header

    TABLES

    lines = lit_lines

    EXCEPTIONS

    id = 1

    language = 2

    linesize = 3

    name = 4

    object = 5

    textformat = 6

    communication = 7

    OTHERS = 8.

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    WHEN 'QMNUM'.

    SET PARAMETER ID 'IQM' FIELD rs_selfield-value.

    CALL TRANSACTION 'IQS3' AND SKIP FIRST SCREEN.

    ENDCASE.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 29, 2008 at 03:00 AM

    Thread closed My problem is solved

    Regards,

    Nik

    Add comment
    10|10000 characters needed characters exceeded