USER_COMMAND logic
I have below code
{MODULE user_command_0100 INPUT.
DATA : ok_code LIKE sy-ucomm,
save_ok LIKE ok_code,
output LIKE ok_code.
ok_code = sy-ucomm.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN '&F03' OR '&F15' OR '&F12'.
LEAVE PROGRAM.
WHEN 'DISPLAY'.
LEAVE TO SCREEN 100.
WHEN OTHERS.
output = save_ok.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT}
In the above code I want to also add command for following functions
1) find 2) print 3) First Page 4) Next page 5) last page
what is the code to be written for these functions? is there a list of these functions like I have written for 'LEAVE PROGRAM'.
Regards,
Santosh
But I am not getting how to add it to the code.
should i do like this ???
CASE save_ok.
WHEN '&F03' OR '&F15' OR '&F12'.
LEAVE PROGRAM.
WHEN 'DISPLAY'.
LEAVE TO SCREEN 100.
WHEN '%SC'.
FIND.
WHEN '&RNT'.
Print.
WHEN OTHERS.
output = save_ok.
ENDCASE.
Similar Messages
-
ALV Grid, USER_COMMAND logic required.
Hi there,
In my requirement, I display ALV Grid output with check-box as first field, Material no as second field and so on. when I check checkbox and press pushbuton in application tool bar, the control leads to MM02 transaction code. How to implement this logic.
another question: suppose I check 10 checkboxes for 10 Materials and press pushbutton. 10 transaction codes (i.e. MM02) with with the Materials that I have selected comes one after another. Is it possible?
Regards,
Zakir.Hi Zakir,
Under the field catalog insert chk box logic like this
wa_fieldcat-col_pos = '1'.
wa_fieldcat-seltext_l = 'Check'.
wa_fieldcat-checkbox = 'X'.
append wa_fieldcat to it_fieldcat.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = v_repid
* I_CALLBACK_PF_STATUS_SET = ' '
<b> I_CALLBACK_USER_COMMAND = 'IT_USER_COMMAND'</b>* 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 = 'Purchase Order Details'
* I_GRID_SETTINGS = I_GRID_SETTINGS
is_layout = wa_layout
it_fieldcat = it_fieldcat
* IT_EXCLUDING = IT_EXCLUDING
* IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS
it_sort = it_sort
* IT_FILTER = IT_FILTER
* IS_SEL_HIDE = IS_SEL_HIDE
* I_DEFAULT = 'X'
i_save = w_save
is_variant = i_variant
it_events = it_event
* IT_EVENT_EXIT = IT_EVENT_EXIT
* IS_PRINT = IS_PRINT
* IS_REPREP_ID = 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_ALV_GRAPHICS
* IT_HYPERLINK = IT_HYPERLINK
* IT_ADD_FIELDCAT = IT_ADD_FIELDCAT
* IT_EXCEPT_QINFO = IT_EXCEPT_QINFO
* IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER
* ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER
tables
t_outtab = it_final
exceptions
program_error = 1
others = 2
*& Form IT_USER_COMMAND
* text
form it_user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
free it_fieldcat.
case r_ucomm.
when '&IC1'.
read table <final internal table>index rs_selfield-tabindex.
perform <action>.
endcase.
endform. "IT_USER_COMMAND
Thanks
Vikranth Khimavath -
Hi iam trying to get the po line item latest changedby name to display in my report
can you give me the logic to get the changed by name for theline item.
i have written the code but if i change the line item 20 then in the out put the changedby name is being displayed for line itema 10 ,20, 30 i e for all line items .but i want the changeby name to be displayed only for the particular line item which was changed.
*& Report ZMR_PO_AUDIT_RPT *
*& Purpose - Report on PO release details for auditing. *
Program ID : ZMR_PO_AUDIT_RPT *
Title : Purchase Release Audit Report *
Create Date : 19.03.2007 *
Author : Marina Gosman (JH IT services) *
Tech. Spec : *
Change Req #: *
Changed by | Description of change | Date *
MarinaG | Change the report Heading to Purchase | *
| Order Action Audit Report R3DK912376 |23.03.07 *
MarinaG | Fix a select bug. R3DK912384 |23.03.07 *
MarinaG | Change report heading by removing fields |27.03.07 *
| R3DK912404 | *
MarinaG | Add exception checkbox which will only |3.04.07 *
| show the same GR, Released and Created | *
| username R3DK912444. | *
MarinaG | Add GR Value and Vendor Name FP#1919 |28.08.07 *
| R3DK912809 | *
MarinaG | Add line item no., display line items for |11.10.07 *
| GR period and GR date FP#1919 R3DK912960 | *
REPORT ZSAMPLE3 NO STANDARD PAGE HEADING LINE-SIZE 200
MESSAGE-ID zv.
Database Tables
TABLES: ekko,t16fd,cdhdr,cdpos,t000,lfa1,t024,ekbe,mkpf.
TYPE-POOLS slis.
Type Declaration
*TYPE-POOLS: kkblo.
Structures
DATA:BEGIN OF st_output,
ebeln LIKE ekko-ebeln,
batxt LIKE t161t-batxt,
banfn LIKE eban-banfn,
bukrs LIKE ekko-bukrs,
frggr LIKE ekko-frggr,
frgsx LIKE ekko-frgsx,
frgct LIKE t16fd-frgct,
udate LIKE cdhdr-udate,
utime like cdhdr-utime,
username LIKE cdhdr-username,
lifnr LIKE ekko-lifnr, " vendor
name1 LIKE lfa1-name1, " vendor name
ebelp LIKE ekpo-ebelp, " line no.
afnam LIKE ekpo-afnam, " requisitioner
netwr LIKE ekpo-netwr,
ekgrp LIKE ekko-ekgrp,
eknam LIKE t024-eknam,
ernam LIKE ekko-ernam,
grnam LIKE ekbe-ernam,
bedat LIKE ekko-bedat,
budat LIKE ekbe-budat,
belnr LIKE ekbe-belnr, "R3DK912960
dmbtr LIKE ekbe-dmbtr, "R3DK912960
Indira
cdate LIKE cdhdr-username,
Indira
END OF st_output.
Indra
DATA: l_ponum LIKE ekko-ebeln,
l_poline LIKE ekpo-ebelp.
DATA: BEGIN OF t_EKbe OCCURS 0,
ebeln LIKE EKbe-ebeln,
belnr LIKE EKbe-Belnr,
budat LIKE EKbe-Budat,
cputm LIKE EKbe-cputm,
END OF T_EKbe.
DATA: BEGIN OF T_mkpf OCCURS 0,
mblnr LIKE mkpf-mblnr,
usnam LIKE mkpf-usnam,
END OF T_mkpf.
Internal Tables
DATA: t_cdhdr LIKE cdhdr OCCURS 0 WITH HEADER LINE,
t_cdhdr1 LIKE cdhdr OCCURS 0 WITH HEADER LINE,
po_ekko LIKE ekko OCCURS 0 WITH HEADER LINE.
Indra
DATA: t_cdpos LIKE cdpos OCCURS 0 WITH HEADER LINE.
indra
DATA: BEGIN OF tbl_output OCCURS 0.
INCLUDE STRUCTURE st_output.
DATA: END OF tbl_output.
DATA: BEGIN OF tbl_ekpo OCCURS 0.
INCLUDE STRUCTURE ekpo.
DATA: END OF tbl_ekpo.
DATA: BEGIN OF tbl_ekbe OCCURS 0.
INCLUDE STRUCTURE ekbe.
DATA: END OF tbl_ekbe.
DATA: BEGIN OF t_ekko OCCURS 0,
ebeln TYPE ebeln,
ebelp TYPE ebelp, "R3DK912960
belnr TYPE MBLNR, "R3DK912960
bukrs TYPE bukrs,
bsart TYPE bsart,
bedat TYPE bedat,
budat TYPE budat,
ernam TYPE ernam,
grnam TYPE ernam,
dmbtr TYPE dmbtr, "R3DK912960
END OF t_ekko.
DATA: c_tcode(25) TYPE c.
DATA: st_fieldcat TYPE slis_fieldcat_alv.
DATA: tbl_fieldcat TYPE slis_t_fieldcat_alv.
DATA: st_event TYPE slis_alv_event.
DATA: tbl_events TYPE slis_t_event.
DATA: fieldname(30) TYPE c.
DATA: st_layout TYPE slis_layout_alv.
DATA: g_status TYPE slis_formname VALUE 'STANDARD01'.
DATA: g_user_command TYPE slis_formname VALUE 'USER_COMMAND'.
DATA: st_status TYPE slis_status.
DATA: tbl_status TYPE slis_status OCCURS 0 WITH HEADER LINE.
DATA: f_ebeln LIKE ekko-ebeln.
DATA: cursorfield LIKE ekko-ebeln.
DATA: ws_ebeln LIKE ekko-ebeln,
ws_netwr LIKE ekpo-netwr,
ws_ernam LIKE ekbe-ernam,
rs_selfield TYPE slis_selfield,
ws_dmbtr LIKE ekbe-dmbtr. "R3DK912809
RANGES: r_kunnr FOR vbak-kunnr OCCURS 0.
Selection Screen
SELECTION-SCREEN BEGIN OF BLOCK title WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_bukrs FOR ekko-bukrs OBLIGATORY,
s_ekorg FOR ekko-ekorg OBLIGATORY,
s_ebeln FOR ekko-ebeln,
s_groups FOR ekko-ekgrp,
s_lifnr FOR ekko-lifnr,
s_bedat FOR ekko-bedat,
s_budat FOR ekbe-budat,
s_bsart FOR ekko-bsart.
SELECTION-SCREEN END OF BLOCK title .
SELECTION-SCREEN BEGIN OF BLOCK title2 WITH FRAME TITLE text-001.
PARAMETERS: p_gr AS CHECKBOX DEFAULT 'X',
p_excep AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK title2 .
*& AT SELECTION SCREEN
AT SELECTION-SCREEN.
IF NOT p_gr IS INITIAL.
IF s_budat IS INITIAL.
MESSAGE s000 WITH 'Please enter Goods Receipt Date.'.
STOP.
ENDIF.
ELSE.
IF s_bedat IS INITIAL.
MESSAGE s000 WITH 'Please enter Purch Doc Date.'.
STOP.
ENDIF.
ENDIF.
START-OF-SELECTION.
START-OF-SELECTION.
PERFORM select_data. " Select data
PERFORM sort_table.
PERFORM get_events. " Include header in display
PERFORM get_eventstatus. " Set the GUI status
PERFORM get_layout. " Define ALV Layout
PERFORM get_fieldcat. " Fill report fields
PERFORM create_report. " Write ALV format
AT LINE-SELECTION.
PERFORM user_command USING sy-ucomm
rs_selfield.
FORM user_command *
--> R_UCOMM *
--> RS_SELFIELD *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: l_ta TYPE sy-tcode VALUE 'SLIS_DUMMY'.
CLEAR: f_ebeln.
CASE r_ucomm.
WHEN 'CF1'.
READ TABLE tbl_output INDEX rs_selfield-tabindex.
IF sy-subrc = 0.
f_ebeln = tbl_output-ebeln.
ENDIF.
SET PARAMETER ID 'BES' FIELD f_ebeln.
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
Begin of R3DK912404
WHEN 'EXIT' OR 'CANC'.
LEAVE PROGRAM.
End of R3DK912404
WHEN 'OTHERS'.
ENDCASE.
ENDFORM. "user_command
FORM STANDARD_02 *
--> EXTAB *
FORM standard_01 USING extab TYPE slis_t_extab.
SET PF-STATUS 'STANDARD01' EXCLUDING extab .
ENDFORM. "standard_01
*& Form get_events
setup report headings
--> p1 text
<-- p2 text
FORM get_events.
CLEAR st_event.
st_event-name = 'TOP_OF_PAGE'.
st_event-form = 'PROCESS_TOP_OF_PAGE'.
APPEND st_event TO tbl_events.
ENDFORM. " get_events
FORM get_eventstatus *
FORM get_eventstatus.
CLEAR st_status.
st_status-callback_pf_status_set = 'STANDARD_01'.
APPEND st_status TO tbl_status.
ENDFORM. " get_eventstatus
*& Form get_layout
text
--> p1 text
<-- p2 text
FORM get_layout.
CLEAR st_layout.
st_layout-zebra = 'X'.
ENDFORM. " get_layout
*& Form get_fieldcat
text
--> p1 text
<-- p2 text
FORM get_fieldcat.
PERFORM write_fieldcat USING 'EBELN' 'TBL_OUTPUT' 'EKKO' 'X' 1 ' '.
PERFORM write_fieldcat USING 'BUKRS' 'TBL_OUTPUT' 'EKKO' 'X' 2 ' '.
Begin of R3DK912960
PERFORM write_fieldcat USING 'EBELP' 'TBL_OUTPUT' 'EKPO' 'X' 3 ' '.
End of R3DK912960
PERFORM write_fieldcat USING 'UDATE' 'TBL_OUTPUT' ' ' ' ' 4
'Doc. Date'.
PERFORM write_fieldcat USING 'UTIME' 'TBL_OUTPUT' ' ' ' ' 13
'Doc. Time'.
Begin of R3DK912960
PERFORM write_fieldcat USING 'BUDAT' 'TBL_OUTPUT' ' ' ' ' 5
'GR Date'.
End of R3DK912960
PERFORM write_fieldcat USING 'ERNAM' 'TBL_OUTPUT' ' ' ' ' 6
'Created By'.
PERFORM write_fieldcat USING 'USERNAME' 'TBL_OUTPUT' ' ' ' ' 7
'Released By'.
PERFORM write_fieldcat USING 'GRNAM' 'TBL_OUTPUT' ' ' ' ' 8
'Goods Receipted By'.
PERFORM write_fieldcat USING 'CDATE' 'TBL_OUTPUT' ' ' ' ' 9
'Changed By'.
PERFORM write_fieldcat USING 'NETWR' 'TBL_OUTPUT' ' ' ' ' 10
'Total Value'.
PERFORM write_fieldcat USING 'EKGRP' 'TBL_OUTPUT' 'EKKO' ' ' 11 ' '.
Begin of R3DK912809
PERFORM write_fieldcat USING 'DMBTR' 'TBL_OUTPUT' ' ' ' ' 12
'GR Value '.
PERFORM write_fieldcat USING 'NAME1' 'TBL_OUTPUT' ' ' ' ' 13
'Vendor Name'.
End of R3DK912809
ENDFORM. " get_fieldcat
FORM process_top_of_page *
FORM process_top_of_page.
SKIP.
ULINE.
FORMAT COLOR COL_HEADING INTENSIFIED OFF .
Begin of R3DK912376
WRITE:/ 'Report Name : PO Release Audit Report',
WRITE:/ 'Report Name : Purchase Order Actions Report',
End of R3DK912376
/ 'Run Date : ', sy-datum,
/ 'Run Time : ', sy-uzeit,
Begin of R3DK912404
/ 'Document Type : ', c_tcode,
End of R3DK912404
/ 'Company code : ', s_bukrs-low.
IF NOT s_bukrs-high IS INITIAL.
WRITE: 'To', s_bukrs-high.
ENDIF.
WRITE:/ 'Purch Org : ', s_ekorg-low.
IF NOT s_ekorg-high IS INITIAL.
WRITE: 'To', s_ekorg-high.
ENDIF.
Begin of R3DK912404
WRITE:/ 'Purchase Order : ', s_ebeln-low.
IF NOT s_ebeln-high IS INITIAL.
WRITE: 'To', s_ebeln-high.
ENDIF.
WRITE:/ 'Purchasing Grp : ', s_groups-low.
IF NOT s_groups-high IS INITIAL.
WRITE: 'To', s_groups-high.
ENDIF.
WRITE:/ 'Vendor : ', s_lifnr-low.
IF NOT s_lifnr-high IS INITIAL.
WRITE: 'To', s_lifnr-high.
ENDIF.
WRITE:/ 'Goods Receipt Date:', s_budat-low.
IF NOT s_budat-high IS INITIAL.
WRITE: 'To', s_budat-high.
ENDIF.
End of R3DK912404
WRITE:/ 'Purch Doc Date : ', s_bedat-low.
IF NOT s_bedat-high IS INITIAL.
WRITE: 'To', s_bedat-high.
ENDIF.
Begin of R3DK912404
WRITE:/ 'Purch Doc Type : ', s_bsart-low.
IF NOT s_bsart-high IS INITIAL.
WRITE: 'To', s_bsart-high.
ENDIF.
End of R3DK912404
ULINE.
FORMAT COLOR COL_HEADING INTENSIFIED OFF.
ENDFORM. " process_top_of_page
*& Form create_report
text
--> p1 text
<-- p2 text
FORM create_report.
SORT tbl_output BY ebeln ebelp.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_events = tbl_events
i_interface_check = ' '
i_callback_program = 'ZSAMPLE3'
i_callback_pf_status_set = g_status
i_callback_user_command = g_user_command
is_layout = st_layout
it_fieldcat = tbl_fieldcat
i_default = 'X'
i_save = 'X'
TABLES
t_outtab = tbl_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. " create_report
*& Form select_data
select records for specified selections
--> p1 text
<-- p2 text
FORM select_data.
CLEAR: c_tcode, t_cdhdr, t_ekko, tbl_output.
REFRESH: t_cdhdr, t_ekko, tbl_output, tbl_fieldcat.
IF NOT p_gr IS INITIAL.
SELECT DISTINCT a~ebeln "R3DK912960
SELECT a~ebeln "R3DK912960
b~ebelp "R3DK912960
b~belnr
a~bukrs
a~bsart
a~bedat
b~budat
a~ernam
b~ernam
INTO TABLE t_ekko
FROM ekko AS a
INNER JOIN ekbe AS b
ON aebeln = bebeln
Begin of R3DK912384
AND b~bewtp = 'E'
AND b~bwart = '101'
End of R3DK912384
WHERE a~bukrs IN s_bukrs AND
a~ebeln IN s_ebeln AND
a~ekgrp IN s_groups AND
a~lifnr IN s_lifnr AND
a~bsart IN s_bsart AND
a~ekorg IN s_ekorg and
a~bedat IN s_bedat AND
b~budat IN s_budat AND
a~frgke = 'R'
ORDER BY aebeln bbudat DESCENDING.
Begin of R3DK912809 R3DK912960
DELETE ADJACENT DUPLICATES FROM T_EKKO COMPARING EBELN.
End of R3DK912809 R3DK912960
ELSE.
SELECT DISTINCT a~ebeln "R3DK912960
SELECT a~ebeln "R3DK912960
b~ebelp "R3DK912960
b~belnr
a~bukrs
a~bsart
a~bedat
b~budat
a~ernam
b~ernam
INTO TABLE t_ekko
FROM ekko AS a
LEFT JOIN ekbe AS b
ON aebeln = bebeln
Begin of R3DK912384
AND b~bewtp = 'E'
AND b~bwart = '101'
End of R3DK912384
WHERE a~bukrs IN s_bukrs AND
a~ebeln IN s_ebeln AND
a~ekgrp IN s_groups AND
a~lifnr IN s_lifnr AND
a~bsart IN s_bsart AND
a~ekorg IN s_ekorg AND
a~bedat IN s_bedat AND
a~frgke = 'R'
ORDER BY aebeln bbudat DESCENDING.
Begin of R3DK912809 R3DK912960
DELETE ADJACENT DUPLICATES FROM T_EKKO COMPARING EBELN.
End of R3DK912809 R3DK912960
ENDIF.
sort t_ekko by ebeln ebelp budat descending.
sivanew
delete adjacent duplicates from t_ekko comparing ebeln ebelp .
sivanew
IF sy-subrc EQ 0. "R3DK912809
IF NOT t_ekko[] IS INITIAL. "R3DK912809
PERFORM process_data.
Begin of R3DK912444
IF NOT p_excep IS INITIAL.
PERFORM get_exceptions.
ENDIF.
End of R3DK912444
ENDIF.
ENDFORM. " select_data
*& Form write_fieldcat
text
-->P_0190 field name, if the SAP name used desc will be
automatically get from SAP table
-->P_0191 Internale structure or table name
-->P_0192 SAP table for field description
-->P_0193 format
-->P_1 Position
-->P_0195 Custom Description
FORM write_fieldcat USING name tab st key pos desc.
st_fieldcat-fieldname = name.
st_fieldcat-tabname = tab.
st_fieldcat-ref_tabname = st.
st_fieldcat-key = key.
st_fieldcat-col_pos = pos.
st_fieldcat-seltext_m = desc.
IF pos = 12.
st_fieldcat-outputlen = 40.
ENDIF.
APPEND st_fieldcat TO tbl_fieldcat.
CLEAR st_fieldcat.
ENDFORM. " write_fieldcat
*& Form process_record
text
--> p1 text
<-- p2 text
FORM process_record.
DATA:l_ebeln LIKE ekko-ebeln.
LOOP AT t_cdhdr.
CLEAR: l_ebeln, ws_ebeln, ws_netwr, ws_ernam.
MOVE t_cdhdr-objectid TO l_ebeln.
CALL FUNCTION 'ME_EKKO_SINGLE_READ'
EXPORTING
pi_ebeln = l_ebeln
IMPORTING
po_ekko = po_ekko.
Begin of R3DK912809 R3DK912960
SELECT SUM( dmbtr ) INTO ws_dmbtr
FROM ekbe WHERE ebeln = l_ebeln
AND vgabe = '1'
AND bewtp = 'E'
GROUP BY ebeln.
ENDSELECT.
End of R3DK912809
SELECT SINGLE dmbtr INTO t_ekko-dmbtr
FROM ekbe WHERE ebeln = t_ekko-ebeln
AND ebelp = t_ekko-ebelp
AND belnr = t_ekko-belnr
AND vgabe = '1'
AND bewtp = 'E'.
MODIFY T_EKKO.
End of R3DK912960
SELECT SINGLE ernam INTO t_ekko-grnam
FROM ekbe WHERE ebeln = t_ekko-ebeln
AND ebelp = t_ekko-ebelp
AND ELIKZ = 'X'.
MODIFY T_EKKO.
SELECT ebeln SUM( netwr ) INTO (ws_ebeln, ws_netwr)
FROM ekpo WHERE ebeln = l_ebeln R3DK912960
FROM ekpo WHERE ebeln = t_ekko-ebeln "R3DK912960
GROUP by ebeln.
ENDSELECT.
IF sy-subrc EQ 0.
IF s_groups IS INITIAL.
PERFORM build_output.
ELSE.
IF po_ekko-ekgrp IN s_groups.
PERFORM build_output.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " process_record
*& Form get_customer
Get Customers if sales office specified
--> p1 text
<-- p2 text
*& Form build_output
text
--> p1 text
<-- p2 text
FORM build_output.
DATA: l_line LIKE ekpo-ebelp.
DATA: l_requisitioner LIKE ekpo-afnam.
IF po_ekko-frgke = 'R'.
CLEAR: tbl_output.
tbl_output-udate = t_cdhdr-udate.
tbl_output-utime = t_cdhdr-utime.
tbl_output-username = t_cdhdr-username.
tbl_output-ebeln = po_ekko-ebeln.
tbl_output-bukrs = po_ekko-bukrs.
tbl_output-lifnr = po_ekko-lifnr.
tbl_output-name1 = ' '.
tbl_output-lifnr = po_ekko-lifnr.
tbl_output-ekgrp = po_ekko-ekgrp.
tbl_output-ernam = po_ekko-ernam.
tbl_output-ernam = t_ekko-ernam.
tbl_output-budat = t_ekko-budat.
tbl_output-grnam = t_ekko-grnam.
tbl_output-bedat = t_ekko-bedat.
tbl_output-dmbtr = t_ekko-dmbtr. "R3DK912809
tbl_output-ebelp = t_ekko-ebelp.
SORT T_CDHDR1.
sivanew
read table t_cdhdr1 with key
objectid = t_cdhdr-objectid binary search.
if sy-subrc = 0.
tbl_output-cdate = t_cdhdr1-username.
endif.
read table t_cdhdr1 with key
tcode = 'ME22N' binary search.
if sy-subrc = 0.
SELECT * FROM cdpos INTO TABLE t_cdpos
WHERE objectid = t_cdhdr1-objectid AND
objectclas = 'EINKBELEG' AND
changenr = t_cdhdr1-changenr.
IF sy-subrc = 0.
l_ponum = t_cdpos-tabkey+3(10).
l_poline = t_cdpos-tabkey+13(6).
ENDIF.
ENDIF.
IF tbl_output-ebeln = l_ponum AND tbl_output-ebelp = l_poline.
READ TABLE t_cdhdr1 WITH KEY changenr = t_cdpos-changenr
tcode = 'ME22N' BINARY SEARCH.
IF sy-subrc = 0.
tbl_output-cdate = t_cdhdr1-username.
ENDIF.
ENDIF.
ENDIF.
select ebeln belnr budat cputm from ekbe into table t_ekbe
where vgabe = '1' and
ebeln = t_cdhdr-objectid.
sort t_ekbe by budat descending cputm descending.
delete adjacent duplicates from t_ekbe comparing ebeln.
loop at t_ekbe.
select mblnr usnam from mkpf into table t_mkpf
where mblnr = t_ekbe-belnr.
if sy-subrc = 0.
read table t_mkpf with key
mblnr = t_ekbe-belnr binary search.
move t_mkpf-usnam to tbl_output-grnam.
endif.
endloop.
Indra
Get the user changed the record
IF t_cdhdr-tcode = 'ME22N'.
SELECT * FROM cdpos INTO TABLE t_cdpos
WHERE objectid = t_cdhdr-objectid AND
objectclas = 'EINKBELEG' AND
changenr = t_cdhdr-changenr.
IF sy-subrc = 0.
l_ponum = t_cdpos-tabkey+3(10).
l_poline = t_cdpos-tabkey+13(6).
ENDIF.
ENDIF.
indra
Display creator or changer
IF tbl_output-ebeln = l_ponum AND tbl_output-ebelp = l_poline.
READ TABLE t_cdhdr WITH KEY changenr = t_cdpos-changenr
tcode = 'ME22N' BINARY SEARCH.
IF sy-subrc = 0.
tbl_output-cdate = t_cdhdr-username.
ENDIF.
ENDIF.
Indra
SELECT SINGLE * FROM t024
WHERE ekgrp = po_ekko-ekgrp.
IF sy-subrc EQ 0.
tbl_output-eknam = t024-eknam.
ENDIF.
tbl_output-netwr = ws_netwr.
SELECT SINGLE name1 FROM lfa1
INTO tbl_output-name1
WHERE lifnr = po_ekko-lifnr.
Get Document descriptions
SELECT SINGLE batxt FROM t161t
INTO tbl_output-batxt
WHERE spras = 'E' AND
bsart = po_ekko-bsart AND
bstyp = po_ekko-bstyp.
Get Release code descriptions
SELECT SINGLE frgct FROM t16fd
INTO tbl_output-frgct
WHERE spras = 'E' AND
frggr = po_ekko-frggr AND
frgco = po_ekko-frgsx.
APPEND tbl_output.
ENDIF.
ENDFORM. " build_output
*& Form SORT_TABLE
text
--> p1 text
<-- p2 text
FORM sort_table.
SORT tbl_output BY ebeln ebelp ascending udate utime DESCENDING.
SORT tbl_output BY ebeln ascending udate utime DESCENDING.
delete adjacent duplicates from tbl_output comparing ebeln ebelp .
ENDFORM. " SORT_TABLE
*& Form PROCESS_DATA
text
--> p1 text
<-- p2 text
FORM process_data.
LOOP AT t_ekko.
c_tcode = 'Purchase Orders'.
SELECT * FROM cdhdr UP TO 1 ROWS INTO TABLE t_cdhdr "R3DK912960
SELECT * FROM cdhdr into table t_cdhdr
WHERE objectclas = 'EINKBELEG' AND
objectid = t_ekko-ebeln AND
tcode = 'ME28'.
SORT T_CDHDR BY UDATE DESCENDING UTIME DESCENDING.
delete adjacent duplicates from t_cdhdr comparing objectid.
siva
SELECT * FROM cdhdr UP TO 1 ROWS INTO TABLE t_cdhdr1
*"R3DK912960
SELECT * FROM cdhdr INTO TABLE t_cdhdr1
WHERE objectclas = 'EINKBELEG' AND
objectid = t_ekko-ebeln AND
tcode = 'ME22N'.
SORT T_CDHDR1 BY UDATE descending UTIME DESCENDING.
delete adjacent duplicates from t_cdhdr1 comparing objectid.
sivanew
if c_tcode = 'ME22N'.
SELECT * FROM cdpos INTO TABLE t_cdpos
WHERE objectid = t_cdhdr1-objectid AND
objectclas = 'EINKBELEG' AND
changenr = t_cdhdr1-changenr.
IF sy-subrc = 0.
l_ponum = t_cdpos-tabkey+3(10).
l_poline = t_cdpos-tabkey+13(6).
ENDIF.
ENDIF.
*sivanew
IF sy-subrc = 0.
delete adjacent duplicates from t_cdhdr comparing objectid.
PERFORM process_record. " process each document
ENDIF.
ENDLOOP.
ENDFORM. " PROCESS_DATA
*& Form get_exceptions
text
--> p1 text
<-- p2 text
form get_exceptions.
Display a report which shows the same released, goods receipted and
created by user
LOOP AT tbl_output.
IF tbl_output-username <> tbl_output-ernam OR
tbl_output-ernam <> tbl_output-grnam.
DELETE tbl_output.
ENDIF.
ENDLOOP.
endform. " get_exceptionsHi,
first of all you should read the following thread ABAP Development It is really hard to read code without proper formatting.
It looks like you use change documents to get user name for last change. For each document you use last change document and hence you have same name for every item. I am not sure if it is possible (it should be) but for each item you need to look for last change document corresponding to this item.
Cheers -
Hi all iam making blocked alv programe.
In the below code if i want to display in Second block the list of Material Types with No. of materials in each type than what should be the approach for this logic.
TYPE-POOLS: slis.
TYPES: BEGIN OF ty_mara ,
matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
END OF ty_mara ,
BEGIN OF ty_makt ,
matnr TYPE makt-matnr,
maktx TYPE makt-maktx,
END OF ty_makt ,
BEGIN OF ty_final ,
mtart TYPE mara-mtart,
matnr TYPE mara-matnr,
maktx TYPE makt-maktx,
record TYPE i ,
END OF ty_final ,
BEGIN OF records,
records TYPE i,
END OF records.
DATA no TYPE i.
*************************INTERNAL TABLES******************************
DATA: it_mara TYPE TABLE OF ty_mara ,
it_makt TYPE TABLE OF ty_makt ,
it_final TYPE TABLE OF ty_final ,
it_fieldcat TYPE slis_t_fieldcat_alv,
it_events TYPE slis_t_event ,
it_fieldcat1 TYPE slis_t_fieldcat_alv,
it_records TYPE TABLE OF records.
*************************WORK AREAS***********************************
DATA: wa_mara TYPE ty_mara ,
wa_makt TYPE ty_makt ,
wa_final TYPE ty_final ,
wa_fieldcat TYPE slis_fieldcat_alv,
wa_layout TYPE slis_layout_alv ,
wa_events TYPE slis_alv_event ,
wa_fieldcat1 TYPE slis_fieldcat_alv,
wa_records TYPE records.
**************************VARIABLES***********************************
DATA: v_mtart TYPE mara-mtart, "#EC NEEDED
v_repid TYPE sy-repid ,
v_text TYPE string .
**************************CONSTANTS***********************************
CONSTANTS: c_zrh(4) TYPE c VALUE 'zrh' ,
c_x(1) TYPE c VALUE 'X' ,
c_02(2) TYPE c VALUE '02' ,
c_04(2) TYPE c VALUE '04' ,
c_06(2) TYPE c VALUE '06' ,
c_mtart(5) TYPE c VALUE 'MTART' ,
c_matnr(5) TYPE c VALUE 'MATNR' ,
c_maktx(5) TYPE c VALUE 'MAKTX' ,
c_it_final(8) TYPE c VALUE 'IT_FINAL' ,
c_mara(4) TYPE c VALUE 'MARA' ,
c_makt(4) TYPE c VALUE 'MAKT' ,
c_l(1) TYPE c VALUE 'L' ,
c_user_command(12) TYPE c VALUE 'USER_COMMAND' ,
c_alv_user_command(16) TYPE c VALUE 'ALV_USER_COMMAND',
c_top_of_page(11) TYPE c VALUE 'TOP_OF_PAGE' ,
c_alv_top_of_page(15) TYPE c VALUE 'ALV_TOP_OF_PAGE' ,
c_end_of_list(11) TYPE c VALUE 'END_OF_LIST' ,
c_alv_end_of_list(15) TYPE c VALUE 'ALV_END_OF_LIST' .
************************INITIALIZATION********************************
INITIALIZATION.
Initialize MTART at the selection screen
PERFORM initialize_mtart.
*********************SELECTION SCREEN*********************************
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
DATA p_mtart TYPE mara-mtart.
SELECT-OPTIONS: imtart FOR p_mtart.
SELECTION-SCREEN END OF BLOCK blk1.
*********************AT SELECTION SCREEN******************************
AT SELECTION-SCREEN.
Validate MTART entered at the selection screen.
PERFORM validate_mtart.
**********************START-OF-SELECTION******************************
START-OF-SELECTION.
Select all the required data
PERFORM select_data.
Prepare final table
PERFORM populate_final_tab.
**********************END-OF-SELECTION********************************
END-OF-SELECTION.
Prepare ALV settings for display
PERFORM prepare_settings.
Display ALV Report
PERFORM display_report.
**********************SUBROUTINES*************************************
*& Form initialize_mtart
Subroutine to Initialize MTART at the selection screen.
FORM initialize_mtart .
p_mtart = c_zrh.
ENDFORM. " initialize_mtart
*& Form validate_mtart
This subroutine is to validate MTART entered at the
selection screen.
FORM validate_mtart .
SELECT SINGLE mtart
FROM t134
INTO v_mtart
WHERE mtart IN imtart.
If not found display error message
IF sy-subrc <> 0.
MESSAGE e014 WITH text-002.
ENDIF.
ENDFORM. " validate_mtart
*& Form select_data
This subroutine selects all the required data
FORM select_data .
SELECT matnr
mtart
FROM mara
INTO TABLE it_mara
WHERE mtart IN imtart.
IF sy-subrc <> 0.
MESSAGE i014 WITH text-003.
LEAVE LIST-PROCESSING.
ELSE.
SORT it_mara BY matnr.
SELECT matnr
maktx
FROM makt
INTO TABLE it_makt UP TO 20 ROWS
FOR ALL ENTRIES IN it_mara
WHERE matnr = it_mara-matnr
AND spras = sy-langu .
IF sy-subrc <> 0.
MESSAGE i014 WITH text-004.
LEAVE LIST-PROCESSING.
ELSE.
SORT it_mara BY mtart.
SORT it_makt BY matnr.
ENDIF.
ENDIF.
ENDFORM. " select_data
*& Form populate_final_tab
This subroutine prepares final internal table.
FORM populate_final_tab .
LOOP AT it_mara INTO wa_mara.
CLEAR wa_final.
CLEAR wa_makt.
READ TABLE it_makt INTO wa_makt
WITH KEY matnr = wa_mara-matnr
BINARY SEARCH.
IF sy-subrc = 0.
wa_final-mtart = wa_mara-mtart.
wa_final-matnr = wa_mara-matnr.
wa_final-maktx = wa_makt-maktx.
APPEND wa_final TO it_final.
ENDIF.
ENDLOOP.
DATA : v_lines TYPE i.
DESCRIBE TABLE it_final LINES v_lines.
**WRITE:/ 'Total lines = ', v_lines.
wa_records-records = v_lines.
LOOP AT it_final INTO wa_final.
no = no + 1.
ENDLOOP.
wa_records-records = no.
APPEND wa_records TO it_records.
ENDFORM. " populate_final_tab
*& Form prepare_settings
This subroutine prepares ALV settings for display
FORM prepare_settings .
Prepare layout
CLEAR wa_layout.
wa_layout-zebra = c_x.
Prepare fieldcat
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = c_02.
wa_fieldcat-fieldname = c_mtart.
wa_fieldcat-tabname = c_it_final.
wa_fieldcat-ref_fieldname = c_mtart.
wa_fieldcat-ref_tabname = c_mara.
wa_fieldcat-ddictxt = c_l.
wa_fieldcat-seltext_l = text-005.
wa_fieldcat-seltext_m = text-005.
wa_fieldcat-seltext_s = text-005.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = c_04.
wa_fieldcat-fieldname = c_matnr.
wa_fieldcat-tabname = c_it_final.
wa_fieldcat-ref_fieldname = c_matnr.
wa_fieldcat-ref_tabname = c_mara.
wa_fieldcat-ddictxt = c_l.
wa_fieldcat-seltext_l = text-006.
wa_fieldcat-seltext_m = text-006.
wa_fieldcat-seltext_s = text-006.
wa_fieldcat-hotspot = c_x.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = c_06.
wa_fieldcat-fieldname = c_maktx.
wa_fieldcat-tabname = c_it_final.
wa_fieldcat-ref_fieldname = c_maktx.
wa_fieldcat-ref_tabname = c_makt.
wa_fieldcat-ddictxt = c_l.
wa_fieldcat-seltext_l = text-007.
wa_fieldcat-seltext_m = text-007.
wa_fieldcat-seltext_s = text-007.
APPEND wa_fieldcat TO it_fieldcat.
records field cat
wa_fieldcat1-col_pos = c_04.
wa_fieldcat1-fieldname = 'RECORDS'.
wa_fieldcat1-tabname = 'RECORDS'.
wa_fieldcat1-seltext_m = 'NO OF RECORDS MATERIAL WISE TYPE LIST'.
APPEND wa_fieldcat1 TO it_fieldcat1.
Prepare Events table.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_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.
SORT it_events BY name.
CLEAR wa_events.
READ TABLE it_events INTO wa_events
WITH KEY name = c_user_command
BINARY SEARCH.
IF sy-subrc = 0.
wa_events-form = c_alv_user_command.
MODIFY it_events
FROM wa_events
INDEX sy-tabix
TRANSPORTING form.
ENDIF.
CLEAR wa_events.
READ TABLE it_events INTO wa_events
WITH KEY name = c_top_of_page
BINARY SEARCH.
IF sy-subrc = 0.
wa_events-form = c_alv_top_of_page.
MODIFY it_events
FROM wa_events
INDEX sy-tabix
TRANSPORTING form.
ENDIF.
CLEAR wa_events.
READ TABLE it_events INTO wa_events
WITH KEY name = c_end_of_list
BINARY SEARCH.
IF sy-subrc = 0.
wa_events-form = c_alv_end_of_list.
MODIFY it_events
FROM wa_events
INDEX sy-tabix
TRANSPORTING form.
ENDIF.
ENDFORM. " prepare_settings
*& Form display_report
This subroutine calls FM to display report
FORM display_report .
CLEAR v_repid.
v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = v_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
IT_EXCLUDING =
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = wa_layout
it_fieldcat = it_fieldcat
i_tabname = 'it_FINAL'
it_events = it_events
IT_SORT =
I_TEXT = ' '
TABLES
t_outtab = it_final
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = wa_layout
it_fieldcat = it_fieldcat1
i_tabname = 'TY_FINAL'
it_events = it_events
IT_SORT =
I_TEXT = ' '
TABLES
t_outtab = it_records
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
IS_PRINT = it_final
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
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_report
*& Form alv_user_command
This subroutine handles user command
FORM alv_user_command USING v_cmd TYPE sy-ucomm
wa_selfield TYPE slis_selfield. "#EC * "#EC
CLEAR wa_final.
READ TABLE it_final INTO wa_final
INDEX wa_selfield-tabindex.
CLEAR v_text.
CONCATENATE text-008
wa_final-matnr
INTO v_text
SEPARATED BY space.
Display to user which material he/she has clicked
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
titel = text-009
textline1 = v_text
start_column = 25
start_row = 6.
ENDFORM. "alv_user_command.
*& Form alv_top_of_page
This subroutine writes top of page
FORM alv_top_of_page. "#EC CALLED
FORMAT COLOR COL_HEADING.
ULINE AT /1(80).
WRITE:/1 sy-vline,
2 text-010,
9 sy-datum,
80 sy-vline.
WRITE:/1 sy-vline,
2 text-011,
9 sy-uzeit,
40 text-012,
80 sy-vline.
WRITE:/1 sy-vline,
2 text-013,
9 sy-uname,
80 sy-vline.
ULINE AT /1(80).
FORMAT COLOR OFF.
ENDFORM. "alv_top_of_page.
*& Form alv_end_of_list
This subroutine writes end of list
FORM alv_end_of_list. "#EC CALLED
FORMAT COLOR COL_HEADING.
ULINE AT /1(80).
WRITE:/1 sy-vline,
2 text-014,
12 no,
80 sy-vline.
ULINE AT /1(80).
FORMAT COLOR OFF.
ENDFORM. "alv_end_of_list.hi,
here it is.
*& Report ZTEST_DS
REPORT ztest_ds.
TYPE-POOLS: slis.
TYPES: BEGIN OF ty_mara ,
matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
END OF ty_mara ,
BEGIN OF ty_makt ,
matnr TYPE makt-matnr,
maktx TYPE makt-maktx,
END OF ty_makt ,
BEGIN OF ty_final ,
mtart TYPE mara-mtart,
matnr TYPE mara-matnr,
maktx TYPE makt-maktx,
record TYPE i ,
END OF ty_final ,
BEGIN OF records,
records TYPE i,
END OF records.
DATA no TYPE i.
*************************INTERNAL TABLES******************************
DATA : it_mara TYPE TABLE OF ty_mara ,
it_makt TYPE TABLE OF ty_makt ,
it_final TYPE TABLE OF ty_final ,
it_fieldcat TYPE slis_t_fieldcat_alv,
it_events TYPE slis_t_event ,
it_fieldcat1 TYPE slis_t_fieldcat_alv,
it_records TYPE TABLE OF records WITH HEADER LINE.
*************************WORK AREAS***********************************
DATA : wa_mara TYPE ty_mara ,
wa_makt TYPE ty_makt ,
wa_final TYPE ty_final ,
wa_fieldcat TYPE slis_fieldcat_alv,
wa_layout TYPE slis_layout_alv ,
wa_events TYPE slis_alv_event ,
wa_fieldcat1 TYPE slis_fieldcat_alv,
wa_records TYPE records.
**************************VARIABLES***********************************
DATA : v_mtart TYPE mara-mtart, "#EC NEEDED
v_repid TYPE sy-repid ,
v_text TYPE string .
<b>DATA : BEGIN OF i_rec OCCURS 0,
mtart TYPE mara-mtart,
record TYPE i,
END OF i_rec.
DATA : BEGIN OF i_rec_col OCCURS 0,
mtart TYPE mara-mtart,
record TYPE i,
END OF i_rec_col.</b>
**************************CONSTANTS***********************************
CONSTANTS : c_zrh(4) TYPE c VALUE 'zrh' ,
c_x(1) TYPE c VALUE 'X' ,
c_02(2) TYPE c VALUE '02' ,
c_04(2) TYPE c VALUE '04' ,
c_06(2) TYPE c VALUE '06' ,
c_mtart(5) TYPE c VALUE 'MTART' ,
c_matnr(5) TYPE c VALUE 'MATNR' ,
c_maktx(5) TYPE c VALUE 'MAKTX' ,
c_it_final(8) TYPE c VALUE 'IT_FINAL' ,
c_mara(4) TYPE c VALUE 'MARA' ,
c_makt(4) TYPE c VALUE 'MAKT' ,
c_l(1) TYPE c VALUE 'L' ,
c_user_command(12) TYPE c VALUE 'USER_COMMAND' ,
c_alv_user_command(16) TYPE c VALUE 'ALV_USER_COMMAND',
c_top_of_page(11) TYPE c VALUE 'TOP_OF_PAGE' ,
c_alv_top_of_page(15) TYPE c VALUE 'ALV_TOP_OF_PAGE' ,
c_end_of_list(11) TYPE c VALUE 'END_OF_LIST' ,
c_alv_end_of_list(15) TYPE c VALUE 'ALV_END_OF_LIST' .
************************INITIALIZATION********************************
INITIALIZATION.
Initialize MTART at the selection screen
PERFORM initialize_mtart.
*********************SELECTION SCREEN*********************************
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
DATA p_mtart TYPE mara-mtart.
SELECT-OPTIONS: imtart FOR p_mtart.
SELECTION-SCREEN END OF BLOCK blk1.
*********************AT SELECTION SCREEN******************************
AT SELECTION-SCREEN.
Validate MTART entered at the selection screen.
PERFORM validate_mtart.
**********************START-OF-SELECTION******************************
START-OF-SELECTION.
Select all the required data
PERFORM select_data.
Prepare final table
PERFORM populate_final_tab.
**********************END-OF-SELECTION********************************
END-OF-SELECTION.
Prepare ALV settings for display
PERFORM prepare_settings.
Display ALV Report
PERFORM display_report.
**********************SUBROUTINES*************************************
*& Form initialize_mtart
Subroutine to Initialize MTART at the selection screen.
FORM initialize_mtart .
p_mtart = c_zrh.
ENDFORM. " initialize_mtart
*& Form validate_mtart
This subroutine is to validate MTART entered at the
selection screen.
FORM validate_mtart .
SELECT SINGLE mtart
FROM t134
INTO v_mtart
WHERE mtart = p_mtart.
If not found display error message
IF sy-subrc <> 0.
MESSAGE e014 WITH text-002.
ENDIF.
ENDFORM. " validate_mtart
*& Form select_data
This subroutine selects all the required data
FORM select_data .
SELECT matnr
mtart
FROM mara
INTO TABLE it_mara
WHERE mtart IN imtart.
IF sy-subrc <> 0.
MESSAGE i014 WITH text-003.
LEAVE LIST-PROCESSING.
ELSE.
SORT it_mara BY matnr.
SELECT matnr
maktx
FROM makt
INTO TABLE it_makt UP TO 20 ROWS
FOR ALL ENTRIES IN it_mara
WHERE matnr = it_mara-matnr
AND spras = sy-langu .
IF sy-subrc <> 0.
MESSAGE i014 WITH text-004.
LEAVE LIST-PROCESSING.
ELSE.
SORT it_mara BY mtart.
SORT it_makt BY matnr.
ENDIF.
ENDIF.
ENDFORM. " select_data
*& Form populate_final_tab
This subroutine prepares final internal table.
FORM populate_final_tab .
LOOP AT it_mara INTO wa_mara.
CLEAR wa_final.
CLEAR wa_makt.
READ TABLE it_makt INTO wa_makt
WITH KEY matnr = wa_mara-matnr
BINARY SEARCH.
IF sy-subrc = 0.
wa_final-mtart = wa_mara-mtart.
wa_final-matnr = wa_mara-matnr.
wa_final-maktx = wa_makt-maktx.
APPEND wa_final TO it_final.
ENDIF.
ENDLOOP.
LOOP AT it_final INTO wa_final.
no = no + 1.
ENDLOOP.
wa_records-records = no.
it_records-records = no.
APPEND it_records.
<b> LOOP AT it_final INTO wa_final.
i_rec-mtart = wa_final-mtart.
i_rec-record = 1.
APPEND i_rec.
ENDLOOP.
LOOP AT i_rec.
MOVE-CORRESPONDING i_rec TO i_rec_col.
COLLECT i_rec_col.
ENDLOOP.</b>
ENDFORM. " populate_final_tab
*& Form prepare_settings
This subroutine prepares ALV settings for display
FORM prepare_settings .
Prepare layout
CLEAR wa_layout.
wa_layout-zebra = c_x.
Prepare fieldcat
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = c_02.
wa_fieldcat-fieldname = c_mtart.
wa_fieldcat-tabname = c_it_final.
wa_fieldcat-ref_fieldname = c_mtart.
wa_fieldcat-ref_tabname = c_mara.
wa_fieldcat-ddictxt = c_l.
wa_fieldcat-seltext_l = text-005.
wa_fieldcat-seltext_m = text-005.
wa_fieldcat-seltext_s = text-005.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = c_04.
wa_fieldcat-fieldname = c_matnr.
wa_fieldcat-tabname = c_it_final.
wa_fieldcat-ref_fieldname = c_matnr.
wa_fieldcat-ref_tabname = c_mara.
wa_fieldcat-ddictxt = c_l.
wa_fieldcat-seltext_l = text-006.
wa_fieldcat-seltext_m = text-006.
wa_fieldcat-seltext_s = text-006.
wa_fieldcat-hotspot = c_x.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = c_06.
wa_fieldcat-fieldname = c_maktx.
wa_fieldcat-tabname = c_it_final.
wa_fieldcat-ref_fieldname = c_maktx.
wa_fieldcat-ref_tabname = c_makt.
wa_fieldcat-ddictxt = c_l.
wa_fieldcat-seltext_l = text-007.
wa_fieldcat-seltext_m = text-007.
wa_fieldcat-seltext_s = text-007.
APPEND wa_fieldcat TO it_fieldcat.
<b>wa_fieldcat1-col_pos = c_04.
wa_fieldcat1-fieldname = 'MTART'.
wa_fieldcat1-tabname = 'I_REC_COL'.
wa_fieldcat1-seltext_m = 'Material Type'.
APPEND wa_fieldcat1 TO it_fieldcat1.
records field cat
wa_fieldcat1-col_pos = c_04.
wa_fieldcat1-fieldname = 'RECORD'.
wa_fieldcat1-tabname = 'I_REC_COL'.
wa_fieldcat1-seltext_m = 'NO OF RECORDS MATERIAL WISE TYPE LIST'.
APPEND wa_fieldcat1 TO it_fieldcat1.</b>*
Prepare Events table.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_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.
SORT it_events BY name.
CLEAR wa_events.
READ TABLE it_events INTO wa_events
WITH KEY name = c_user_command
BINARY SEARCH.
IF sy-subrc = 0.
wa_events-form = c_alv_user_command.
MODIFY it_events
FROM wa_events
INDEX sy-tabix
TRANSPORTING form.
ENDIF.
CLEAR wa_events.
READ TABLE it_events INTO wa_events
WITH KEY name = c_top_of_page
BINARY SEARCH.
IF sy-subrc = 0.
wa_events-form = c_alv_top_of_page.
MODIFY it_events
FROM wa_events
INDEX sy-tabix
TRANSPORTING form.
ENDIF.
CLEAR wa_events.
READ TABLE it_events INTO wa_events
WITH KEY name = c_end_of_list
BINARY SEARCH.
IF sy-subrc = 0.
wa_events-form = c_alv_end_of_list.
MODIFY it_events
FROM wa_events
INDEX sy-tabix
TRANSPORTING form.
ENDIF.
ENDFORM. " prepare_settings
*& Form display_report
This subroutine calls FM to display report
FORM display_report .
CLEAR v_repid.
v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = v_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
IT_EXCLUDING =
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = wa_layout
it_fieldcat = it_fieldcat
i_tabname = 'it_FINAL'
it_events = it_events
IT_SORT =
I_TEXT = ' '
TABLES
t_outtab = it_final
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = wa_layout
it_fieldcat = it_fieldcat1
i_tabname = 'TY_FINAL'
it_events = it_events
IT_SORT =
I_TEXT = ' '
TABLES
<b> t_outtab = i_rec_col</b>
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
IS_PRINT = it_final
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
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_report
*& Form alv_user_command
This subroutine handles user command
FORM alv_user_command USING v_cmd TYPE sy-ucomm
wa_selfield TYPE slis_selfield. "#EC * "#EC
CLEAR wa_final.
READ TABLE it_final INTO wa_final
INDEX wa_selfield-tabindex.
CLEAR v_text.
CONCATENATE text-008
wa_final-matnr
INTO v_text
SEPARATED BY space.
Display to user which material he/she has clicked
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
titel = text-009
textline1 = v_text
start_column = 25
start_row = 6.
ENDFORM. "alv_user_command.
*& Form alv_top_of_page
This subroutine writes top of page
FORM alv_top_of_page. "#EC CALLED
FORMAT COLOR COL_HEADING.
ULINE AT /1(80).
WRITE:/1 sy-vline,
2 text-010,
9 sy-datum,
80 sy-vline.
WRITE:/1 sy-vline,
2 text-011,
9 sy-uzeit,
40 text-012,
80 sy-vline.
WRITE:/1 sy-vline,
2 text-013,
9 sy-uname,
80 sy-vline.
ULINE AT /1(80).
FORMAT COLOR OFF.
ENDFORM. "alv_top_of_page.
it will solve ur problem.
reward if useful. -
ALV ...Logic required
Hi every body,
I have one requirement like an alv report will display
output which contains a material number.
<b>If i click On the material number it shud go to MM03...Accounting view
Logic required for this.</b>I am a beginner ...Plz help me...
Thanks in advance.
Message was edited by: raja gurralaHi,
See the code sample,
INCLUDE <icon>.
* Predefine a local class for event handling to allow the
* declaration of a reference variable before the class is defined.
CLASS lcl_event_receiver DEFINITION DEFERRED.
DATA : o_alvgrid TYPE REF TO cl_gui_alv_grid ,
o_dockingcontainer TYPE REF TO cl_gui_docking_container ,
o_eventreceiver TYPE REF TO lcl_event_receiver,
wa_layout TYPE lvc_s_layo ,
wa_variant TYPE disvariant.
CONSTANTS : c_a(1) TYPE c VALUE 'A' , " All Layouts
c_x(1) TYPE c VALUE 'X'.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
* Hot Spot Click
handle_hotspot
FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING e_row_id
e_column_id
es_row_no,
* Double Click
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row
e_column
es_row_no,
ENDCLASS. "lcl_event_receiver DEFINITION
* Implementation
CLASS lcl_event_receiver IMPLEMENTATION.
*& Method handle_hotspot
* This method is called when the user clicks on a hotspot to drill down.
* The following types are exported from the ALV
* LVC_S_ROW
* LVC_S_COL
* LVC_S_ROID
METHOD handle_hotspot.
* The hotspot processing coded in the form below.
PERFORM f9900_handle_hotspot USING e_row_id
e_column_id
es_row_no.
ENDMETHOD. "handle_hotspot
*& Method handle_double_click
METHOD handle_double_click.
* The double click processing should be coded in the form below.
PERFORM f9901_handle_double_click USING e_row
e_column
es_row_no.
ENDMETHOD. "HANDLE_DOUBLE_CLICK
FORM f9900_handle_hotspot USING p_row_id
p_column_id
p_row_no.
*Read internal table for proper value.
READ TABLE i_output
INDEX p_row_id
INTO wa_output.
* Call the transaction MMBE
SET PARAMETER ID 'MAT' FIELD wa_output-matnr.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN .
ENDFORM. " f9900_handle_hotspot
*& Form f9901_handle_double_click
* Double Click
FORM f9901_handle_double_click USING p_row
p_column
p_row_no.
READ TABLE i_output INDEX p_row INTO wa_output.
CASE p_column.
WHEN 'MATNR'.
IF NOT wa_output-matnr IS INITIAL.
SET PARAMETER ID 'MAT' FIELD wa_output-matnr.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN .
ENDIF.
ENDCASE.
ENDFORM. " f9901_handle_double_click
U can use either hot spot or double click event.
If u r using hotspot set the hotspot = 'X' in fieldcatalog.
Hope this helps.
OR another method without oops concept
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
data:lv_matnr LIKE v_mmim_lc-matnr, "Material
read table i_output into w_output index rs_selfield-tabindex.
lv_matnr = w_output-matnr.
SET PARAMETER ID 'MAT' FIELD lv_matnr.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN .
Clear: lv_matnr.
ENDFORM.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE = ' '
i_callback_program = v_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
<b> i_callback_user_command = 'USER_COMMAND'</b>
i_background_id = 'ALV_BACKGROUND'
IS_LAYOUT = I_LAYOUT
it_fieldcat = i_fieldcat "field catalog
I_SAVE = 'A'
IS_VARIANT = G_VARIANT
TABLES
t_outtab = i_output "output table
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.
Kindly reward points if this helps u, revert back with queries.
Message was edited by: Judith Jessie Selvi -
Update the data into the ZTABLE fields thru program logic ..?
hi all,
i have ZTABLE1,ZTABLE2,ZTABLE3, and this tables like ALV grids using object methods.
in the same table fields now i wanted to update the data into the ZTABLE fields thru program logic .
could anyone please help me ....
please provide if anyone of have any program logic that would be helpfull to me.
thanks in advance...
srinivas....Hi Srinivas,
The following statements are used to upload the data into custom tables.
1. Modify
2. Update
3. Insert
if you are using OO ALV, you should enable the 'SAVE' button in the main toolbar. if the user press the save button, then you should upload the data to the custom table.
please find the example code, in this example 'PERFORM F_SAVE_DATA'(here i gave the message only, you write your own logic here) is used to save the data in custom table.
Report Program: ZB_ALVOOPS_TEST
Line:-----
REPORT ZB_ALVOOPS_TEST MESSAGE-ID ZCR_MESSAGES.
Top Include - Global Data Declaration *
INCLUDE ZB_ALVOOPS_TEST_TOP.
SEL Include - Selection Screen *
INCLUDE ZB_ALVOOPS_TEST_SEL.
AT SELECTION SCREEN *
Initialization Event *
INITIALIZATION.
Initialize Screen Number.
PERFORM F_INITIALIZE.
Initialize Field Catalog for ALV Grid.
PERFORM F_INITIALIZE_GRID.
END-OF-SELECTION.
Call Display Screen *
CALL SCREEN 9000.
Event Handler - Class Definition and Implementation *
INCLUDE ZB_ALVOOPS_TEST_CL01.
PBO Event - Module Implementation *
INCLUDE ZB_ALVOOPS_TEST_PBO.
PAI Event - Module Implementation *
INCLUDE ZB_ALVOOPS_TEST_PAI.
Subroutine Include *
INCLUDE ZB_ALVOOPS_TEST_F01.
Include: ZB_ALVOOPS_TEST_TOP
Line:-------
Type Declaration For Internal Tables *
Collection Data
TYPES: BEGIN OF TY_MARA ,
MATNR TYPE MATNR , " Material
VPSTA TYPE VPSTA , " Maintenance status of complete material
MTART TYPE MTART , " Material Type
MBRSH TYPE MBRSH , " Industry Sector
MATKL TYPE MATKL , " Material Group
BISMT TYPE BISMT , " Old material number
MEINS TYPE MEINS , " Base Unit of Measure
BSTME TYPE BSTME , " Order unit
BRGEW TYPE BRGEW , " Gross weight
MAKTX TYPE MAKTX , " Material Description
ROWCOLOR TYPE CHAR4 , " Row Color
END OF TY_MARA .
Flag *
DATA: FG_REFRESH TYPE XFLD , " Used to Refresh ALV
FG_SAVE TYPE XFLD . " Data Saved Or Not.
Internal Table Declaration *
DATA: IT_MARA TYPE STANDARD TABLE OF TY_MARA , " Internal table for Material
WA_MARA TYPE TY_MARA . " Workarea for Material
Variable Declaration For General Constants *
CONSTANTS: C_SCREEN_SELECT TYPE SYDYNNR VALUE '9001' , " Selection Screen Number
C_SCREEN_SELECT_NIL TYPE SYDYNNR VALUE '9002' , " Empty Screen Number
C_STATUS9000 TYPE CHAR10 VALUE 'STATUS9000' , " PF-Status
C_TITLEBAR TYPE CHAR4 VALUE '9000' , " Title Bar
C_ISSUE_CONTAINER TYPE SCRFNAME VALUE 'WORKCONTAINER', " Container Name (Screen Painter)
C_BUTTON_TYPE TYPE CHAR1 VALUE '3' , " Button Type
C_EXECUTE TYPE CHAR4 VALUE 'SELE' , " Functions 'SELE' -> Execute
C_BACK TYPE CHAR4 VALUE 'BACK' , " Functions 'BACK' -> Back to main screen
C_ENTER TYPE CHAR5 VALUE 'ENTER' , " Functions 'ENTER' -> No Action
C_SEL01 TYPE CHAR5 VALUE 'SEL01' , " Functions 'SEL01' -> Toggle Function
C_SAVE TYPE CHAR4 VALUE 'SAVE' , " Functions 'SAVE' -> Save Function
C_REFRESH TYPE CHAR7 VALUE 'REFRESH' , " Functions 'REFRESH' -> Clear and Fres All objects
C_ADD_MI TYPE CHAR6 VALUE 'ADD_MI' , " Functions 'ADD_MI' -> Add New Media Issue
C_TRUE TYPE CHAR1 VALUE 'X' , " Set X value
C_REQUIRED TYPE CHAR1 VALUE '1' , " Un-Confirmed Qty field obligatory or not.
C_INPUT TYPE CHAR1 VALUE '0' , " Reason field should not be input.
C_ALV_SAVE TYPE CHAR1 VALUE 'A' , " ALV
C_ERROR TYPE CHAR1 VALUE 'E' , " Error Type
C_SIGN TYPE CHAR1 VALUE 'I' , " Sign
C_OPTION TYPE CHAR2 VALUE 'EQ' , " Option.
C_COMMIT_WAIT TYPE CHAR1 VALUE '5' , " Waiting to update in DB
C_TABNAME TYPE CHAR1 VALUE '1' , " Parameter (ALV)
C_CANCEL TYPE CHAR1 VALUE 'N' , " Cancel
C_YES TYPE CHAR1 VALUE 'J' . " Yes.
Variable Declaration For Container and ALV Grid *
DATA: OBJ_CUST_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER , " Container Class
OBJ_CUST_GRID TYPE REF TO CL_GUI_ALV_GRID . " ALV Grid Class
Field Catalog Declaration For Container and ALV Grid *
DATA: IT_FIELDCAT TYPE LVC_T_FCAT , " Field Catalog
IT_EXCLUDE TYPE UI_FUNCTIONS , " Standard Function Exclude from ALV
WA_FIELDCAT TYPE LVC_S_FCAT , " For Field Catalog
WA_LAYOUT TYPE LVC_S_LAYO . " ALV Layout
Global Variable Declaration *
DATA: OK_CODE TYPE SY-UCOMM , " OK CODE ( Screen Attribute Don't Change the var.name)
G_SAVE_CODE TYPE SY-UCOMM , " OK CODE
G_ANSWER TYPE CHAR1 , " OK or Cancel.
G_SELECTION_DYNNR TYPE SYDYNNR , " Screen Number
G_ERROR_TEXT TYPE CHAR128 , " Error Text
G_SELECTION_TOGGLE_TEXT TYPE CHAR50 , " Toggle Text, Value: Hide Selection, Show Selection
G_MATNR TYPE MATNR , " Material
G_SMATNR TYPE MATNR , " Material
G_SMTART TYPE MTART . " Material Type
Include: ZB_ALVOOPS_TEST_SEL
Line:-------
Selection Screen
SELECTION-SCREEN BEGIN OF SCREEN 9001 AS SUBSCREEN .
SELECTION-SCREEN BEGIN OF BLOCK SELECTION WITH FRAME TITLE TEXT-001 .
SELECT-OPTIONS: S_MATNR FOR G_SMATNR , " Material
S_MTART FOR G_SMTART . " Material Type
SELECTION-SCREEN END OF BLOCK SELECTION .
SELECTION-SCREEN END OF SCREEN 9001 .
Empty Selection
SELECTION-SCREEN BEGIN OF SCREEN 9002 AS SUBSCREEN .
SELECTION-SCREEN BEGIN OF BLOCK SELECTION_NIL WITH FRAME TITLE TEXT-002 .
Nil
SELECTION-SCREEN END OF BLOCK SELECTION_NIL .
SELECTION-SCREEN END OF SCREEN 9002 .
Include: ZB_ALVOOPS_TEST_CL01
Line:-------
CLASS lcl_event_handler DEFINITION *
Event Handler Class Definition *
CLASS LCL_EVENT_HANDLER DEFINITION.
PUBLIC SECTION.
METHODS:
HANDLER_TOOLBAR FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT E_INTERACTIVE ,
HANDLER_USER_COMMAND FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
IMPORTING E_UCOMM .
ENDCLASS. "lcl_event_handler DEFINITION
CLASS lcl_event_handler IMPLEMENTATION *
Event Class Implementation. *
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
Toolbar -----Create 'Add Issue' button
METHOD HANDLER_TOOLBAR.
DATA: L_WA_TOOLBAR TYPE STB_BUTTON. " Toolbar
CLEAR: L_WA_TOOLBAR.
Button Type
L_WA_TOOLBAR-BUTN_TYPE = C_BUTTON_TYPE . " 3.
APPEND L_WA_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
Add Issue Button.
CLEAR: L_WA_TOOLBAR.
L_WA_TOOLBAR-FUNCTION = 'ADD_MI' . " 'ADD_MI' .
L_WA_TOOLBAR-ICON = 'ICON_CREATE'.
L_WA_TOOLBAR-QUICKINFO = 'CREATE' . " 'Add Issue'.
L_WA_TOOLBAR-TEXT = 'CREATE' . " 'Add Issue'.
L_WA_TOOLBAR-DISABLED = ''.
APPEND L_WA_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
CLEAR: L_WA_TOOLBAR.
ENDMETHOD. "handler_toolbar
User Actions Events-- Handle 'Add Issue' Button Click.
METHOD HANDLER_USER_COMMAND.
CASE E_UCOMM.
Add Issue Button.
WHEN C_ADD_MI.
IF NOT G_MATNR IS INITIAL.
FG_REFRESH = C_TRUE.
PERFORM F_ADD_MEDIAISSUE.
ENDIF.
ENDCASE.
Refresh Control
CALL METHOD CL_GUI_CFW=>FLUSH
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2
OTHERS = 3.
Handle Exceptions
IF SY-SUBRC <> 0.
CASE SY-SUBRC.
WHEN 1.
G_ERROR_TEXT = TEXT-026. " 'Control System Error'.
WHEN 2.
G_ERROR_TEXT = TEXT-027. " 'Control CL_GUI_CFW Has Raised Error'.
ENDCASE.
MESSAGE G_ERROR_TEXT TYPE 'E'.
ENDIF.
Refresh Alv Grid.
PERFORM F_REFRESH_GRID.
ENDMETHOD. "handler_user_command
ENDCLASS. "lcl_event_handler IMPLEMENTATION
Object Ref. Event Class.
DATA: OBJ_EVENT_HANDLER TYPE REF TO LCL_EVENT_HANDLER.
Include: ZB_ALVOOPS_TEST_PBO
Line:----
Module STATUS_9000 OUTPUT *
Set PF-Status *
MODULE STATUS_9000 OUTPUT.
PF Status
SET PF-STATUS C_STATUS9000 .
SET TITLEBAR C_TITLEBAR .
ENDMODULE. " STATUS_9000 OUTPUT
Module Create_Alvgrid OUTPUT *
Create Or Refresh ALV Grid *
MODULE CREATE_ALVGRID OUTPUT.
PERFORM F_PROCESS_ALV .
PERFORM F_REFRESH_GRID.
ENDMODULE. " create_alvgrid OUTPUT
Include: ZB_ALVOOPS_TEST_PAI
Line:----
Module exit_command INPUT *
Exit Command ( Cancel and Exit ) *
MODULE EXIT_COMMAND INPUT.
LEAVE PROGRAM.
ENDMODULE. " exit_command INPUT
Module user_command_9000 INPUT *
User Command - Process toolbar Events *
MODULE USER_COMMAND_9000 INPUT.
Take an Action based on user Input
G_SAVE_CODE = OK_CODE.
CLEAR OK_CODE.
CASE G_SAVE_CODE.
Back
WHEN C_BACK .
Raise the Confirmation Message When User not saved the data.
IF FG_SAVE = C_YES.
PERFORM F_EXITCHECK CHANGING G_ANSWER .
IF G_ANSWER = C_YES.
PERFORM F_SAVE_DATA.
ELSE.
CLEAR G_SAVE_CODE.
ENDIF.
CLEAR: FG_SAVE.
ENDIF.
LEAVE PROGRAM.
Enter
WHEN C_ENTER.
Execute ( F8 )
WHEN C_EXECUTE .
IF IT_MARA IS INITIAL.
PERFORM F_SELECTMATERIAL.
ENDIF.
Toggle Button
WHEN C_SEL01.
PERFORM F_TOGGLE_SELECTION_SCREEN. " USING ok_code.
SAVE ( CTRL+S )
WHEN C_SAVE.
IF NOT G_MATNR IS INITIAL.
PERFORM F_SAVE_DATA.
CLEAR: G_MATNR.
ENDIF.
New Entry ( CTRL+F1 )
WHEN C_REFRESH.
PERFORM F_REFRESH_DATA.
ENDCASE.
ENDMODULE. " user_command_9000 INPUT
Include: ZB_ALVOOPS_TEST_F01
Line:----
Form f_toggle_selection_screen *
Toggle Function - Hide Selection / Show Selection *
FORM F_TOGGLE_SELECTION_SCREEN.
Toggle Function
IF G_SELECTION_DYNNR = C_SCREEN_SELECT.
G_SELECTION_DYNNR = C_SCREEN_SELECT_NIL.
G_SELECTION_TOGGLE_TEXT = TEXT-902.
ELSE.
G_SELECTION_DYNNR = C_SCREEN_SELECT.
G_SELECTION_TOGGLE_TEXT = TEXT-901.
ENDIF.
ENDFORM. " f_toggle_selection_screen
Form f_initialize
Initialize Screen Number and Text
FORM F_INITIALIZE .
Initialize Screen Number
G_SELECTION_DYNNR = C_SCREEN_SELECT.
G_SELECTION_TOGGLE_TEXT = TEXT-901.
ENDFORM. "f_initialize
Form f_selectmaterial *
FORM F_SELECTMATERIAL .
Select the data from Mara Table
SELECT A~MATNR
A~VPSTA
A~MTART
A~MBRSH
A~MATKL
A~BISMT
A~MEINS
A~BSTME
A~BRGEW
B~MAKTX
INTO TABLE IT_MARA
FROM MARA AS A INNER JOIN MAKT AS B ON AMATNR = BMATNR
WHERE A~MATNR IN S_MATNR
AND A~MTART IN S_MTART
AND B~SPRAS = 'EN'.
IF SY-SUBRC = 0.
FG_REFRESH = C_TRUE.
FG_SAVE = C_YES .
G_MATNR = C_TRUE.
LOOP AT IT_MARA INTO WA_MARA WHERE BRGEW >= 200.
WA_MARA-ROWCOLOR = 'C310'.
MODIFY IT_MARA FROM WA_MARA.
ENDLOOP.
ELSE.
MESSAGE 'No data Found' TYPE 'E'.
ENDIF.
ENDFORM. " f_selectmaterial
Form f_initialize_grid *
Initialize Field Catalog. *
FORM F_INITIALIZE_GRID .
field catalog
PERFORM F_ATTRFCAT USING :
'MATNR' '1' '0' TEXT-005 '15' '0' 'X' ' ' ' ',
'VPSTA' '1' '1' TEXT-006 '15' '0' 'X' ' ' ' ',
'MTART' '1' '2' TEXT-007 '15' '0' ' ' ' ' ' ',
'MBRSH' '1' '3' TEXT-008 '15' '0' ' ' ' ' ' ',
'MATKL' '1' '4' TEXT-009 '15' '0' ' ' 'X' ' ',
'BISMT' '1' '5' TEXT-010 '15' '0' ' ' ' ' ' ',
'MEINS' '1' '6' TEXT-011 '15' '0' ' ' ' ' ' ',
'BSTME' '1' '7' TEXT-012 '15' '0' ' ' ' ' ' ',
'MAKTX' '1' '8' TEXT-013 '15' '0' ' ' ' ' 'C711',
'BRGEW' '1' '9' TEXT-014 '15' '0' ' ' ' ' ' '.
Set Editable Fields in ALV.
PERFORM F_SETEDIT_FIELDS CHANGING IT_FIELDCAT.
ENDFORM. "f_initialize_grid
Form f_setedit_fields *
Set Editable Fields in ALV *
C_IT_FIELDCAT <-- Field Catalog *
FORM F_SETEDIT_FIELDS CHANGING C_IT_FIELDCAT TYPE LVC_T_FCAT.
Local Variable Declaration.
DATA: LS_FIELDCAT LIKE LINE OF C_IT_FIELDCAT. " Field Catalog
Create Editable Fields.
LOOP AT C_IT_FIELDCAT INTO LS_FIELDCAT.
CASE LS_FIELDCAT-FIELDNAME.
WHEN 'BRGEW'.
LS_FIELDCAT-EDIT = C_TRUE.
WHEN 'MAKTX'.
LS_FIELDCAT-EDIT = C_TRUE.
ENDCASE.
MODIFY C_IT_FIELDCAT FROM LS_FIELDCAT.
ENDLOOP.
ENDFORM. " f_setedit_fields
Form f_attrfcat *
Update Field Catalog Internal Table *
U_FIELDNAME --> Field Name *
U_ROW_POS --> Row Position *
U_COL_POS --> Column Position *
U_SELTEXT_L --> Display Column Heading *
U_OUTPUTLEN --> Heading Output Length *
U_DECIMALS_OUT --> Number of decimal places in output *
U_KEY --> Key in ALV Display *
U_FIX --> Existence of fixed values *
FORM F_ATTRFCAT USING
U_FIELDNAME TYPE SLIS_FIELDNAME
U_ROW_POS TYPE SYCUROW
U_COL_POS TYPE SYCUCOL
U_SELTEXT_L TYPE SCRTEXT_L
U_OUTPUTLEN TYPE OUTPUTLEN
U_DECIMALS_OUT TYPE CHAR1
U_KEY TYPE CHAR1
U_FIX TYPE VALEXI
U_COL_COLOR TYPE LVC_EMPHSZ.
Update field catalog.
WA_FIELDCAT-FIELDNAME = U_FIELDNAME.
WA_FIELDCAT-ROW_POS = U_ROW_POS.
WA_FIELDCAT-COL_POS = U_COL_POS.
WA_FIELDCAT-COLTEXT = U_SELTEXT_L.
WA_FIELDCAT-SELTEXT = U_SELTEXT_L.
WA_FIELDCAT-OUTPUTLEN = U_OUTPUTLEN.
WA_FIELDCAT-DECIMALS_O = U_DECIMALS_OUT.
WA_FIELDCAT-KEY = U_KEY.
WA_FIELDCAT-VALEXI = U_FIX.
WA_FIELDCAT-EMPHASIZE = U_COL_COLOR.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. "ATTR_FCAT
Form f_refresh_data *
Clear All the objects used in the program ( Data Related ) *
FORM F_REFRESH_DATA .
Clear All the Objects Used in Our Program.
CLEAR: S_MATNR ,
S_MTART ,
IT_MARA ,
OK_CODE ,
FG_REFRESH ,
FG_SAVE ,
G_SAVE_CODE ,
G_MATNR .
FREE: S_MATNR ,
S_MTART ,
IT_MARA ,
OK_CODE ,
FG_REFRESH ,
FG_SAVE ,
G_SAVE_CODE ,
G_MATNR .
Refresh Alv.
FG_REFRESH = C_TRUE.
ENDFORM. " f_refresh_data
Form f_process_alv *
1. Create Custom Container *
2. Create ALV Grid *
3. Exclude Standard Functions *
4. Display the ALV *
5. Register the Events. *
FORM F_PROCESS_ALV .
Display ALV
Custom Container
IF OBJ_CUST_CONTAINER IS INITIAL.
CREATE OBJECT OBJ_CUST_CONTAINER
EXPORTING
CONTAINER_NAME = C_ISSUE_CONTAINER.
ALV Grid
IF OBJ_CUST_GRID IS INITIAL.
CREATE OBJECT OBJ_CUST_GRID
EXPORTING
I_PARENT = OBJ_CUST_CONTAINER.
ENDIF.
Exclude Standard Functions
PERFORM F_EXCLUDETOOLBAR USING OBJ_CUST_GRID
CHANGING IT_EXCLUDE.
Layout.
WA_LAYOUT-CWIDTH_OPT = C_TRUE.
WA_LAYOUT-INFO_FNAME = 'ROWCOLOR'.
ALV Grid Display
CALL METHOD OBJ_CUST_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = WA_LAYOUT
IT_TOOLBAR_EXCLUDING = IT_EXCLUDE
I_SAVE = C_ALV_SAVE
CHANGING
IT_FIELDCATALOG = IT_FIELDCAT[]
IT_OUTTAB = IT_MARA.
ENDIF.
Register Editable ALV Events
CALL METHOD OBJ_CUST_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED
EXCEPTIONS
ERROR = 1
OTHERS = 2.
*Create Object for Custom Event Handler Class if the ref. object is
*initial.
IF OBJ_EVENT_HANDLER IS INITIAL.
CREATE OBJECT OBJ_EVENT_HANDLER.
ENDIF.
Register Events
SET HANDLER: OBJ_EVENT_HANDLER->HANDLER_TOOLBAR FOR
OBJ_CUST_GRID,
OBJ_EVENT_HANDLER->HANDLER_USER_COMMAND FOR
OBJ_CUST_GRID.
Set Toolbar
CALL METHOD OBJ_CUST_GRID->SET_TOOLBAR_INTERACTIVE.
ENDFORM. " f_process_alv
Form f_excludetoolbar *
Exclude Standard Functions from ALV *
U_OBJ_CUST_GRID --> Instant for CL_GUI_ALV_GRID *
C_IT_EXCLUDE <-- Internal table for Exclude *
FORM F_EXCLUDETOOLBAR USING U_OBJ_CUST_GRID TYPE REF TO CL_GUI_ALV_GRID
CHANGING C_IT_EXCLUDE TYPE UI_FUNCTIONS.
Exclude Standard Functions
CLEAR: C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_CHECK TO C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_REFRESH TO C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_LOC_COPY TO C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_LOC_COPY_ROW TO C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_LOC_CUT TO C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_LOC_DELETE_ROW TO C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_LOC_APPEND_ROW TO C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_LOC_INSERT_ROW TO C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_LOC_MOVE_ROW TO C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_LOC_PASTE TO C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_LOC_PASTE_NEW_ROW TO C_IT_EXCLUDE.
APPEND U_OBJ_CUST_GRID->MC_FC_LOC_UNDO TO C_IT_EXCLUDE.
ENDFORM. " f_excludetoolbar
Form f_create_returnrequest *
Create Return Request based on the Work container ( ALV Grid Data) *
FORM F_CREATE_RETURNREQUEST.
Message to save
ENDFORM. " f_create_returnrequest
Form f_add_mediaissue *
Create New Media Issue if the user click 'ADD ISSUE' Button. *
1. Get the Input From User *
2. Get Total Delivery and Return Quantity *
3. Append to Final internal table *
FORM F_ADD_MEDIAISSUE .
Local Variable Declaration.
MESSAGE 'Add Button Clicked' TYPE 'I'.
ENDFORM. " f_add_mediaissue
Form f_refresh_grid *
Refresh ALV Grid *
FORM F_REFRESH_GRID .
Refresh ALV Grid.
IF FG_REFRESH IS NOT INITIAL.
CALL METHOD OBJ_CUST_GRID->REFRESH_TABLE_DISPLAY.
CLEAR: FG_REFRESH.
ENDIF.
ENDFORM. " f_refresh_grid
Form f_getcollectissue *
FORM F_GETCOLLECTISSUE .
Collection Plan Data
ENDFORM. " f_getcollectissue
Form f_perpare_final *
FORM F_PERPARE_FINAL .
Perpare Final Internal table
ENDFORM. " f_perpare_final
Form f_validate_data *
FORM F_VALIDATE_DATA.
Message if any data validation.
ENDFORM. " f_validate_data
Form f_modify_final *
Update Actual Delivery Qty and Return Qty in Final Internal table *
Form f_save_data *
Save the Data When User Click 'Save' Button *
FORM F_SAVE_DATA .
Message
MESSAGE 'Save Button Clicked' TYPE 'I'.
ENDFORM. "f_save_data
Form f_exitcheck *
When User Exit from the Transaction then Raise Confirmation message*
C_ANSWER <-- OK or Cancel. *
FORM F_EXITCHECK CHANGING C_ANSWER TYPE CHAR1.
Security Check.
C_ANSWER = C_CANCEL.
CALL FUNCTION 'POPUP_TO_CONFIRM_DATA_LOSS'
EXPORTING
TITEL = TEXT-039
IMPORTING
ANSWER = C_ANSWER.
ENDFORM. "f_exitcheck
Screen Numer : 9000
Line:------
PROCESS BEFORE OUTPUT.
MODULE STATUS_9000.
CALL SUBSCREEN: SELECTIONSCREEN INCLUDING SY-CPROG G_SELECTION_DYNNR.
MODULE CREATE_ALVGRID.
PROCESS AFTER INPUT.
MODULE EXIT_COMMAND AT EXIT-COMMAND.
CALL SUBSCREEN: SELECTIONSCREEN.
MODULE USER_COMMAND_9000.
pls reward if it is useful -
<b>HELLO FRIENDS.</b>
When enduser enters the employee_Number in the screen field and presses <b>"ENTER"</b> then the employee_Name and employee_Dept should be displayed in a non-editable form.
And I met the requirement execpt the logic to be use when the enduser presses the <b>"ENTER"</b> key and in which system field the <b>"ENTER"</b> key is stored. <b>PLEASE HELP</b>.
Regards
Sara.Hi
See the section FUNCTION KEYS of yuor status here assign an OK-CODE to the first field (just before of the SAVE icon).
In this way u'll assign an Ok-CODE to ENTER key.
PROCESS PAI.
MODULE USER_COMMAND.
MODULE USER_COMMAND.
SAVE_OK_CODE = OK_CODE.
CLEAR OK_CODE.
CASE SAVE_OK_CODE.
WHEN SPACE.
> The user has pressed ENTER
WHEN ......
ENDMODULE.
Of course if you have assigned an ok-code:
MODULE USER_COMMAND.
SAVE_OK_CODE = OK_CODE.
CLEAR OK_CODE.
CASE SAVE_OK_CODE.
WHEN <MY CODE>.
> The user has pressed ENTER
WHEN ......
ENDMODULE.
Max -
Logical GR in Third Party Process
Hi Friends
There is logical GR involved in third party process. What if we do not want to trigger it?very useful thraed for your Qn-
[stock not updating after doing MIGO (gr) for third party sales |stock not updating after doing MIGO (gr) for third party sales;
BR
Raj -
Hi
I call in loop logical database by FM LDB_PROCESS in different parameters but only first step is return ok
next return error subrc = 1 LDB_NOT_REENTRANT
How to init this calling in second step?Hi
Firstly why you are calling the LDB using FM instead mentioned that in Program attributes and call that using GET statement ?
Regards,
Sreeram -
Logical command in ABAP.....Urgent
Hi,
i am pretty new using ABAP program so i neeed help urgently. i am trying to move a file on the application server from one directory to the other and i was using the open dataset function to do that. but the file i am trying to move is pretty big and because i am using internal table to store, it is causing problems with the space.
i have consulted the basis guys and they have managed to create a logical file for copying from one directory to the other on the application server. to help you furthter. i am enclosing the mail sent to me.
I have created a logical command which should copy the file from one location to the other but you need to pass it the source dir and file name and the destination dir and file name.
The logical command is ZCOPY and uses cmd /c copy
Copies one or more files to another location.
COPY [/V] [/N] [/Y | /-Y] [/Z] [/A | /B ] source [/A | /B]
[+ source [/A | /B] [+ ...]] [destination [/A | /B]]
source Specifies the file or files to be copied.
/A Indicates an ASCII text file.
/B Indicates a binary file.
destination Specifies the directory and/or filename for the new file(s).
/V Verifies that new files are written correctly.
/N Uses short filename, if available, when copying a file with a
non-8dot3 name.
/Y Suppresses prompting to confirm you want to overwrite an
existing destination file.
/-Y Causes prompting to confirm you want to overwrite an
existing destination file.
/Z Copies networked files in restartable mode.
The switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line. Default is
to prompt on overwrites unless COPY command is being executed from
within a batch script.
the problem now is i have no idea about how to use the logical command. can any one help me.
Thank you,
Ravi.If memory is not an issue, then there should be no reason why this should not work.
report zrich_0001.
parameters: d1 type localfile default '/usr/sap/TST/SYS/Data1.txt',
d2 type localfile default '/usr/sap/TST/SYS/Data2.txt'.
data: itab type table of string with header line.
start-of-selection.
* Read old file
open dataset d1 for input in text mode.
if sy-subrc = 0.
do.
read dataset d1 into itab.
if sy-subrc <> 0.
exit.
endif.
append itab.
enddo.
endif.
close dataset d1.
* Write to new file
open dataset d2 for output in text mode.
loop at itab.
transfer itab to d2.
endloop.
close dataset d2.
* Delete the old file
delete dataset d1.
Regards,
Rich Heilman -
Hi,
What is the use of Logical Level under Content Tab in Logical Table Source?
Need more information, docs related to this
Thanks,
SatheeshHi
This logical level is useful for level bases metrics.It shows the levels in your hierarchy.We can give the level in this and in the report it shows the data for that level only.
See this lnk, http://gerardnico.com/wiki/dat/obiee/measure_level_based
Thanks
Don -
Logical Systems in Business Services
Hi
In Business Service creation, for Adapter Specific Identifiers, the parameter for the Logical System. It is only possible to assign one logical system to one Business Service ?.
i.e. to do
MyBusServ1, Z_LS_1
MyBusServ2, Z_LS_1
is not possible ?
When trying to assign Z_LS_1 to MyBusServ2 I get the error that Z_LS_1 is already assigned. Is there a way to circumvent ?, I do not want to create two logical systems in R/3 as the IDOCS types submitted by the Business Services are the same.
Thanks
DamienThanks for the replies
Sarvesh - The Business service is the sender of the information \ IDOC. If I remove the Adapter specific config then how will XI know what Logical system to apply to the IDOC ?.
Jaishankar - I am creating two IDOC's in SAP. MATMAS and PORDCR. The input file are coming from two different source systems. lets say sys1 and sys2. Both of thse for clarity are created in my scenario as Business Services. sys 1 creates MATMAS and PORDCR IDOC's int he syatem, sys2 creates PORDCR IDOC's in the system. As sys1 and sys2 are related in that they created the IDOC's as part od the same project then I would like to collect in the same partner profile in SAP e.g. Partner Profile ZPP_IDOC with IDOC types MATMAS PORDCR that serve as input for both systems. Logically I would assume that I can assing the logical system ZPP_IDOC to both the adapter specific parameter in both sys1 and sys2.
Thanks
Damien -
Logical Database in Abap Objects
Hi to All
I want do it a program report using a Logical Database.
Is this possible ??? But when I make a GET <node>, occurs the following error:
"" Statement "ENDMETHOD" missing. ""
I'm doing the following:
CLASS MONFIN IMPLEMENTATION.
METHOD TRAER_DATOS.
GET VBRK.
ENDMETHOD.
ENDCLASS.
Please, somebody tell me how I use the logical database in Abap Objects.
Thank you very much
Regards
Dario R.Hi there
Logical databases whilst of "some use" are not really part of OO.
If you want to use a logical database in an abap OO program I would create a special class which just does the get data from your DB and pass this either at record or table level.
Techniques such as GET XXXX LATE aren't really part of any OO type of application since at Object Instantiation time you should be able to access ALL the attributes of that object.
As far as OO is concerned Logical databases are a throwback to "Dinosaur Technology".
Since however modules such as SD and FI are still heavily reliant on relational structures (i.e linked tables etc) then there is still some limited life in this stuff but for OO try and solve it by another method.
If you really must use this stuff in OO then do it via a FMOD call and save the data in a table which your method will pass back to your application program.
You can't issue a GET command directly in a method.
Cheers
Jimbo -
Logical level in Fact tables - best practice
Hi all,
I am currently working on a complex OBIEE project/solution where I am going straight to the production tables, so the fact (and dimension) tables are pretty complex since I am using more sources in the logical tables to increase performance. Anyway, what I am many times struggling with is the Logical Levels (in Content tab) where the level of each dimension is to be set. In a star schema (one-to-many) this is pretty straight forward and easy to set up, but when the Business Model (and physical model) gets more complex I sometimes struggle with the aggregates - to get them work/appear with different dimensions. (Using the menu "More" - "Get levels" does not allways give the best solution......far from). I have some combinations of left- and right outer join as well, making it even more complicated for the BI server.
For instance - I have about 10-12 different dimensions - should all of them allways be connected to each fact table? Either on Detail or Total level. I can see the use of the logical levels when using aggregate fact tables (on quarter, month etc.), but is it better just to skip the logical level setup when no aggregate tables are used? Sometimes it seems like that is the easiest approach...
Does anyone have a best practice concerning this issue? I have googled for this but I haven't found anything good yet. Any ideas/articles are highly appreciated.Hi User,
For instance - I have about 10-12 different dimensions - should all of them always be connected to each fact table? Either on Detail or Total level.It not necessary to connect to all dimensions completely based on the report that you are creating ,but as a best practice we should maintain all at Detail level only,when you are mentioning any join conditions in physical layer
for example for the sales table if u want to report at ProductDimension.ProductnameLevel then u should use detail level else total level(at Product,employee level)
Get Levels. (Available only for fact tables) Changes aggregation content. If joins do not exist between fact table sources and dimension table sources (for example, if the same physical table is in both sources), the aggregation content determined by the administration tool will not include the aggregation content of this dimension.
Source admin guide(get level definition)
thanks,
Saichand.v -
Logical System in IDOC-XI scenario
Hi,
I need help to understand few things in IDOC-XI scenario, could any one help me in this regard.
we use Adapter specific identifiers to map services, we have following type of identifiers 1) Sys.ID & Client No. 2) Logical System.
my questions are
a) Are we use Logical System in B to B scenario ?
b) Are we use LS in reference to the SAP system or Non SAP system ? if a non SAP system....how a non SAP system send an IDOC and why a non SAP system receive an IDOC ( conversion is possible in XI ) ?
Thanks and Regards
Mahesh.Hay Kumar,
Logical systems can also be used for SAp sytems wich are not installed yet as a virtuall placeholder.
a) yes. if on of your business is a non sap system or a propritery system that you developed yuo'll ue LS.
b) non SAP system can send and recieve IDOCs. so it's possiable to get an IDOC from a system and turn it into an RFC for SAP or get an IDOC from an SAP system and then turn it into something else for another system.
Have a Good One,
Uri Lifshitz.
Maybe you are looking for
-
Disappointed with Apple's Lack of Response
As noted elsewhere here, and on ApertureExpert, there are issues with Nik's HDR Efex Pro 2 (and potentially some of their other plug-ins) causing graphics/image corruption with the finished image after being imported back into Aperture. Nik says that
-
Satelite T130 cannot restart (reboot)
I have Satelite T130-10G PST3AE bios v2.7 and it cannot restart. After restart the screen blanks the fan makes becames noisy for short time and that is all. To start it again it is necessary to switch it off and on. It starts normaly. Restarts were a
-
Output type for ORDCHG is not created in PO
Hi, We have a problem for the output type autogeneration when a PO is changed (ORDCHG). The scenario is the next: - We have a Z output type for the creation of the PO. It works fine (the outputy type is generted and the idoc sent) - We have another Z
-
How to integrate adobe flash widgets from Adobe captivate with Adobe Presenter?
Hi all, We are a group of students who are creating a number of flash widgets that allows them to create e-learning activities. We are creating specific widgets in Flash for use in Captivate and then the results of the widgets in Adobe Presenter. T
-
How to open LabVIEW 7.x to 2012?
How can I open the LabVIEW 7.X by LabVIEW 2012? I tried but it failed. Can I install both versions on the same machine? Solved! Go to Solution.