Application Development and Automation 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: 
Read only

FM

Former Member
0 Likes
735

hello gurus,

i hav problem in FM

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

  • EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = 'SY-RAPID '

I_CALLBACK_PF_STATUS_SET = 'PF-STATUS '

I_CALLBACK_USER_COMMAND = 'R_USER '

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

IT_FIELDCAT = T_FCAT

  • 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

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB =

  • 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.

i want to creat pf-status and user command in alv grid , now problem is , i m not able to find it how to write the FORM statement for these two , not for these two i want all the field mention in function module (FORM STATEMENT) WHAT IS THE WAY TO SEE THE DISCRIPTION PART OF IT , WHICH FIELDS ARE MANDATORY TO DEFINE IN FORM STATEMENTS

4 REPLIES 4
Read only

Former Member
0 Likes
706

Hi,

Please refer the link below:

http://www.sapdev.co.uk/reporting/alv/alvgrid_pfstatus.htm

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
706

1. User Command

PERFORM user_command.



FORM user_command USING r_ucomm LIKE sy-ucomm.

  CASE r_ucomm.

ENDCASE.

DATA :

i_event TYPE slis_t_event,

wa_event TYPE slis_alv_event,

DATA: l_tabix TYPE sy-tabix.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = i_event

EXCEPTIONS

list_type_wrong = 1

OTHERS = 2.

*- USER COMMAND Event

READ TABLE i_event WITH KEY name = slis_ev_user_command INTO wa_event.

CLEAR l_tabix.

l_tabix = sy-tabix.

IF sy-subrc = 0.

MOVE slis_ev_user_command TO wa_event-form.

MODIFY i_event FROM wa_event INDEX l_tabix TRANSPORTING form.

ENDIF.

2. PF Status

After Start of selection use the below statement

SET PF-STATUS 'STANDARD'.

Pass i_events and 'STANDARD' to the FM.

Edited by: Raj on May 6, 2008 5:35 PM

Edited by: Raj on May 6, 2008 5:37 PM

Read only

Former Member
0 Likes
706

Go through the links below for any requiremnets in alv

Check these links out , if helpful award point

ALV OOPS Blog

/people/vijaybabu.dudla/blog/2006/07/21/topofpage-in-alv-using-clguialvgrid

Simple ALV report

http://www.sapgenie.com/abap/controls/alvgrid.htm

http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox

ALV Interactive Reports

ALV Easy Reference Guide OOPS

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a41...

ALV

1. Please give me general info on ALV.

http://www.sapfans.com/forums/viewtopic.php?t=58286

http://www.sapfans.com/forums/viewtopic.php?t=76490

http://www.sapfans.com/forums/viewtopic.php?t=20591

http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.

2. How do I program double click in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=11601

http://www.sapfans.com/forums/viewtopic.php?t=23010

Check the program in the following link:

http://sap-img.com/abap/display-secondary-list-using-alv-grid.htm

3. How do I add subtotals (I have problem to add them)...

http://www.sapfans.com/forums/viewtopic.php?t=20386

http://www.sapfans.com/forums/viewtopic.php?t=85191

http://www.sapfans.com/forums/viewtopic.php?t=88401

http://www.sapfans.com/forums/viewtopic.php?t=17335

http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_basic.htm

4. How to add list heading like top-of-page in ABAP lists?

http://www.sapfans.com/forums/viewtopic.php?t=58775

http://www.sapfans.com/forums/viewtopic.php?t=60550

http://www.sapfans.com/forums/viewtopic.php?t=16629

5. How to print page number / total number of pages X/XX in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)

6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.

http://www.sapfans.com/forums/viewtopic.php?t=64320

http://www.sapfans.com/forums/viewtopic.php?t=44477

7. How can I set the cell color in ALV?

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/coloring%2ba%2brow%2band%2bcolumn%2bin%2...

8. How do I print a logo/graphics in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=81149

http://www.sapfans.com/forums/viewtopic.php?t=35498

http://www.sapfans.com/forums/viewtopic.php?t=5013

9. How do I create and use input-enabled fields in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=84933

http://www.sapfans.com/forums/viewtopic.php?t=69878

10. How can I use ALV for reports that are going to be run in background?

http://www.sapfans.com/forums/viewtopic.php?t=83243

http://www.sapfans.com/forums/viewtopic.php?t=19224

11. How can I display an icon in ALV? (Common requirement is traffic light icon).

http://www.sapfans.com/forums/viewtopic.php?t=79424

http://www.sapfans.com/forums/viewtopic.php?t=24512

12. How can I display a checkbox in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=88376

http://www.sapfans.com/forums/viewtopic.php?t=40968

http://www.sapfans.com/forums/viewtopic.php?t=6919

13. Top-of-page in ALV

14. ALV Group Heading

http://www.sap-img.com/fu037.htm

How to add list heading like top-of-page in ABAP lists?

http://www.sapfans.com/forums/viewtopic.php?t=58775

http://www.sapfans.com/forums/viewtopic.php?t=60550

http://www.sapfans.com/forums/viewtopic.php?t=16629

15. ALV output to PDF conversion

It has an example code for PDF Conversion.

http://www.erpgenie.com/abap/code/abap51.htm

Go thru these programs they may help u to try on some hands on

ALV Demo program

BCALV_DEMO_HTML

BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode

BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode

BCALV_GRID_DEMO Simple ALV Control Call Demo Program

BCALV_TREE_DEMO Demo for ALV tree control

BCALV_TREE_SIMPLE_DEMO

BC_ALV_DEMO_HTML_D0100

reward if helpful

i m also posting a sample ALV grid program for your reference

you can get the code required to you in that

&----


*& Report Z11AP_ALV *

*& *

&----


*& *

*& DESCRIPTION : PRINTING OF SALES ORDER USING ALV. *

&----


report z11ap_alv message-id z11ap .

      • TYPE DECLARATION

type-pools : slis.

types:begin of t_vbak,

vbeln type vbeln_va, "Sales Document

erdat type erdat, "Date on which the record was created

auart type auart, "Sales Document Type

netwr type netwr_ak, "Net Value in Document Currency

waerk type waerk, "SD document currency

vkorg type vkorg, "Sales Organization

vtweg type vtweg, "Distribution Channel

spart type spart, "Division

kunnr type kunag, "Sold-to party

end of t_vbak.

types:begin of t_vbap,

vbeln type vbeln_va, "Sales Document

posnr type posnr_va, "Sales Document Item

matnr type matnr, "Material no

arktx type arktx, "Description

end of t_vbap.

types : begin of t_kna1,

kunnr type kunnr,

land1 type land1_gp, "country

name1 type name1_gp, " Name

ort01 type ort01_gp, " Address

telf1 type telf1, " Telephone No

end of t_kna1.

types: begin of t_vbak_kna1,

vbeln type vbeln_va, "Sales Document

kunnr type kunnr,

erdat type erdat, "Date on which the record was created

auart type auart, "Sales Document Type

netwr type netwr_ak, "Net Value in Document Currency

waerk type waerk, "SD document currency

vkorg type vkorg, "Sales Organization

vtweg type vtweg, "Distribution Channel

spart type spart, "Division

land1 type land1_gp, "country

name1 type name1_gp, " Name

ort01 type ort01_gp, " Address

telf1 type telf1, " Telephone No

end of t_vbak_kna1.

types:begin of t_sales_order,

vbeln type vbeln_va, "Sales Document

posnr type posnr_va, "Sales Document Item

kunnr type kunnr,

v_lights type c,

erdat type erdat, "Date on which the record was created

auart type auart, "Sales Document Type

netwr type netwr_ak, "Net Value in Document Currency

waerk type waerk, "SD document currency

vkorg type vkorg, "Sales Organization

vtweg type vtweg, "Distribution Channel

spart type spart, "Division

matnr type matnr, "Material no

arktx type arktx, "Description

land1 type land1_gp, "country

name1 type name1_gp, " Name

ort01 type ort01_gp, " Address

telf1 type telf1, " Telephone No

end of t_sales_order.

***DATA DECLARATION

data:wa_vbak type t_vbak,

wa_vbap type t_vbap,

wa_kna1 type t_kna1,

wa_vbak_kna1 type t_vbak_kna1,

wa_sales_order type t_sales_order.

*&--work area for layout

data: wa_layout type slis_layout_alv.

data:it_vbak type standard table of t_vbak.

data:it_vbap type standard table of t_vbap.

data: it_kna1 type standard table of t_kna1.

data: it_vbak_kna1 type standard table of t_vbak_kna1.

data:it_sales_order type standard table of t_sales_order.

data: v_progname like sy-repid,

v_gridtitle type lvc_title.

*&---Internal table for field catalog

data: i_fieldcat type slis_t_fieldcat_alv,

*&---Internal table for the sorting sequence.

i_sortinfo type slis_t_sortinfo_alv,

*&---Internal table for the event catalog.

i_eventcat type slis_t_event,

*&---Internal table for the top of page event

i_listheader type slis_t_listheader.

  • INITIALIZATION

initialization.

v_progname = sy-repid.

refresh : it_vbak,

it_vbap,

it_kna1,

it_vbak_kna1,

i_fieldcat,

it_sales_order,

i_sortinfo,

i_eventcat,

i_listheader.

clear : wa_vbak,

wa_vbap,

wa_kna1,

wa_vbak_kna1,

wa_sales_order.

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

  • SELECTION SCREEN

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

selection-screen begin of block v1 with frame.

select-options : sd_no for wa_vbak-vbeln.

select-options : cr_on for wa_vbak-erdat.

selection-screen end of block v1.

  • SELECTION-SCREEN VALIDATIONS

at selection-screen.

*start-of-selection.

start-of-selection.

select

vbeln

erdat

auart

netwr

waerk

vkorg

vtweg

spart

kunnr into table it_vbak from vbak where

vbeln in sd_no and

erdat in cr_on.

if it_vbak[] is not initial.

select

vbeln

posnr

matnr

arktx

into table it_vbap from vbap for all

entries in it_vbak where vbeln = it_vbak-vbeln.

endif.

sort it_vbap by vbeln posnr.

if it_vbak[] is not initial.

select

kunnr

land1

name1

ort01

telf1

into table it_kna1 from kna1 for all

entries in it_vbak where kunnr = it_vbak-kunnr.

.

endif.

sort it_vbak by vbeln.

sort it_kna1 by kunnr.

loop at it_vbak into wa_vbak.

move-corresponding wa_vbak to wa_vbak_kna1.

read table it_kna1 with key kunnr = wa_vbak-kunnr

binary search transporting no fields.

loop at it_kna1 into wa_kna1 from sy-tabix.

if wa_kna1-kunnr <> wa_vbak-kunnr.

exit.

endif.

move-corresponding wa_kna1 to wa_vbak_kna1.

append wa_vbak_kna1 to it_vbak_kna1 .

endloop.

endloop.

sort it_vbak_kna1 by vbeln kunnr.

sort it_vbap by vbeln posnr.

loop at it_vbak_kna1 into wa_vbak_kna1.

move-corresponding wa_vbak_kna1 to wa_sales_order.

read table it_vbap with key vbeln = wa_vbak_kna1-vbeln

binary search transporting no fields.

loop at it_vbap into wa_vbap from sy-tabix.

if wa_vbap-vbeln <> wa_vbak_kna1-vbeln.

exit.

endif.

move-corresponding wa_vbap to wa_sales_order.

append wa_sales_order to it_sales_order .

endloop.

endloop.

end-of-selection.

*If Internal Table Is Populated Then Only Display Alv Report.

if not it_sales_order is initial.

  • &---Prepare fieldcatalog .

perform zf_build_fieldcat using i_fieldcat.

  • MODIFY the records IN the internal TABLE for the traffic lights.

perform zf_modify_final.

  • &---Build event catalog.

perform zf_eventcat using i_eventcat.

  • &---Build Listheader for TOP OF PAGE EVENT.

perform zf_build_listheader using i_listheader.

  • &---Build sorting.

perform zf_sorting using i_sortinfo.

  • &---Build layout.

perform zf_layout.

  • &---Initializating Grid Title

perform zf_build_grid_title.

****

  • &---Display alv grid.

perform zf_display_alv_grid.

else.

*&---If Table is not Populated ie Records Does not exist

message 'Record Does Not Exist' type 'S'.

endif.

at user-command.

case sy-ucomm.

when '&IC1'.

message 'tRY' type 'I'.

endcase.

at line-selection.

write : 'TRY'.

&----


*& Form zf_build_fieldcat

&----


  • text

----


  • -->P_I_FIELDCAT text

----


form zf_build_fieldcat using p_i_fieldcat type slis_t_fieldcat_alv.

data:l_fieldcat type slis_fieldcat_alv.

clear l_fieldcat.

l_fieldcat-col_pos = '1'. " POSITION OF THE COLUMN

l_fieldcat-fieldname = 'VBELN'.

" FIELD FOR WHICH CATALOG ID FILLED.

l_fieldcat-tabname = 'IT_SALES_ORDER'.

" INTERNAL TABLE TO WHICH FIELD BELONGS TO

l_fieldcat-key = 'x'.

" SO THAT this field is not scrollable and hiddable.

l_fieldcat-just = 'L'. " FOR JUSTIFICATION

l_fieldcat-hotspot = 'x'.

" MARK THIS field as hotsopt to cause the f2 events to trigger.

  • l_fieldcat-lzero = 'x'. " OUTPUT WITH leading zeros.

l_fieldcat-seltext_l = 'Sales Order Number'." long text for header.

l_fieldcat-seltext_m = 'Sales Order No.'. " medium text for header.

l_fieldcat-seltext_s = 'SO No.'. " sort text for header.

l_fieldcat-outputlen = 20. " SET THE output length.

l_fieldcat-ref_tabname = 'VBAK'.

" FOR F1 & F4 help as refernced to the ddic table.

append l_fieldcat to p_i_fieldcat.

clear l_fieldcat.

l_fieldcat-col_pos = '2'. " POSITION OF THE COLUMN

l_fieldcat-fieldname = 'POSNR'.

" FIELD FOR WHICH CATALOG ID FILLED.

l_fieldcat-tabname = 'IT_SALES_ORDER'.

" INTERNAL TABLE TO WHICH FIELD BELONGS TO

l_fieldcat-key = 'x'.

" SO THAT this field is not scrollable and hiddable.

l_fieldcat-just = 'L'. " FOR JUSTIFICATION

  • l_fieldcat-hotspot = 'x'.

" MARK THIS field as hotsopt to cause the f2 events to trigger.

  • l_fieldcat-lzero = 'x'. " OUTPUT WITH leading zeros.

l_fieldcat-seltext_l = 'Sales Document Item'." long text for header.

l_fieldcat-seltext_m = 'Sales Doc Item'. " medium text for header.

l_fieldcat-seltext_s = 'SD Item'. " sort text for header.

l_fieldcat-outputlen = 20. " SET THE output length.

l_fieldcat-ref_tabname = 'VBAP'.

" FOR F1 & F4 help as refernced to the ddic table.

append l_fieldcat to p_i_fieldcat.

clear l_fieldcat.

l_fieldcat-col_pos = '3'. " POSITION OF THE COLUMN

l_fieldcat-fieldname = 'MATNR'.

" FIELD FOR WHICH CATALOG ID FILLED.

l_fieldcat-tabname = 'IT_SALES_ORDER'.

" INTERNAL TABLE TO WHICH FIELD BELONGS TO

l_fieldcat-key = 'x'.

" SO THAT this field is not scrollable and hiddable.

l_fieldcat-just = 'L'. " FOR JUSTIFICATION

  • l_fieldcat-hotspot = 'x'.

" MARK THIS field as hotsopt to cause the f2 events to trigger.

  • l_fieldcat-lzero = 'x'. " OUTPUT WITH leading zeros.

l_fieldcat-seltext_l = 'Material Number'." long text for header.

l_fieldcat-seltext_m = 'Material No'. " medium text for header.

l_fieldcat-seltext_s = 'Mat No'. " sort text for header.

l_fieldcat-outputlen = 18. " SET THE output length.

l_fieldcat-ref_tabname = 'MARA'.

" FOR F1 & F4 help as refernced to the ddic table.

append l_fieldcat to p_i_fieldcat.

clear l_fieldcat.

l_fieldcat-col_pos = '4'. " POSITION OF THE COLUMN

l_fieldcat-fieldname = 'ARKTX'.

" FIELD FOR WHICH CATALOG ID FILLED.

l_fieldcat-tabname = 'IT_SALES_ORDER'.

" INTERNAL TABLE TO WHICH FIELD BELONGS TO

l_fieldcat-key = 'x'.

" SO THAT this field is not scrollable and hiddable.

l_fieldcat-just = 'L'. " FOR JUSTIFICATION

  • l_fieldcat-hotspot = 'x'.

" MARK THIS field as hotsopt to cause the f2 events to trigger.

  • l_fieldcat-lzero = 'x'. " OUTPUT WITH leading zeros.

l_fieldcat-seltext_l = 'Sales Order Description'." long text for header.

l_fieldcat-seltext_m = 'SO Description'. " medium text for header.

l_fieldcat-seltext_s = 'SO Desc'. " sort text for header.

l_fieldcat-outputlen = 15. " SET THE output length.

l_fieldcat-ref_tabname = 'VBAP'.

" FOR F1 & F4 help as refernced to the ddic table.

append l_fieldcat to p_i_fieldcat.

clear l_fieldcat.

l_fieldcat-col_pos = '5'. " POSITION OF THE COLUMN

l_fieldcat-fieldname = 'ERDAT'.

" FIELD FOR WHICH CATALOG ID FILLED.

l_fieldcat-tabname = 'IT_SALES_ORDER'.

" INTERNAL TABLE TO WHICH FIELD BELONGS TO

l_fieldcat-key = 'x'.

" SO THAT this field is not scrollable and hiddable.

l_fieldcat-just = 'L'. " FOR JUSTIFICATION

  • l_fieldcat-hotspot = 'x'.

" MARK THIS field as hotsopt to cause the f2 events to trigger.

  • l_fieldcat-lzero = 'x'. " OUTPUT WITH leading zeros.

l_fieldcat-seltext_l = 'Date'. " long text for header.

  • l_fieldcat-seltext_m = 'SO Description'. " medium text for header.

  • l_fieldcat-seltext_s = 'SO Desc'. " sort text for header.

l_fieldcat-outputlen = 10. " SET THE output length.

l_fieldcat-ref_tabname = 'VBAP'.

" FOR F1 & F4 help as refernced to the ddic table.

append l_fieldcat to p_i_fieldcat.

clear l_fieldcat.

l_fieldcat-col_pos = '6'. " POSITION OF THE COLUMN

l_fieldcat-fieldname = 'AUART'.

" FIELD FOR WHICH CATALOG ID FILLED.

l_fieldcat-tabname = 'IT_SALES_ORDER'.

" INTERNAL TABLE TO WHICH FIELD BELONGS TO

l_fieldcat-key = 'x'.

" SO THAT this field is not scrollable and hiddable.

l_fieldcat-just = 'L'. " FOR JUSTIFICATION

  • l_fieldcat-hotspot = 'x'.

" MARK THIS field as hotsopt to cause the f2 events to trigger.

  • l_fieldcat-lzero = 'x'. " OUTPUT WITH leading zeros.

l_fieldcat-seltext_l = 'Sales Document Type'. " long text for header.

  • l_fieldcat-seltext_m = 'SO Description'. " medium text for header.

  • l_fieldcat-seltext_s = 'SO Desc'. " sort text for header.

l_fieldcat-outputlen = 10. " SET THE output length.

l_fieldcat-ref_tabname = 'VBAK'.

" FOR F1 & F4 help as refernced to the ddic table.

append l_fieldcat to p_i_fieldcat.

clear l_fieldcat.

l_fieldcat-col_pos = '7'. " POSITION OF THE COLUMN

l_fieldcat-fieldname = 'NETWR'.

" FIELD FOR WHICH CATALOG ID FILLED.

l_fieldcat-tabname = 'IT_SALES_ORDER'.

" INTERNAL TABLE TO WHICH FIELD BELONGS TO

l_fieldcat-key = 'x'.

" SO THAT this field is not scrollable and hiddable.

l_fieldcat-just = 'L'. " FOR JUSTIFICATION

  • l_fieldcat-hotspot = 'x'.

" MARK THIS field as hotsopt to cause the f2 events to trigger.

  • l_fieldcat-lzero = 'x'. " OUTPUT WITH leading zeros.

l_fieldcat-seltext_l = 'Net Value'. " long text for header.

  • l_fieldcat-seltext_m = 'SO Description'. " medium text for header.

  • l_fieldcat-seltext_s = 'SO Desc'. " sort text for header.

l_fieldcat-outputlen = 10. " SET THE output length.

l_fieldcat-ref_tabname = 'VBAK'.

" FOR F1 & F4 help as refernced to the ddic table.

append l_fieldcat to p_i_fieldcat.

clear l_fieldcat.

l_fieldcat-col_pos = '8'. " POSITION OF THE COLUMN

l_fieldcat-fieldname = 'WAERK'.

" FIELD FOR WHICH CATALOG ID FILLED.

l_fieldcat-tabname = 'IT_SALES_ORDER'.

" INTERNAL TABLE TO WHICH FIELD BELONGS TO

l_fieldcat-key = 'x'.

" SO THAT this field is not scrollable and hiddable.

l_fieldcat-just = 'L'. " FOR JUSTIFICATION

  • l_fieldcat-hotspot = 'x'.

" MARK THIS field as hotsopt to cause the f2 events to trigger.

  • l_fieldcat-lzero = 'x'. " OUTPUT WITH leading zeros.

l_fieldcat-seltext_l = 'SD document currency'. " long text for header.

  • l_fieldcat-seltext_m = 'SO Description'. " medium text for header.

  • l_fieldcat-seltext_s = 'SO Desc'. " sort text for header.

l_fieldcat-outputlen = 10. " SET THE output length.

l_fieldcat-ref_tabname = 'VBAK'.

" FOR F1 & F4 help as refernced to the ddic table.

append l_fieldcat to p_i_fieldcat.

clear l_fieldcat.

l_fieldcat-col_pos = '9'. " POSITION OF THE COLUMN

l_fieldcat-fieldname = 'VKORG'.

" FIELD FOR WHICH CATALOG ID FILLED.

l_fieldcat-tabname = 'IT_SALES_ORDER'.

" INTERNAL TABLE TO WHICH FIELD BELONGS TO

l_fieldcat-key = 'x'.

" SO THAT this field is not scrollable and hiddable.

l_fieldcat-just = 'L'. " FOR JUSTIFICATION

  • l_fieldcat-hotspot = 'x'.

" MARK THIS field as hotsopt to cause the f2 events to trigger.

  • l_fieldcat-lzero = 'x'. " OUTPUT WITH leading zeros.

l_fieldcat-seltext_l = 'Sales Organization'. " long text for header.

  • l_fieldcat-seltext_m = 'SO Description'. " medium text for header.

  • l_fieldcat-seltext_s = 'SO Desc'. " sort text for header.

l_fieldcat-outputlen = 10. " SET THE output length.

l_fieldcat-ref_tabname = 'VBAK'.

" FOR F1 & F4 help as refernced to the ddic table.

append l_fieldcat to p_i_fieldcat.

clear l_fieldcat.

l_fieldcat-col_pos = '10'. " POSITION OF THE COLUMN

l_fieldcat-fieldname = 'VTWEG'.

" FIELD FOR WHICH CATALOG ID FILLED.

l_fieldcat-tabname = 'IT_SALES_ORDER'.

" INTERNAL TABLE TO WHICH FIELD BELONGS TO

l_fieldcat-key = 'x'.

" SO THAT this field is not scrollable and hiddable.

l_fieldcat-just = 'L'. " FOR JUSTIFICATION

  • l_fieldcat-hotspot = 'x'.

" MARK THIS field as hotsopt to cause the f2 events to trigger.

  • l_fieldcat-lzero = 'x'. " OUTPUT WITH leading zeros.

l_fieldcat-seltext_l = 'Distribution channel'. " long text for header.

  • l_fieldcat-seltext_m = 'SO Description'. " medium text for header.

  • l_fieldcat-seltext_s = 'SO Desc'. " sort text for header.

l_fieldcat-outputlen = 10. " SET THE output length.

l_fieldcat-ref_tabname = 'VBAK'.

" FOR F1 & F4 help as refernced to the ddic table.

append l_fieldcat to p_i_fieldcat.

clear l_fieldcat.

l_fieldcat-col_pos = '11'. " POSITION OF THE COLUMN

l_fieldcat-fieldname = 'SPART'.

" FIELD FOR WHICH CATALOG ID FILLED.

l_fieldcat-tabname = 'IT_SALES_ORDER'.

" INTERNAL TABLE TO WHICH FIELD BELONGS TO

l_fieldcat-key = 'x'.

" SO THAT this field is not scrollable and hiddable.

l_fieldcat-just = 'L'. " FOR JUSTIFICATION

  • l_fieldcat-hotspot = 'x'.

" MARK THIS field as hotsopt to cause the f2 events to trigger.

  • l_fieldcat-lzero = 'x'. " OUTPUT WITH leading zeros.

l_fieldcat-seltext_l = 'DIVISION'. " long text for header.

  • l_fieldcat-seltext_m = 'SO Description'. " medium text for header.

  • l_fieldcat-seltext_s = 'SO Desc'. " sort text for header.

l_fieldcat-outputlen = 10. " SET THE output length.

l_fieldcat-ref_tabname = 'VBAK'.

" FOR F1 & F4 help as refernced to the ddic table.

append l_fieldcat to p_i_fieldcat.

clear l_fieldcat.

l_fieldcat-col_pos = '12'. " POSITION OF THE COLUMN

l_fieldcat-fieldname = 'KUNNR'.

" FIELD FOR WHICH CATALOG ID FILLED.

l_fieldcat-tabname = 'IT_SALES_ORDER'.

" INTERNAL TABLE TO WHICH FIELD BELONGS TO

l_fieldcat-key = 'x'.

" SO THAT this field is not scrollable and hiddable.

l_fieldcat-just = 'L'. " FOR JUSTIFICATION

  • l_fieldcat-hotspot = 'x'.

" MARK THIS field as hotsopt to cause the f2 events to trigger.

  • l_fieldcat-lzero = 'x'. " OUTPUT WITH leading zeros.

l_fieldcat-seltext_l = 'Sold To Party'. " long text for header.

  • l_fieldcat-seltext_m = 'SO Description'. " medium text for header.

  • l_fieldcat-seltext_s = 'SO Desc'. " sort text for header.

l_fieldcat-outputlen = 20. " SET THE output length.

l_fieldcat-ref_tabname = 'KAN1'.

" FOR F1 & F4 help as refernced to the ddic table.

append l_fieldcat to p_i_fieldcat.

clear l_fieldcat.

l_fieldcat-col_pos = '13'. " POSITION OF THE COLUMN

l_fieldcat-fieldname = 'NAME1'.

" FIELD FOR WHICH CATALOG ID FILLED.

l_fieldcat-tabname = 'IT_SALES_ORDER'.

" INTERNAL TABLE TO WHICH FIELD BELONGS TO

l_fieldcat-key = 'x'.

" SO THAT this field is not scrollable and hiddable.

l_fieldcat-just = 'L'. " FOR JUSTIFICATION

  • l_fieldcat-hotspot = 'x'.

" MARK THIS field as hotsopt to cause the f2 events to trigger.

  • l_fieldcat-lzero = 'x'. " OUTPUT WITH leading zeros.

l_fieldcat-seltext_l = 'NAME'. " long text for header.

  • l_fieldcat-seltext_m = 'SO Description'. " medium text for header.

  • l_fieldcat-seltext_s = 'SO Desc'. " sort text for header.

l_fieldcat-outputlen = 20. " SET THE output length.

l_fieldcat-ref_tabname = 'KNA1'.

" FOR F1 & F4 help as refernced to the ddic table.

append l_fieldcat to p_i_fieldcat.

clear l_fieldcat.

l_fieldcat-col_pos = '14'. " POSITION OF THE COLUMN

l_fieldcat-fieldname = 'LAND1'.

" FIELD FOR WHICH CATALOG ID FILLED.

l_fieldcat-tabname = 'IT_SALES_ORDER'.

" INTERNAL TABLE TO WHICH FIELD BELONGS TO

l_fieldcat-key = 'x'.

" SO THAT this field is not scrollable and hiddable.

l_fieldcat-just = 'L'. " FOR JUSTIFICATION

  • l_fieldcat-hotspot = 'x'.

" MARK THIS field as hotsopt to cause the f2 events to trigger.

  • l_fieldcat-lzero = 'x'. " OUTPUT WITH leading zeros.

l_fieldcat-seltext_l = 'COUNTRY'. " long text for header.

  • l_fieldcat-seltext_m = 'SO Description'. " medium text for header.

  • l_fieldcat-seltext_s = 'SO Desc'. " sort text for header.

l_fieldcat-outputlen = 8. " SET THE output length.

l_fieldcat-ref_tabname = 'KNA1'.

" FOR F1 & F4 help as refernced to the ddic table.

append l_fieldcat to p_i_fieldcat.

clear l_fieldcat.

l_fieldcat-col_pos = '15'. " POSITION OF THE COLUMN

l_fieldcat-fieldname = 'ORT01'.

" FIELD FOR WHICH CATALOG ID FILLED.

l_fieldcat-tabname = 'IT_SALES_ORDER'.

" INTERNAL TABLE TO WHICH FIELD BELONGS TO

l_fieldcat-key = 'x'.

" SO THAT this field is not scrollable and hiddable.

l_fieldcat-just = 'L'. " FOR JUSTIFICATION

  • l_fieldcat-hotspot = 'x'.

" MARK THIS field as hotsopt to cause the f2 events to trigger.

  • l_fieldcat-lzero = 'x'. " OUTPUT WITH leading zeros.

l_fieldcat-seltext_l = 'City'. " long text for header.

  • l_fieldcat-seltext_m = 'SO Description'. " medium text for header.

  • l_fieldcat-seltext_s = 'SO Desc'. " sort text for header.

l_fieldcat-outputlen = 8. " SET THE output length.

l_fieldcat-ref_tabname = 'KNA1'.

" FOR F1 & F4 help as refernced to the ddic table.

append l_fieldcat to p_i_fieldcat.

clear l_fieldcat.

l_fieldcat-col_pos = '16'. " POSITION OF THE COLUMN

l_fieldcat-fieldname = 'TELF1'.

" FIELD FOR WHICH CATALOG ID FILLED.

l_fieldcat-tabname = 'IT_SALES_ORDER'.

" INTERNAL TABLE TO WHICH FIELD BELONGS TO

l_fieldcat-key = 'x'.

" SO THAT this field is not scrollable and hiddable.

l_fieldcat-just = 'L'. " FOR JUSTIFICATION

  • l_fieldcat-hotspot = 'x'.

" MARK THIS field as hotsopt to cause the f2 events to trigger.

  • l_fieldcat-lzero = 'x'. " OUTPUT WITH leading zeros.

l_fieldcat-seltext_l = 'TEL NO'. " long text for header.

  • l_fieldcat-seltext_m = 'SO Description'. " medium text for header.

  • l_fieldcat-seltext_s = 'SO Desc'. " sort text for header.

l_fieldcat-outputlen = 10. " SET THE output length.

l_fieldcat-ref_tabname = 'KNA1'.

" FOR F1 & F4 help as refernced to the ddic table.

append l_fieldcat to p_i_fieldcat.

clear l_fieldcat.

  • V_LIGHTS(1) TYPE C, " FOR TRAFFIC LIGHTS.

clear l_fieldcat.

l_fieldcat-col_pos = '17'. " POSITION OF THE COLUMN.

l_fieldcat-fieldname = 'V_LIGHTS'.

" FIELD FOR WHICH CATALOG ID FILLED.

*We are passing final internal table 'I_FINAL' to l_fieldcat(local

*variable

l_fieldcat-tabname = 'IT_SALES_ORDER'.

" INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.

l_fieldcat-just = 'C'. " FOR JUSTIFICATION.

l_fieldcat-outputlen = 20.

" TO DEFINE OUTPUT LENGTH OF THE COLUMN.

append l_fieldcat to p_i_fieldcat.

endform. " zf_build_fieldcat

&----


*& Form zf_eventcat

&----


  • text

----


  • -->P_I_EVENTCAT text

----


form zf_eventcat using p_i_eventcat type slis_t_event.

data l_eventcat type slis_alv_event.

clear l_eventcat.

*Get all the events.

call function 'REUSE_ALV_EVENTS_GET'

exporting

i_list_type = 0

importing

et_events = p_i_eventcat

exceptions

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

    • TOP-OF-PAGE FORM*

clear l_eventcat.

read table p_i_eventcat into l_eventcat with key

name = 'TOP_OF_PAGE'. "slis_ev_top_of_page.

if sy-subrc = 0.

move 'ZF_TOP_OF_PAGE' to l_eventcat-form.

modify p_i_eventcat from l_eventcat index sy-tabix

transporting form.

endif.

    • PF_STATUS_SET FORM*

clear l_eventcat.

read table p_i_eventcat into l_eventcat with key

name = slis_ev_pf_status_set.

if sy-subrc = 0.

move 'ZF_PF_STATUS_SET' to l_eventcat-form.

modify p_i_eventcat from l_eventcat index sy-tabix

transporting form.

endif.

***

    • USER_COMMAND FORM*

clear l_eventcat.

read table p_i_eventcat into l_eventcat with key

name = slis_ev_user_command. "

if sy-subrc = 0.

move 'ZF_USER_COMMAND'(001) to l_eventcat-form.

modify p_i_eventcat from l_eventcat index sy-tabix

transporting form.

endif.

endform. " zf_eventcat

&----


*& Form ZF_TOP_OF_PAGE

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form zf_top_of_page .

*This FN is responsible for formatting the header information

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

it_list_commentary = i_listheader

i_logo = 'ENJOYSAP_LOGO'

    • I_END_OF_LIST_GRID =*

    • I_ALV_FORM =*

.

endform. " ZF_TOP_OF_PAGE&----


*& Form ZF_PF_STATUS_SET

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form zf_pf_status_set using rt_extab type slis_t_extab.

set pf-status 'ALV_MENU'.

endform. " ZF_PF_STATUS_SET

&----


*& Form ZF_USER_COMMAND

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form zf_user_command

using r_ucomm like sy-ucomm

rs_selfield type slis_selfield .

case r_ucomm. "FCODE

when 'VA03'.

read table it_sales_order into wa_sales_order index rs_selfield-tabindex.

set parameter id 'AUN' field wa_sales_order-vbeln.

call transaction 'VA03' and skip first screen .

message i102 with rs_selfield-value .

when '&IC1'. "for hotspot with VBELN

if rs_selfield-fieldname = 'VBELN'.

    • SET PARAMETER ID 'AUN' FIELD RS_SELFIELD-VALUE.*

    • CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.*

    • RETURN.*

    • MESSAGE I104 WITH RS_SELFIELD-VALUE .*

write:/ rs_selfield-value.

endif.

endcase.

endform. " ZF_USER_COMMAND

&----


*& Form zf_build_listheader

&----


  • text

----


  • -->P_I_LISTHEADER text

----


form zf_build_listheader using p_i_listheader

type slis_t_listheader.

data: l_listheader type slis_listheader.

refresh p_i_listheader.

clear l_listheader.

l_listheader-typ = 'H'. "Header

    • l_listheader-key = 'FCIL,INDIA'. "Ignored for "Header" Type

l_listheader-info = 'FUJITSU CONSULTING INDIA LIMITED'.

append l_listheader to p_i_listheader.

l_listheader-typ = 'S'.

l_listheader-key = 'DATE'.

l_listheader-info = sy-datum.

append l_listheader to p_i_listheader.

clear l_listheader.

l_listheader-typ = 'A'.

    • l_listheader-key = 'COMMENT'."Ignored for "action" Type

l_listheader-info = 'Possibilities are infinite'.

append l_listheader to p_i_listheader.

endform. " zf_build_listheader

&----


*& Form zf_build_grid_title

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form zf_build_grid_title .

v_gridtitle = 'List of Purchase Order'.

endform. " zf_build_grid_title

&----


*& Form zf_sorting

&----


  • text

----


  • -->P_I_SORTINFO text

----


form zf_sorting using p_i_sortinfo type slis_t_sortinfo_alv.

data l_sortinfo type slis_sortinfo_alv.

clear l_sortinfo.

l_sortinfo-spos = '1'.

l_sortinfo-fieldname = 'VBELN'.

l_sortinfo-tabname = 'IT_SALES_ORDER'.

l_sortinfo-up = 'X'.

  • l_sortinfo-group = 'UL'. "UNDERLINE AFTER EVERY GROUP

l_sortinfo-group = '*'. "UNDERLINE AFTER EVERY GROUP

l_sortinfo-subtot = 'X'.

append l_sortinfo to p_i_sortinfo.

endform. " zf_sorting

&----


*& Form zf_display_alv_grid

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form zf_display_alv_grid .

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

i_callback_program = v_progname

  • I_CALLBACK_PF_STATUS_SET = '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 = v_gridtitle

  • I_GRID_SETTINGS =

is_layout = wa_layout

it_fieldcat = i_fieldcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

it_sort = i_sortinfo

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

it_events = i_eventcat

  • 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

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

tables

t_outtab = it_sales_order

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

&----


*& Form zf_layout

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form zf_layout .

wa_layout-zebra = 'X'.

wa_layout-lights_fieldname = 'V_LIGHTS'.

wa_layout-lights_tabname = 'I_SALES_FINAL'.

" 1, 2 or 3 for red, yellow and green respectively.

endform. " zf_layout

&----


*& Form zf_modify_final

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form zf_modify_final .

loop at it_sales_order into wa_sales_order.

if wa_sales_order-netwr <= 10000.

wa_sales_order-v_lights = '1'.

modify it_sales_order from wa_sales_order transporting v_lights.

elseif wa_sales_order-netwr > 10000 and wa_sales_order-netwr <= 100000.

wa_sales_order-v_lights = '2'. " Exception.

modify it_sales_order from wa_sales_order transporting v_lights.

else.

wa_sales_order-v_lights = '3'. " Exception.

modify it_sales_order from wa_sales_order transporting v_lights.

endif.

endloop.

endform. " zf_modify_final

Read only

Former Member
0 Likes
706

Hi,

Perform is used to give actual parameters in subroutine.

In Form u write the code for above parameters and u r logic.

Regards,

Narasimha