ALV guide! Urgent!!!
Does anybody has material/docs/link on ALV? How to create a report using ALV and about the ALV function modules?
Please send it at: [email protected]
Hi,
http://www.sap-img.com/abap.htm
http://www.sapdevelopment.co.uk/tips/tipshome.htm
http://help.sap.com/printdocu/core/Print46c/en/Data/Index_en.htm
http://sap.ittoolbox.com/nav/t.asp?t=322&p=322&h1=322
http://sap.ittoolbox.com/nav/t.asp?t=448&p=448&h1=448
http://www.henrikfrank.dk/abapuk.html
Similar Messages
-
CODING EXAMPLE - LAYOUT ALV - ( very urgent )
Could any body please give me the coding example
where slis_layout_alv is used ? Please treat this as very urgent.
Yours sincerely,
SAURAV LAHIRYHi Saurav,
Please check this code.
REPORT y56098rdup_list
NO STANDARD PAGE HEADING LINE-SIZE 240 LINE-COUNT 65(8) .
Declartion of Tables.
TABLES: ztril_logtable,zreasoncodes,zsdcustxref, usr21, adrp.
TABLES-POOLS
TYPE-POOLS: slis.
Internal tables declarations.
Declaration of output internal table
DATA: BEGIN OF tb_output OCCURS 0,
user_id TYPE xubname, " Requestor ID
role TYPE zrole, "Role
kunnr TYPE kunnr , "Customer Number 1
customer_name TYPE name1, "Customer Name
stras TYPE stras_gp, "Street Address
ort01 TYPE city, "City
regio TYPE regio, "State
pstlz TYPE pstlz, "Postal Code
land1 TYPE land1_gp, "COUNTRY CODE
po_box TYPE ad_pobx, "PO Box Number
tril_po_postal TYPE zpobox_postal, "PO BOX Postal Code
tril_err_msg TYPE zerr_message, "Error Message
reason_type TYPE zreason_type, "Reason Type
reason_code TYPE zreason_code, "Reason Code
perc_prob TYPE zprobability , "Probability Percentage
pattern_number TYPE z_pattern_no, "Match Pattern Number
country_code TYPE land1, "COUNTRY CODE
user_id_name(92) TYPE c, "UserID + Fast Name + Last Name
zlkunnr LIKE zsdcustxref-zlkunnr, "Legacy Customer NO
saplegcustno(20) TYPE c, "SAP + Legacy Customer No
reason_desc LIKE zreasoncodes-reason_desc, "Reason Description
saplegcustno1(20) TYPE c,
END OF tb_output.
Declation of work area.
DATA: wa_output LIKE tb_output.
Declaration of Internal Table.
DATA: tb_fill_output LIKE tb_output OCCURS 0 WITH HEADER LINE,
wa_fill_output LIKE tb_fill_output.
Declaration of internal table for ZREASONCODES
DATA: BEGIN OF tb_reasoncodes OCCURS 0.
INCLUDE STRUCTURE zreasoncodes.
DATA: END OF tb_reasoncodes.
DATA: wa_reasoncodes LIKE tb_reasoncodes.
Declaration of internal table ZSDCUTXREF.
DATA: BEGIN OF tb_zsdcustxref OCCURS 0,
zlkunnr LIKE zsdcustxref-zlkunnr, " Legacy Customer No
zlsourc LIKE zsdcustxref-zlsourc, " Legacy customer source code
kunnr LIKE zsdcustxref-kunnr, " Customer No
END OF tb_zsdcustxref.
Declation of work area.
DATA: wa_zsdcustxref LIKE tb_zsdcustxref.
Declaration of internal table for USR21.
DATA: BEGIN OF tb_usr21 OCCURS 0,
bname LIKE usr21-bname, " USER NAME IN USER MASTER RECORD
persnumber LIKE usr21-persnumber, " PERSON NUMBER
name_first LIKE adrp-name_first, " FIRST NAME
name_last LIKE adrp-name_last, " LAST NAME
END OF tb_usr21.
Declation of work area.
DATA: wa_usr21 LIKE tb_usr21.
Declaration of internal table for ADRP.
DATA: BEGIN OF tb_adrp OCCURS 0,
persnumber LIKE adrp-persnumber, " PERSON NUMBER
name_first LIKE adrp-name_first, " FIRST NAME
name_last LIKE adrp-name_last, " LAST NAME
END OF tb_adrp.
DATA: wa_adrp LIKE tb_adrp.
Declaration for fieldcatalog
DATA: tb_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
Declaration for events
DATA: tb_events TYPE slis_t_event,
wa_event TYPE slis_alv_event.
Declaration for Layout
DATA: tb_layout TYPE slis_layout_alv,
wb_layout TYPE slis_layout_alv.
DATA: wa_line TYPE slis_listheader,
tb_list_header TYPE slis_t_listheader.
DATA: g_date1(40) TYPE c,
g_date2(40) TYPE c,
g_date3(80) TYPE c.
Declaration for Selection Screen Fields
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_userid FOR ztril_logtable-user_id, "Requestor ID
s_r_type FOR zreasoncodes-reason_type, " Reason Type
s_r_code FOR zreasoncodes-reason_code
MATCHCODE OBJECT zr_code. " Reason Code
PARAMETERS : p_frmdat LIKE ztril_logtable-curr_date OBLIGATORY, " from date
p_to_dat LIKE ztril_logtable-curr_date OBLIGATORY. " to date
SELECTION-SCREEN: END OF BLOCK b1.
Declaration for Varialbes
DATA: g_sc_no(20) TYPE c, " To combine the SAP & Legacy Customer No
g_user_name(92) TYPE c. " To concatnate the Userid and User Name.
DATA : tb_repid LIKE trdir-name.
tb_repid = 'Y56098RDUP_LIST'.
*tb-repid type sy-repid.
DATA: BEGIN OF tb_user OCCURS 0,
user_id LIKE ztril_logtable-user_id,
END OF tb_user.
To get the P_USERID F4 Functionality for LOW and HIGH.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_userid-low.
SELECT user_id FROM ztril_logtable INTO TABLE tb_user.
SORT tb_user.
DELETE ADJACENT DUPLICATES FROM tb_user.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'S_USERID'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'S_USERID'
value_org = 'S'
TABLES
value_tab = tb_user
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE e210(zsd).
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_userid-high.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'S_USERID'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'S_USERID'
value_org = 'S'
TABLES
value_tab = tb_user
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE e210(zsd).
ENDIF.
At selection screen event.
AT SELECTION-SCREEN.
Validation of User_id(USER_ID) & Reason Type(REASON_CODE)
PERFORM checking_user_id.
Validation of Reason type from the table ZREASONCODES
PERFORM check_reasontype.
Validation of Reason code from the table ZREASONCODES
PERFORM check_reasoncode.
Validation for checking From-Date
PERFORM checking_from_date.
Validation for checking To-Date
PERFORM checking_to_date.
Start of selection event.
START-OF-SELECTION.
REFRESH data & clear data.
PERFORM refresh_tables.
Get ZTRIL_LOGTABLE Data.
PERFORM get_tril_logtable.
Get data from ZREASONCODE.
PERFORM get_reasoncode_data.
Get the data Customer No from ZSDCUSTREF based on ZTRIL_LOGTABLE-KUNNR
PERFORM get_sdcustrefdata.
Get the data First Name and Last Name
PERFORM get_data_from_usr21_adrp.
Updateing the output internal table i.e. IT_OUTPUT data
PERFORM fill_output_data.
Displaying output data with two different Rows.
PERFORM output_data.
Populate the field catelog.
PERFORM build_fieldcatlog.
Declartion Events.
PERFORM event_call.
Top of page Information
PERFORM top_of_page.
Declation of Layout
PERFORM layout USING tb_layout.
To get the Output Format( Simple List/ ALV )
PERFORM grid_display.
*& Form get_tril_logtable
To get the data from table ztril_logtable
FORM get_tril_logtable.
REFRESH: tb_output.
Reading data from the table ZTRIL_LOGTABLE
SELECT user_id
role "Role
kunnr "Customer Number 1
customer_name "Customer Name
stras "Street Address
ort01 "City
regio "State
pstlz "Postal Code
land1 "COUNTRY CODE
po_box "PO Box Number
tril_po_postal "PO BOX Postal Code
tril_err_msg "Error Message
reason_type "Reason Type
reason_code "Reason Code
perc_prob
pattern_number
FROM ztril_logtable INTO
CORRESPONDING FIELDS OF
TABLE tb_output
WHERE
( curr_date GE p_frmdat AND curr_date LE p_to_dat )
( curr_date BETWEEN p_frmdat AND p_to_dat )
AND
user_id IN s_userid
AND reason_code IN s_r_code
AND reason_type IN s_r_type.
IF sy-subrc NE 0.
MESSAGE i202(zsd).
ENDIF.
ENDFORM. " get_tril_logtable
*& Form get_reasoncode_data
To get the Reason code and Reason type
FORM get_reasoncode_data .
checking internal table initial data.
IF NOT tb_output[] IS INITIAL.
SELECT reason_type
reason_code
reason_desc
FROM zreasoncodes
INTO CORRESPONDING FIELDS OF TABLE tb_reasoncodes
WHERE reason_type IN s_r_type
AND reason_code IN s_r_code.
ENDIF.
ENDFORM. " get_reasoncode_data
*& Form get_sdcustrefdata
To get the legasy customer number data
FORM get_sdcustrefdata .
IF NOT tb_output[] IS INITIAL.
SELECT zlkunnr " Legacy Customer No
zlsourc " Legacy customer source code
kunnr " Customer No
FROM zsdcustxref INTO TABLE tb_zsdcustxref
FOR ALL ENTRIES IN tb_output
WHERE kunnr EQ tb_output-kunnr.
ENDIF.
ENDFORM. " get_sdcustrefdata
*& Form fill_output_data
To get the final data into the Internal Table
FORM fill_output_data .
IF NOT tb_output[] IS INITIAL.
SORT tb_output BY role user_id.
LOOP AT tb_output INTO wa_output.
READ TABLE tb_reasoncodes INTO wa_reasoncodes
WITH KEY
reason_type = wa_output-reason_type
reason_code = wa_output-reason_code BINARY SEARCH.
IF sy-subrc EQ 0.
wa_output-reason_desc = wa_reasoncodes-reason_desc.
CLEAR wa_reasoncodes.
ENDIF.
READ TABLE tb_zsdcustxref INTO wa_zsdcustxref
WITH KEY
kunnr = wa_output-kunnr.
IF sy-subrc EQ 0.
CONCATENATE wa_zsdcustxref-zlkunnr
wa_zsdcustxref-zlsourc
INTO
g_sc_no SEPARATED BY ' - '.
wa_output-saplegcustno1 = wa_zsdcustxref-zlkunnr.
wa_output-saplegcustno1 = g_sc_no.
ELSE.
wa_output-saplegcustno = wa_output-kunnr.
CLEAR: wa_reasoncodes,g_sc_no.
ENDIF.
READ TABLE tb_usr21 INTO wa_usr21 WITH KEY bname = wa_output-user_id.
IF sy-subrc EQ 0.
CONCATENATE wa_usr21-bname
CONCATENATE wa_usr21-name_first
wa_usr21-name_last
INTO
g_user_name SEPARATED BY space.
wa_output-user_id_name = g_user_name.
ENDIF.
MODIFY tb_output FROM wa_output
TRANSPORTING
reason_desc
saplegcustno
user_id_name
saplegcustno1.
CLEAR: g_user_name,wa_usr21, wa_adrp.
ENDLOOP.
ENDIF.
ENDFORM. " fill_output_data
*& Form get_data_from_USR21_ADRP
To get the first name and last name from ADRP table
FORM get_data_from_usr21_adrp .
IF NOT tb_output[] IS INITIAL.
SELECT bname
persnumber
FROM usr21
INTO CORRESPONDING FIELDS OF TABLE tb_usr21
FOR ALL ENTRIES IN tb_output
WHERE bname EQ tb_output-user_id.
IF NOT tb_usr21[] IS INITIAL.
SELECT persnumber
name_first
name_last
FROM adrp INTO TABLE tb_adrp
FOR ALL ENTRIES IN tb_usr21
WHERE persnumber EQ tb_usr21-persnumber.
ENDIF.
ENDIF.
LOOP AT tb_usr21 INTO wa_usr21.
READ TABLE tb_adrp INTO wa_adrp WITH KEY persnumber = wa_usr21-persnumber.
IF sy-subrc EQ 0.
wa_usr21-name_first = wa_adrp-name_first.
wa_usr21-name_last = wa_adrp-name_last.
CLEAR wa_adrp.
MODIFY tb_usr21 FROM wa_usr21 TRANSPORTING name_first name_last.
ENDIF.
ENDLOOP.
ENDFORM. " get_data_from_USR21_ADRP
*& Form build_fieldcatlog
It is used to build the fieldcatlog
FORM build_fieldcatlog .
wa_fieldcat-col_pos = 1.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'USER_ID'.
wa_fieldcat-seltext_l = 'Requestor ID'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 2.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'USER_ID_NAME'.
wa_fieldcat-seltext_l = 'Requestor Name'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 3.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'SAPLEGCUSTNO'.
wa_fieldcat-seltext_l = 'SAP & Legacy Customer No'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 4.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'CUSTOMER_NAME'.
wa_fieldcat-seltext_m = 'Customer Name'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 5.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'STRAS'.
wa_fieldcat-seltext_m = 'Street Address'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 6.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'ORT01'.
wa_fieldcat-seltext_m = 'City'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 7.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'REGIO'.
wa_fieldcat-seltext_m = 'State'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 8.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'PSTLZ'.
wa_fieldcat-seltext_m = 'Postal Code'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 9.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'LAND1'.
wa_fieldcat-seltext_m = 'Country Code'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 10.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'PO_BOX'.
wa_fieldcat-seltext_m = 'PO BOX NO'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 11.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'TRIL_PO_POSTAL'.
wa_fieldcat-seltext_m = 'PO Box Postal Code'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 12.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'REASON_TYPE'.
wa_fieldcat-seltext_m = 'Reason Type'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 13.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'REASON_CODE'.
wa_fieldcat-seltext_m = 'Reason Code'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 14.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'REASON_DESC'.
wa_fieldcat-seltext_m = 'Reason Description'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 15.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'PERC_PROB'.
wa_fieldcat-seltext_m = 'TOP %'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 16.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'PATTERN_NUMBER'.
wa_fieldcat-seltext_m = 'Match Pattern'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
wa_fieldcat-datatype = 'N'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. " build_fieldcatlog
*& Form event_call
It is used to call the events
FORM event_call .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = tb_events
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.
ENDFORM. " event_call
*& Form grid_display
To display the output in ALV Grid format
FORM grid_display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = tb_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
i_callback_top_of_page = '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 = wb_layout
it_fieldcat = tb_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = tb_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 =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = tb_output
t_outtab = tb_fill_output
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. " grid_display
*& Form top_of_page
It is used to display the Top-of-page
FORM top_of_page .
CLEAR: wa_line, tb_list_header[].
wa_line-typ = 'H'.
wa_line-info = 'Duplicates Ignored by Requestor Report'.
APPEND wa_line TO tb_list_header.
CLEAR wa_line.
wa_line-typ = 'S'.
WRITE p_frmdat TO g_date1 DD/MM/YY.
WRITE p_to_dat TO g_date2 DD/MM/YY.
CONCATENATE 'From Date : ' g_date1 ' To Date : ' g_date2
INTO g_date3 SEPARATED BY space .
wa_line-info = g_date3.
APPEND wa_line TO tb_list_header.
CLEAR wa_line.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = tb_list_header.
i_logo =
I_END_OF_LIST_GRID =
ENDFORM. " top_of_page
*& Form layout
It is used to display the output layout
FORM layout USING p_tb_layout.
tb_layout-detail_popup = 'X'.
tb_layout-colwidth_optimize = 'X'.
ENDFORM. " layout
*& Form refresh_tables
TO Refresh the internal table workarea
FORM refresh_tables .
REFRESH: tb_output, tb_reasoncodes, tb_zsdcustxref, tb_usr21, tb_fill_output.
CLEAR: wa_output, wa_reasoncodes, wa_zsdcustxref, wa_usr21, wa_fill_output.
ENDFORM. " refresh_tables
*& Form SET_PF_STATUS
It is used to populate the PF_STATUS
FORM set_pf_status USING tb_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTANDARD'.
ENDFORM. " SET_PF_STATUS
*& Form USER_COMMAND
To avoid the shortdump of ALV Report
FORM user_command USING rf_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
ENDFORM. "user_command
*& Form check_reasoncode
Checking Reason Code
FORM check_reasoncode .
IF NOT s_r_type IS INITIAL.
SELECT SINGLE reason_code FROM zreasoncodes INTO s_r_code
WHERE reason_type IN s_r_type
AND reason_code IN s_r_code.
IF sy-subrc NE 0.
SET CURSOR FIELD 'S_R_CODE-LOW'.
MESSAGE e204(zsd).
ELSEIF s_r_code = 'TP'.
MESSAGE e208(zsd).
ENDIF.
ENDIF.
ENDFORM. " check_reasoncode
*& Form check_reasontype
Checking Reason Type
FORM check_reasontype .
IF s_r_type-low = 'TP' OR
s_r_type-high = 'TP'.
MESSAGE e208(zsd).
ENDIF.
SELECT SINGLE reason_type FROM zreasoncodes INTO s_r_type
WHERE reason_type IN s_r_type.
IF sy-subrc NE 0.
MESSAGE e201(zsd).
ENDIF.
ENDFORM. " check_reasontype
*& Form checking_From_date
Checking From Date
FORM checking_from_date .
SELECT SINGLE
curr_date
FROM ztril_logtable
INTO ztril_logtable-curr_date
WHERE curr_date EQ p_frmdat.
IF sy-subrc NE 0.
MESSAGE e205(zsd).
ENDIF.
ENDFORM. " checking_From_date
*& Form checking_To_date
Checking To_date
FORM checking_to_date .
SELECT SINGLE
curr_date
FROM ztril_logtable
INTO ztril_logtable-curr_date
WHERE curr_date EQ p_to_dat.
IF sy-subrc NE 0.
MESSAGE e206(zsd).
elseif p_frmdat lt p_to_dat.
Message e209(zsd).
ELSEIF p_frmdat GT p_to_dat.
MESSAGE e207(zsd).
ENDIF.
ENDFORM. " checking_To_date
*& Form checking_user_id
text
FORM checking_user_id .
SELECT SINGLE user_id
FROM ztril_logtable
INTO s_userid
WHERE user_id IN s_userid.
IF sy-subrc NE 0.
MESSAGE e200(zsd).
ENDIF.
ENDFORM. " checking_user_id
*& Form output_data
To print the Legacy customer No and SAP no into two different rows.*
FORM output_data .
LOOP AT tb_output INTO wa_output.
wa_fill_output-user_id = wa_output-user_id.
wa_fill_output-role = wa_output-role.
wa_fill_output-saplegcustno = wa_output-kunnr.
wa_fill_output-user_id_name = wa_output-user_id_name.
wa_fill_output-customer_name = wa_output-customer_name.
wa_fill_output-stras = wa_output-stras.
wa_fill_output-ort01 = wa_output-ort01.
wa_fill_output-regio = wa_output-regio.
wa_fill_output-pstlz = wa_output-pstlz.
wa_fill_output-land1 = wa_output-land1.
wa_fill_output-po_box = wa_output-po_box.
wa_fill_output-tril_po_postal = wa_output-tril_po_postal.
wa_fill_output-tril_err_msg = wa_output-tril_err_msg.
wa_fill_output-reason_type = wa_output-reason_type.
wa_fill_output-reason_code = wa_output-reason_code.
wa_fill_output-country_code = wa_output-country_code.
wa_fill_output-reason_desc = wa_output-reason_desc.
wa_fill_output-pattern_number = wa_output-pattern_number.
wa_fill_output-perc_prob = wa_output-perc_prob.
CLEAR: wa_output-user_id,
wa_output-role,
wa_output-kunnr,
wa_output-user_id_name,
wa_output-stras,
wa_output-ort01,
wa_output-regio,
wa_output-pstlz,
wa_output-land1,
wa_output-po_box,
wa_output-tril_po_postal,
wa_output-tril_err_msg,
wa_output-reason_type,
wa_output-reason_code,
wa_output-country_code,
wa_output-reason_desc,
wa_output-customer_name,
wa_output-pattern_number,
wa_output-perc_prob.
APPEND wa_fill_output TO tb_fill_output.
IF NOT wa_output-saplegcustno1 IS INITIAL.
CLEAR: wa_fill_output-user_id,
wa_fill_output-role,
wa_fill_output-kunnr,
wa_fill_output-user_id_name,
wa_fill_output-stras,
wa_fill_output-ort01,
wa_fill_output-regio,
wa_fill_output-pstlz,
wa_fill_output-land1,
wa_fill_output-po_box,
wa_fill_output-tril_po_postal,
wa_fill_output-tril_err_msg,
wa_fill_output-reason_type,
wa_fill_output-reason_code,
wa_fill_output-country_code,
wa_fill_output-reason_desc,
wa_fill_output-customer_name,
wa_fill_output-pattern_number,
wa_fill_output-perc_prob.
wa_fill_output-saplegcustno = wa_output-saplegcustno1.
APPEND wa_fill_output TO tb_fill_output.
CLEAR: wa_output.
ENDIF.
ENDLOOP.
ENDFORM. " output_data -
ALV REQUIREMENT URGENT REQUIREMENT REGORDING SUBTOTAOLS AND GRANDTOTALS?
HI EXPERTS,
IN MY ALV REPORT I WANT TO PRINT SUBTOTAL TEXT AND GRANDTOTAL TEXTWriting Subtotal and Grandtotal in ALV Report
Total text in ALV
Reward points.. -
Excel view in ALV Grid---- Urgent
Hi,
On executing sample porgram BCALV_FULLSCREEN_DEMO, we get ALV grid display. After that, on Clicking "<b>Microsoft Excel View(controlshiftF7)</b>" we are getting blanck Excel screen view instead of the field values.
I have the same scenario requirement in real time. I want the excel screen with values from ALV Grid.
Thanks in Advance.
-Mohan.Hi Mohan,
Try this:
Download Data in EXCEL from ALV list display
1) Once you have alv report displayed in the screen.
2) Click button 'View' ( next to print button) on application toolbar
3) Select Excel in Place
4) This will download the same format as of Report
I hope your ALV have all the Standard functions in Toolbar. If not copy the status from and get the function as mentioned above.
<b>Program - SAPLSALV
Status - STANDARD</b>
Reward points if this Helps.
Manish -
Line item text in ALV..urgent
hello
i m creating an alv interactive report. in basic list i have fields from likp table and in interactive i have lips table fields. one need one more field in interactive list and that is "line item text" field. (i have matnr and arktx in interactive). for the time being i created line item text in VL02>>ITEM>>TEXTS>> FOR ITEM NUMBER(POSNR). I didnt understand where this line item text is stored ; i mean in which table it is stored . how to retreive this field from a table??Hi,
You have to use the FM READ_TEXT..to get the text name..
The following are the details you have to pass to the FM..
Text name - Delivery number + line item.
Language - SY-LANGU
Text ID - ????
Text Object - VBBP.
You can get the above details in the text itself..
Display the text..
Double click on the text to get to the editor..
In the menu..choose..GOTO -> HEADER..
There you can see the details like Text ID, text name & text object..And use them in the FM read_text..
Thanks
Naren -
Problem in Auto Mail of ALV Report : Urgent
Hello All ,
I have created one ALV Report contain 240 Columns . This report is need to schedule for auto mail in HTML Format.
My Problem is when I am sending this report manually the html output displays all the columns in the mail attachment. While it is scheduled thro' SM36 in background mode the HTML format displays only restricted columns (say upto 132 columns)
Also, we have tried to create new page format X_65_512/2 to accomodate the output. However this option did not work.
Any solution to resolve the same is most welcome !
Regards
Swati NamdeoHi
This problem was not resolved. I tried few things but not good. So what we did we created a few profile like MM/SD/FICA and we executed report based on profile and sent them only the column relevant to them.
Regards,
Atul Joshi -
Query Regarding ALV - Very Urgent
Hi experts,
I have defined a ALV grid in my program using the startdard function module as editable. Now I want the grid to be displayed in the screen with my pf-status. how can i do that?.
Here is the sample code.
REPORT zadvcformsub
NO STANDARD PAGE HEADING MESSAGE-ID zf
LINE-SIZE 255 LINE-COUNT 66.
INCLUDE zftsvar .
TYPE-POOLS : slis.
TABLES : zftsregstr, zftsintnum, zftscusttc,
zadvcform, konv, knvv, sscrfields.
DATA : it_fieldcat TYPE slis_t_fieldcat_alv.
DATA : w_layout TYPE slis_layout_alv,
w_fieldcat TYPE slis_fieldcat_alv.
DATA : BEGIN OF it_initial OCCURS 1,
bukrs(4) TYPE c,
wkreg(3) TYPE c,
zkunag(10) TYPE c,
validfrom(10) TYPE c,
validto(10) TYPE c,
vkorg(4) TYPE c,
aland(3) TYPE c,
zformtype(1) TYPE c,
frmintno(10) TYPE c,
uname(12) TYPE c,
datum(10) TYPE c,
uzeit(8) TYPE c,
END OF it_initial.
DATA : BEGIN OF it_part OCCURS 1,
zkunag LIKE zadvcform-zkunag,
frmintno LIKE zadvcform-frmintno,
validfrom LIKE zadvcform-validfrom,
validto LIKE zadvcform-validto,
END OF it_part.
DATA : w_sno(2) TYPE c,
w_cust(10) TYPE c,
w_cform(10) TYPE c,
w_from(10) TYPE c,
w_to(10) TYPE c,
w_blank1(10) TYPE c,
w_blank2(10) TYPE c,
w_blank3(10) TYPE c,
w_blank4(10) TYPE c,
w_string_len TYPE i,
w_sel_line(255) TYPE c,
w_indx(2) TYPE c.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:
s_bukrs FOR zadvcform-bukrs NO INTERVALS NO-EXTENSION OBLIGATORY,
s_aland FOR zadvcform-aland NO INTERVALS NO-EXTENSION OBLIGATORY,
s_wkreg FOR zadvcform-wkreg NO INTERVALS NO-EXTENSION OBLIGATORY,
s_vkorg FOR zadvcform-vkorg NO INTERVALS NO-EXTENSION OBLIGATORY,
s_fmtyp FOR zadvcform-zformtype NO INTERVALS NO-EXTENSION OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
INITIALIZATION.
AT SELECTION-SCREEN.
START-OF-SELECTION.
w_fieldcat-fieldname = 'ZKUNAG'.
w_fieldcat-tabname = 'IT_PART'.
w_fieldcat-ref_fieldname = 'ZKUNAG'.
w_fieldcat-ref_tabname = 'ZADVCFORM'.
w_fieldcat-seltext_l = 'Customer Code'.
w_fieldcat-ddictxt = 'L'.
w_fieldcat-input = 'X'.
w_fieldcat-edit = 'X'.
APPEND w_fieldcat TO it_fieldcat.
w_fieldcat-fieldname = 'FRMINTNO'.
w_fieldcat-tabname = 'IT_PART'.
w_fieldcat-ref_fieldname = 'FRMINTNO'.
w_fieldcat-ref_tabname = 'ZADVCFORM'.
w_fieldcat-seltext_l = 'C Form No'.
w_fieldcat-ddictxt = 'L'.
w_fieldcat-input = 'X'.
w_fieldcat-edit = 'X'.
APPEND w_fieldcat TO it_fieldcat.
w_fieldcat-fieldname = 'VALIDFROM'.
w_fieldcat-tabname = 'IT_PART'.
w_fieldcat-ref_fieldname = 'VALIDFROM'.
w_fieldcat-ref_tabname = 'ZADVCFORM'.
w_fieldcat-seltext_l = 'Valid From'.
w_fieldcat-ddictxt = 'L'.
w_fieldcat-input = 'X'.
w_fieldcat-edit = 'X'.
APPEND w_fieldcat TO it_fieldcat.
w_fieldcat-fieldname = 'VALIDTO'.
w_fieldcat-tabname = 'IT_PART'.
w_fieldcat-ref_fieldname = 'VALIDTO'.
w_fieldcat-ref_tabname = 'ZADVCFORM'.
w_fieldcat-seltext_l = 'Valid To'.
w_fieldcat-ddictxt = 'L'.
w_fieldcat-input = ' '.
w_fieldcat-edit = ' '.
APPEND w_fieldcat TO it_fieldcat.
DO 15 TIMES.
CLEAR it_part.
APPEND it_part.
ENDDO.
SET PF-STATUS 'ZADVCFORM_COPY'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_pf_status_set = 'ZADVCFORM_COPY'
it_fieldcat = it_fieldcat
i_grid_title = 'Advanced C Form Submission'
TABLES
t_outtab = it_part[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE i039(zaba) WITH 'Error in ALV'.
ENDIF.
I am geting the editable ALV grid but how to set my gui status.
regards,
Arul Jothi.Hi,
Here is an sample code to handle events.
DATA: I_EVENTS TYPE SLIS_T_EVENT.
PERFORM F4000_EVENTS_INIT CHANGING I_EVENTS.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
IT_EVENTS = I_EVENTS
TABLES
T_OUTTAB = I_MARA
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 F4000_EVENTS_INIT USING I_EVENTS TYPE SLIS_T_EVENT.
DATA: LINE_EVENT TYPE SLIS_ALV_EVENT.
CLEAR LINE_EVENT.
LINE_EVENT-NAME = 'TOP_OF_PAGE'.
LINE_EVENT-FORM = 'F4001_TOP_OF_PAGE'.
APPEND LINE_EVENT TO I_EVENTS.
CLEAR LINE_EVENT.
LINE_EVENT-NAME = 'PF_STATUS_SET'.
LINE_EVENT-FORM = 'F4002_PF_STATUS_SET'.
APPEND LINE_EVENT TO I_EVENTS.
CLEAR LINE_EVENT.
LINE_EVENT-NAME = 'USER_COMMAND'.
LINE_EVENT-FORM = 'F4003_USER_COMMAND'.
APPEND LINE_EVENT TO I_EVENTS.
ENDFORM.
FORM F4003_USER_COMMAND USING UCOMM LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
CASE UCOMM.
WHEN '&CHNG'.
READ TABLE I_MARA INDEX SELFIELD-TABINDEX.
IF I_MARA-MATNR NE SPACE.
SET PARAMETER ID 'MAT' FIELD I_MARA-MATNR.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
CLEAR UCOMM.
ENDIF.
ENDCASE.
ENDFORM. -
Change line color in alv.(urgent)
Hello , i want the line color to change when my cursor change lines in an ALV.Thx
Hi,
Check this website
http://www.geocities.com/mpioud/Abap_programs.html
reward points if useful,
Regards,
Niyaz -
ALV heading required using ALV opps-urgent
Hi All,
I developed one report which is displaying ouput in grid using ALV OOPS concept.
i need heading as foloows.
Header :
Program ID : EDI report program name
Date/Time : date/time where the report is generated
Page No :
User id : logon ID
anybody can send me the code how to display this header in my logic using oops concept only.
thanks,
maheedharHi
Use the std class
cl_salv_form_layout_grid to displayn this
use the methods
create_Label and create_text for creating this
see the sample
DATA: ln_grid TYPE REF TO cl_salv_form_layout_grid,
ln_flow TYPE REF TO cl_salv_form_layout_flow,
ln_label TYPE REF TO cl_salv_form_label,
ln_text TYPE REF TO cl_salv_form_text.
Program name
ln_label = lcn_grid->create_label( row = 2 column = 1 text = 'Program:'(t02) tooltip = 'Program technical name'(t20) ).
ln_text = lcn_grid->create_text( row = 2 column = 2 text = sy-cprog tooltip = sy-cprog ).
System
ln_label = lcn_grid->create_label( row = 3 column = 1 text = 'System:'(t03) tooltip = 'System:'(t03) ).
ln_text = lcn_grid->create_text( row = 3 column = 2 text = sy-sysid tooltip = sy-sysid ).
Client
ln_label = lcn_grid->create_label( row = 3 column = 3 text = 'Client:'(t04) tooltip = 'Client:'(t04) ).
ln_text = lcn_grid->create_text( row = 3 column = 4 text = sy-mandt tooltip = sy-mandt ).
Regards
Anji -
ASCI to ALV format urgent please.
Hi ;
I have internal table format as DATA: gt_txtlines(1024) TYPE c OCCURS 0 WITH HEADER LINE. This containes alv lines submitted from external report . So some lines and format of internal table is not usefull .Is there any format to upload
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listobject = lt_list
listasci = lt_txtlines
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
functions produce asci format data take as an normal internal table format (column design.) I mean take memory data as its original internal table format.
Please find below the code ;
*& Form submit_fields
text
--> p1 text
<-- p2 text
FORM submit_fields .
SUBMIT rcs15001 WITH pm_idnrk EQ s_matnr-low
WITH pm_werks EQ p_werks
WITH pm_stlan EQ p_stlan
WITH pm_datuv EQ p_datuv
WITH pm_emeng EQ p_emeng
WITH pm_rmeng EQ p_rmeng
EXPORTING LIST TO MEMORY
AND RETURN.
PERFORM retrieve_list_from_memory TABLES gt_listout
gt_list
gt_txtlines.
ENDFORM. " submit_fields
*& Form retrieve_list_from_memory
text
-->P_LISTOUT text
FORM retrieve_list_from_memory TABLES lt_listout STRUCTURE gt_listout
lt_list STRUCTURE gt_list
lt_txtlines.
CLEAR lt_list. REFRESH lt_list.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = lt_list
EXCEPTIONS
not_found = 1
OTHERS = 2.
CHECK sy-subrc = 0.
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listobject = lt_list
listasci = lt_txtlines
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
CHECK sy-subrc = 0.
PERFORM rearrange_list TABLES lt_txtlines.
CALL FUNCTION 'LIST_FREE_MEMORY'.
ENDFORM. " retrieve_list_from_memory
How can I get alv list
Regards.
Message was edited by:
yanutHi ;
I have internal table format as DATA: gt_txtlines(1024) TYPE c OCCURS 0 WITH HEADER LINE. This containes alv lines submitted from external report . So some lines and format of internal table is not usefull .Is there any format to upload
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listobject = lt_list
listasci = lt_txtlines
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
functions produce asci format data take as an normal internal table format (column design.) I mean take memory data as its original internal table format.
Please find below the code ;
*& Form submit_fields
text
--> p1 text
<-- p2 text
FORM submit_fields .
SUBMIT rcs15001 WITH pm_idnrk EQ s_matnr-low
WITH pm_werks EQ p_werks
WITH pm_stlan EQ p_stlan
WITH pm_datuv EQ p_datuv
WITH pm_emeng EQ p_emeng
WITH pm_rmeng EQ p_rmeng
EXPORTING LIST TO MEMORY
AND RETURN.
PERFORM retrieve_list_from_memory TABLES gt_listout
gt_list
gt_txtlines.
ENDFORM. " submit_fields
*& Form retrieve_list_from_memory
text
-->P_LISTOUT text
FORM retrieve_list_from_memory TABLES lt_listout STRUCTURE gt_listout
lt_list STRUCTURE gt_list
lt_txtlines.
CLEAR lt_list. REFRESH lt_list.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = lt_list
EXCEPTIONS
not_found = 1
OTHERS = 2.
CHECK sy-subrc = 0.
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listobject = lt_list
listasci = lt_txtlines
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
CHECK sy-subrc = 0.
PERFORM rearrange_list TABLES lt_txtlines.
CALL FUNCTION 'LIST_FREE_MEMORY'.
ENDFORM. " retrieve_list_from_memory
How can I get alv list
Regards.
Message was edited by:
yanut -
Display Total in ALV-List-urgent
Hi,
I have an ALV-List with an amount column...I have to show the total at the end of the list..Calculation of total can be done in the internal table but how to display it neatly just below the itab-amount with a tag Total : 29000000 .Kindly help.
Thanks..see this below example
REPORT yktest.
*& TABLES DECLARATION *
TABLES : ekko, ekpo, t001w, t161t, lfa1.
*& INTERNAL TABLE DECLARATION *
TYPES : BEGIN OF tp_itab1,
bukrs TYPE ekko-bukrs,
lifnr TYPE ekko-lifnr,
ebeln TYPE ekko-ebeln,
waers TYPE ekko-waers,
bsart TYPE ekko-bsart,
ekorg TYPE ekko-ekorg,
ekgrp TYPE ekko-ekgrp,
ebelp TYPE ekpo-ebelp,
txz01 TYPE ekpo-txz01,
matnr TYPE ekpo-matnr,
werks TYPE ekpo-werks,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
netwr TYPE ekpo-netwr,
name1 TYPE t001w-name1,
header_text(132),
chk TYPE c,
END OF tp_itab1.
DATA : t_itab1 TYPE STANDARD TABLE OF tp_itab1,
wa_itab1 TYPE tp_itab1,
ws_name1 TYPE t001w-name1.
DATA : f_itab1 TYPE STANDARD TABLE OF tp_itab1,
wa_fitab1 TYPE tp_itab1.
DATA : f_itab2 TYPE STANDARD TABLE OF tp_itab1,
wa_fitab2 TYPE tp_itab1.
TYPES : BEGIN OF tp_name1,
werks TYPE t001w-werks,
name1 TYPE t001w-name1,
END OF tp_name1.
DATA : t_name1 TYPE STANDARD TABLE OF tp_name1,
wa_name1 TYPE tp_name1.
DATA : t_lfa1 TYPE STANDARD TABLE OF lfa1,
wa_lfa1 TYPE lfa1.
DATA: hold_tabix TYPE sy-tabix.
DATA : t_tlinetab TYPE STANDARD TABLE OF tline,
wa_tlinetab TYPE tline.
DATA: ws_name TYPE thead-tdname,
ws_repid TYPE sy-repid VALUE 'YKTEST'.
DATA : repid TYPE sy-repid.
DATA : total TYPE p DECIMALS 2,
quantity TYPE p DECIMALS 3.
CONSTANTS : ws_id TYPE thead-tdid VALUE 'F01',
ws_object TYPE thead-tdobject VALUE 'EKKO',
lc_view(1) TYPE c VALUE 'F',
lc_form(10) TYPE c VALUE 'YK_FORM'.
*& ALV DECLARATION *
TYPE-POOLS : slis.
DATA: lt_fieldcat TYPE slis_t_fieldcat_alv,
lf_fieldcat TYPE slis_fieldcat_alv.
DATA: lh_index LIKE lf_fieldcat-col_pos.
DATA: l_layout TYPE slis_layout_alv.
DATA : l_sort TYPE slis_t_sortinfo_alv,
w_sort TYPE slis_sortinfo_alv.
*& SELECTION-SCREEN *
SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP 2.
SELECT-OPTIONS: s_bukrs FOR ekko-bukrs OBLIGATORY.
SELECT-OPTIONS: s_lifnr FOR ekko-lifnr OBLIGATORY.
SELECT-OPTIONS: s_ebeln FOR ekko-ebeln.
PARAMETERS: p_bsart TYPE ekko-bsart.
SELECT-OPTIONS: s_matnr FOR ekpo-matnr.
SELECT-OPTIONS: s_ekorg FOR ekko-ekorg.
SELECT-OPTIONS: s_ekgrp FOR ekko-ekgrp.
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN END OF BLOCK a1.
*& START-OF-SELECTION *
START-OF-SELECTION.
FETCHING DATA
PERFORM fetch_data.
BUILD FIELD CATALOG
PERFORM build_fieldcatalog.
BUILD LAYOUT
PERFORM build_layout.
SORT LAYOUT
PERFORM sort_layout.
*& END-OF-SELECTION. *
END-OF-SELECTION.
*DISPLAY GRID
PERFORM display_grid.
*& Form fetch_data *
FORM fetch_data.
IF p_bsart IS INITIAL.
SELECT ekko~bukrs
ekko~lifnr
ekko~ebeln
ekko~waers
ekko~bsart
ekko~ekorg
ekko~ekgrp
ekpo~ebelp
ekpo~txz01
ekpo~matnr
ekpo~werks
ekpo~menge
ekpo~meins
ekpo~netpr
ekpo~netwr
INTO TABLE t_itab1 FROM
ekko INNER JOIN ekpo ON ekkoebeln = ekpoebeln
WHERE ekko~ebeln IN s_ebeln AND
ekko~bukrs IN s_bukrs AND
ekko~lifnr IN s_lifnr AND
ekko~ekorg IN s_ekorg AND
ekko~ekgrp IN s_ekgrp AND
ekpo~matnr IN s_matnr.
ELSE.
SELECT ekko~bukrs
ekko~lifnr
ekko~ebeln
ekko~waers
ekko~bsart
ekko~ekorg
ekko~ekgrp
ekpo~ebelp
ekpo~txz01
ekpo~matnr
ekpo~werks
ekpo~menge
ekpo~meins
ekpo~netpr
ekpo~netwr
INTO TABLE t_itab1 FROM
ekko INNER JOIN ekpo ON ekkoebeln = ekpoebeln
WHERE ekko~ebeln IN s_ebeln AND
ekko~bukrs IN s_bukrs AND
ekko~lifnr IN s_lifnr AND
ekko~ekorg IN s_ekorg AND
ekko~ekgrp IN s_ekgrp AND
ekpo~matnr IN s_matnr AND
ekko~bsart = p_bsart.
ENDIF.
IF NOT t_itab1[] IS INITIAL.
FETCHING NAME1
SELECT werks
name1
FROM t001w
INTO TABLE t_name1
FOR ALL ENTRIES IN t_itab1
WHERE werks = t_itab1-werks.
SORT t_itab1 BY werks.
SORT t_name1 BY werks.
IF sy-subrc = 0.
LOOP AT t_itab1 INTO wa_itab1.
hold_tabix = sy-tabix.
READ TABLE t_name1 INTO wa_name1 WITH KEY werks = wa_itab1-werks
BINARY SEARCH.
IF sy-subrc = 0.
wa_itab1-name1 = wa_name1-name1.
MODIFY t_itab1 INDEX hold_tabix FROM wa_itab1.
ENDIF.
FETCHING HEADER TEXT
MOVE wa_itab1-ebeln TO ws_name.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = ws_id
language = sy-langu
name = ws_name
object = ws_object
TABLES
lines = t_tlinetab
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.
LOOP AT t_tlinetab INTO wa_tlinetab.
wa_itab1-header_text = wa_tlinetab-tdline.
MODIFY t_itab1 FROM wa_itab1.
ENDLOOP.
ENDIF. " IF sy-subrc = 0.
CLEAR : wa_itab1,
hold_tabix,
wa_name1.
ENDLOOP.
ENDIF.
ENDIF. " IF NOT t_itab1[] IS INITIAL.
IF t_itab1[] IS INITIAL.
MESSAGE i000(zg) WITH text-008.
ENDIF.
SORT : t_itab1 BY bukrs lifnr ebeln ebelp.
ENDFORM. " fetch_data
*& Form build_fieldcatalog *
FORM build_fieldcatalog .
COMPANY CODE
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'BUKRS'.
lf_fieldcat-ref_tabname = 'EKKO'.
lf_fieldcat-ref_fieldname = 'BUKRS'.
lf_fieldcat-fix_column = 'X'.
APPEND lf_fieldcat TO lt_fieldcat.
VENDOR
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'LIFNR'.
lf_fieldcat-ref_tabname = 'EKKO'.
lf_fieldcat-ref_fieldname = 'LIFNR'.
lf_fieldcat-fix_column = 'X'.
APPEND lf_fieldcat TO lt_fieldcat.
PURCHASING DOCUMENT NUMBER
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'EBELN'.
lf_fieldcat-ref_tabname = 'EKKO'.
lf_fieldcat-ref_fieldname = 'EBELN'.
lf_fieldcat-key = 'X'.
lf_fieldcat-do_sum = 'X'.
lf_fieldcat-fix_column = 'X'.
APPEND lf_fieldcat TO lt_fieldcat.
ITEM NUMBER OF PURCHASING DOCUMENT
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'EBELP'.
lf_fieldcat-ref_tabname = 'EKPO'.
lf_fieldcat-ref_fieldname = 'EBELP'.
APPEND lf_fieldcat TO lt_fieldcat.
SHORT TEXT
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'TXZ01'.
lf_fieldcat-ref_tabname = 'EKPO'.
lf_fieldcat-ref_fieldname = 'TXZ01'.
APPEND lf_fieldcat TO lt_fieldcat.
MATERIAL NUMBER
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'MATNR'.
lf_fieldcat-ref_tabname = 'EKPO'.
lf_fieldcat-ref_fieldname = 'MATNR'.
APPEND lf_fieldcat TO lt_fieldcat.
PLANT
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'WERKS'.
lf_fieldcat-ref_tabname = 'EKPO'.
lf_fieldcat-ref_fieldname = 'WERKS'.
APPEND lf_fieldcat TO lt_fieldcat.
NAME
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'NAME1'.
lf_fieldcat-ref_tabname = 'T001W'.
lf_fieldcat-ref_fieldname = 'NAME1'.
APPEND lf_fieldcat TO lt_fieldcat.
PURCHASE ORDER QUANTITY
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'MENGE'.
lf_fieldcat-ref_tabname = 'EKPO'.
lf_fieldcat-ref_fieldname = 'MENGE'.
lf_fieldcat-do_sum = 'X'.
lf_fieldcat-qfieldname = 'MEINS'.
APPEND lf_fieldcat TO lt_fieldcat.
UNIT
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'MEINS'.
lf_fieldcat-ref_tabname = 'EKPO'.
lf_fieldcat-ref_fieldname = 'MEINS'.
APPEND lf_fieldcat TO lt_fieldcat.
NET PRICE IN PURCHASING DOCUMENT
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'NETPR'.
lf_fieldcat-ref_tabname = 'EKPO'.
lf_fieldcat-ref_fieldname = 'NETPR'.
lf_fieldcat-cfieldname = 'WAERS'.
lf_fieldcat-do_sum = 'X'.
APPEND lf_fieldcat TO lt_fieldcat.
NET ORDER VALUE IN PO CURRENCY
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'NETWR'.
lf_fieldcat-ref_tabname = 'EKPO'.
lf_fieldcat-ref_fieldname = 'NETWR'.
lf_fieldcat-cfieldname = 'WAERS'.
lf_fieldcat-do_sum = 'X'.
APPEND lf_fieldcat TO lt_fieldcat.
CURRENCY
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'WAERS'.
lf_fieldcat-ref_tabname = 'EKKO'.
lf_fieldcat-ref_fieldname = 'WAERS'.
APPEND lf_fieldcat TO lt_fieldcat.
HEADER TEXT
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'HEADER_TEXT'.
lf_fieldcat-seltext_m = 'Header Text'.
APPEND lf_fieldcat TO lt_fieldcat.
ENDFORM. " build_fieldcatalog
*& Form display_grid *
FORM display_grid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = ws_repid
i_callback_pf_status_set = 'PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
is_layout = l_layout
it_fieldcat = lt_fieldcat
it_sort = l_sort
i_save = 'X'
IMPORTING
TABLES
t_outtab = t_itab1
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. " display_grid
*& Form build_layout *
FORM build_layout .
l_layout-colwidth_optimize = 'X'.
l_layout-zebra = 'X'.
l_layout-box_fieldname = 'CHK'.
l_layout-box_tabname = 'T_ITAB1' .
ENDFORM. " build_layout
*& Form sort_layout *
FORM sort_layout .
CLEAR w_sort.
w_sort-fieldname = 'BUKRS'.
w_sort-tabname = 'T_ITAB1'.
w_sort-spos = 1.
w_sort-up = 'X'.
w_sort-subtot = 'X'.
APPEND w_sort TO l_sort.
CLEAR w_sort.
w_sort-fieldname = 'EBELN'.
w_sort-tabname = 'T_ITAB1'.
w_sort-spos = 1.
w_sort-up = 'X'.
w_sort-subtot = 'X'.
APPEND w_sort TO l_sort.
ENDFORM. " sort_layout
*& Form PF_STATUS
FORM pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'STANDARD1' EXCLUDING rt_extab.
ENDFORM. " PF_STATUS
*& Form user_command
FORM user_command USING s_ucomm TYPE sy-ucomm
rs_selfield TYPE slis_selfield.
CLEAR wa_itab1.
READ TABLE t_itab1 INTO wa_itab1 INDEX rs_selfield-tabindex.
CASE s_ucomm.
WHEN 'POD'.
SET PARAMETER ID 'BES' FIELD wa_itab1-ebeln.
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
CLEAR wa_itab1.
WHEN 'MAT'.
SET PARAMETER ID 'MAT' FIELD wa_itab1-matnr.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
WHEN '&IC1'.
IF rs_selfield-fieldname = 'MATNR'.
SET PARAMETER ID 'MAT' FIELD wa_itab1-matnr.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
ELSEIF rs_selfield-fieldname = 'EBELN'.
SET PARAMETER ID 'BES' FIELD wa_itab1-ebeln.
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
WHEN 'PRINT'.
PERFORM multiple_sel.
PERFORM call_form.
CLEAR : f_itab1, f_itab2.
WHEN 'SMART'.
PERFORM multiple_sel.
PERFORM call_smartform.
ENDCASE.
ENDFORM. "user_command -
diff erence between list and grid display.
difference between occurs 0 and occurs 10Hi Sunil
When you give OCCURS 0,
the incremented memory in Internal table will be : 8KB by default.
when you give occurs 10 ,
the incremented memory in Internal table will be : ten records of memory.
Means,
Initially, the internal table has 8 KB of memory.
if that is filled out with data, then the memory will be incremented according to OCCURS parameter.(wat i gave in the above).
Coming to performance: If you know the no. of records your fetching into the Internal table you use OCCURS <no. of records>. It would perform well than OCCURS 0.
Occurs 0 keeps on incrementing 8kb when there is a value. But Occurs 10 will assign 10 records space even though there is no value.
Lets suppose you did not get any values from the DB after a select, in this case if you write Occurs 0 it will not allocate any single space in the memory. If you write OCCURS 10 it will pre allocates some memory.
Reward if helpful
Regards
Lakshman -
Hi,
Is there any possibility to wrap all the columns in one page...
i.e, I do not want to scroll horizontally to see all the columns, instead can we wrap one row into two or three rows so that it will be accommodated in a single view without horizontal scrolling...
Regards
JikuHi
Try with this statement:
REPORT Z_VPS_GEOS_SNAPSHOT1
NO STANDARD PAGE HEADING
LINE-SIZE 250
MESSAGE-ID 00.
Based on the requirement we can increase that line-size.
Hope this helps you, reply for queries, Shall post you the updates.
Regards,
Sree -
Problem with dispalying Colum name in ALV grid - Urgent
My requirement is to print the column name as "Sales order item number".
I declared the field for "Sales order item number" in the output table as
aupos LIKE vbrp-aupos
And in field catalog
pt_hlp_fieldcat-reptext_ddic = 'Sales order Item number'.
pt_hlp_fieldcat-seltext_l = 'Sales order Item number'.
pt_help_fieldcat-seltext_m = 'Sales order Item number'.
pt_hlp_fieldcat-seltext_s = 'Sales order Item number.'.
Append pt_hlp_fieldcat.
My layout is as follows
PS_LAYOUT-ZEBRA = 'X'.
PS_LAYOUT-window_titlebar = 'Invoice Buildup'.
PS_LAYOUT-DETAIL_POPUP = ' '.
PS_LAYOUT-TOTALS_BEFORE_ITEMS = ' '.
PS_LAYOUT-GET_SELINFOS = 'X'.
PS_LAYOUT-GROUP_CHANGE_EDIT = 'X'.
PS_LAYOUT-confirmation_prompt = 'X'.
PS_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
PS_LAYOUT-NO_KEYFIX = 'X'.
PS_LAYOUT-KEY_HOTSPOT = 'X'.
The problem is still it is displaying the field name form the table-field label.
How can i forcefuly display the colum name irrespect of table field label.
Thanks in advance....See the sample code
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
Similarly u can
fieldcatalog-fieldname = 'AUPOS'.
<b>fieldcatalog-seltext_m = 'Sales order item number'.</b>
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
hope this helps.
reward points if this helps. -
Internet Sales 5.0 Development & Extension Guide urgent
Hi
can some one send me a copy of it to [email protected]
I have seen this has been already passed on so someone try to forward a copy to me too.
Thanks in advance.Hello all,
As the document referring here is a publish right document,
Please use your s-user id to access the following link for the doc instead of email distribution.
https://websmp208.sap-ag.de/~sapidb/011000358700000469462006E/SAP_ISA50_DevAndExtGuide.pdf
I am blocking this thread.
Hongyan
Maybe you are looking for
-
SQL Concat function seem not to work properly in SQL query data model. BIP 11g
I try to use this function to show entire name CONCAT(name, ' ', surname) and it doesnt show the surname. it looks like it only tooks 2 arguments. I use it with the option "Add element by expression" within a SQL Query - Data set. Lucia
-
Why are my movies not shown in iTunes
Hi, I have just bought a Mac Mini and have updated all the software etc to the latest versions. The problem I am having is that in the Leopard Movie folder I have all of my TV Shows and Films but the do not show up in the movie tab in iTunes, if i wa
-
[J2EE:160167] uses ejb-links but no EJB modules
Dear All Seeking support/assistance to resolve the below problem. I'm using laster Jdeveloper 11g software publish in 2011. weblogic.deployment.EnvironmentException: [J2EE:160167]The module abc-ViewController-context-root in application abc_Project1_
-
Lens correction for Hasselblad V series lenses
Lightroom does not provide lens correction for Hasselbald V series lenses, e.g. Carl Zeiss Planar 2,8/80. Hasselblad Phocus program does but Lightroom ignores Phocus metadata in FFF files imports. Is there any posssibility to achieve lens correction
-
On other computer, w/Vista, Windows Mail, clicking Send Link works perfectly, providing one click hyperlink. Running latest Firefox on both computers. Made Windows Live Mail default email. No help. Uninstalled Windows Live Mail and switched to thunde