on 09-03-2007 1:42 PM
Dear all,
CAn anyone of you please tell me how can we found Field 'Sort String' using
transaction CN23.
Also, please tell me one thing my requirement is i have to add a new field in a report. In that New field i.e ( Purchase order no) which is developed in ALV if i double click i should display ME23 transaction.
please help me with the coding..
thanks and regards,
Neeraj Srivastava
hi,
Make ur first questoin bit clear,
For second go thru this report if u click the PO no it will go to me23n check it
----
Change History
----
REPORT ZMM_PO_TEXT
no standard page heading
line-size 300
message-id zmsg.
*************************************************************************
Tables *
**************************************************************************
TABLES : EKKO, "Purchasing Document Header
EKPO, "Purchasing Document Item
EKBE. "History per Purchasing Doc
************************************************************************
Internal table for display *
************************************************************************
DATA : begin of it_item occurs 0 ,
ebeln like ekpo-ebeln, "pur doc no
ebelp like ekpo-ebelp, "pur doc no item
matnr like ekpo-matnr, "material no
werks like ekpo-werks, "Plant
bedat like ekko-bedat, "pur doc date
banfn like eban-banfn, "Purchase requisition number
bnfpo like eban-bnfpo, "Item number of purchase requisition
charg like ekbe-charg , "Batch Number
end of it_item.
DATA it_temp like table of it_item with header line.
***********************************************************************
ALV VARIABLES AND INTERNAL TABLES
************************************************************************
TYPE-POOLS: slis.
DATA:st_layout TYPE slis_layout_alv,
it_fieldcat TYPE slis_t_fieldcat_alv,
it_listheader TYPE slis_t_listheader,
it_event TYPE slis_t_event,
keyinfo TYPE slis_keyinfo_alv.
DATA:ls_selfield TYPE slis_selfield.
*********************************************************************
VARIABLES *
********************************************************************
DATA:
v_repid LIKE sy-repid,
name like thead-tdname,
lines like tline occurs 0 with header line.
************************************************************************
*SELECTION SCREEN DEFINITIONS
************************************************************************
SELECTION-SCREEN: BEGIN OF BLOCK a1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS:
so_plant FOR ekpo-werks,
so_date FOR ekko-bedat OBLIGATORY,
so_matnr for ekpo-matnr,
so_ebeln for ekko-ebeln,
so_ekorg for ekko-ekorg,
so_ekgrp for ekko-ekgrp.
SELECTION-SCREEN: END OF BLOCK a1.
*******************************************************************
INITIALIZATION *
********************************************************************
INITIALIZATION.
v_repid = sy-repid.
************************************************************************
*START-OF-SELECTION
************************************************************************
START-OF-SELECTION.
PERFORM get_data.
IF it_item[] IS NOT INITIAL.
PERFORM display_data.
ELSE.
MESSAGE i012(zmsg).
ENDIF.
************************************************************************
END-OF-SELECTION *
************************************************************************
END-OF-SELECTION.
*******************************************************************
Form get data ******************
*******************************************************************
FORM get_data.
if so_date-high is initial.
so_date-high = sy-datum.
endif.
select aebeln aebelp amatnr awerks
b~bedat
c~charg
into corresponding fields of table it_item
from ekpo as a inner join ekko as b
on aebeln = bebeln
inner join eket as c on aebeln = cebeln and aebelp = cebelp
where a~werks in so_plant
and a~matnr in so_matnr
and a~ebeln in so_ebeln
and b~bedat between so_date-low and so_date-high
and b~ekorg in so_ekorg
and b~ekgrp in so_ekgrp .
DELETE ADJACENT DUPLICATES FROM it_item.
SORT it_item by ebeln bedat.
loop at it_ITEM.
select single banfn bnfpo into (it_ITEM-banfn,it_ITEM-bnfpo) from eban where ebeln = it_ITEM-ebeln
and ebelp = it_ITEM-ebelp.
*select single charg into (it_ITEM-charg) from ekbe where ebeln = it_ITEM-EBELP.
if sy-subrc IS INITIAL.
CONCATENATE it_item-banfn it_item-bnfpo INTO NAME.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'B06'
LANGUAGE = sy-langu
NAME = NAME
OBJECT = 'EBAN'
TABLES
LINES = lines
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
MODIFY IT_ITEM.
else.
CONCATENATE it_item-EBELN it_item-EBELP INTO NAME.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'F10'
LANGUAGE = sy-langu
NAME = NAME
OBJECT = 'EKPO'
TABLES
LINES = lines
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endif.
IF LINES[] IS INITIAL.
DELETE IT_ITEM.
ENDIF.
CLEAR: IT_ITEM, LINES.
REFRESH : LINES.
endloop.
ENDFORM. " display_data
********************************************************************
*FORM FOR DISPLAY DATA
********************************************************************
FORM display_data .
PERFORM fill_layout_structure.
PERFORM fill_field_catalog_table.
PERFORM get_event USING it_event.
PERFORM fill_listheader USING it_listheader.
perFORM call_alv_function.
ENDFORM. " display_data
&----
*& Form fill_layout_structure
&----
text
----
--> p1 text
<-- p2 text
----
FORM fill_layout_structure .
st_layout-zebra = 'X'.
ENDFORM. " fill_layout_structure
&----
*& Form fill_field_catalog_table
&----
text
----
--> p1 text
<-- p2 text
----
FORM fill_field_catalog_table .
PERFORM fill_field_catalog USING :
'EBELN' 'P.O Number' 'IT_ITEM' 'X' space '10' 'X',
'EBELP' 'P.O. Item No' 'IT_ITEM' space space '10' space,
'BEDAT' 'P.O. Date' 'IT_ITEM' space space '10' space,
'WERKS' 'Plant' 'IT_ITEM' space space '10' space,
'MATNR' 'Material no' 'IT_ITEM' space space '18' space,
'BANFN' 'P.R. Number' 'IT_ITEM' space space '18' space,
'CHARG' 'Batch Number' 'IT_ITEM' space space '10' 'space' .
ENDFORM. " fill_field_catalog_table
*******************************************************************
*FORM FOR FILLING FIELD CATALOG
********************************************************************
FORM fill_field_catalog USING f d t p S o h.
DATA: wa_fieldcat TYPE slis_fieldcat_alv.
STATICS v_pos TYPE i VALUE 1.
wa_fieldcat-row_pos = 1.
wa_fieldcat-col_pos = v_pos.
wa_fieldcat-fieldname = f.
wa_fieldcat-seltext_m = d.
wa_fieldcat-tabname = t.
wa_fieldcat-hotspot = h.
APPEND wa_fieldcat TO it_fieldcat.
v_pos = v_pos + 1.
ENDFORM. "fill_field_catalog
&----
*& Form fill_listheader
&----
text
----
-->P_IT_LISTHEADER text
----
FORM fill_listheader USING P_IT_LISTHEADER TYPE slis_t_listheader.
DATA : wa_listheader TYPE slis_listheader.
CLEAR wa_listheader.
wa_listheader-typ = 'S'.
wa_listheader-info ='PURCHASE ORDER TEXTS '.
APPEND wa_listheader TO it_listheader.
ENDFORM. " fill_listheader
&----
*& Form get_event
&----
text
----
-->P_IT_EVENT text
----
FORM get_event USING P_IT_EVENT TYPE slis_t_event.
DATA : wa_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = it_event.
READ TABLE it_event WITH KEY name = slis_ev_top_of_page INTO wa_event.
IF SY-SUBRC = 0.
MOVE 'TOP_OF_PAGE' to wa_event-form.
APPEND wa_event to it_event.
ENDIF.
ENDFORM. " get_event
********************************************************************
*FORM FOR TOP_OF_PAGE(to assign form for the top-of-page event)
********************************************************************
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_listheader.
ENDFORM. "top_of_page
********************************************************************
*FORM FOR ALV FUNCTIONS
********************************************************************
FORM call_alv_function.
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 = ' '
I_CALLBACK_USER_COMMAND = 'CALL_TCODE'
I_STRUCTURE_NAME =
IS_LAYOUT = st_layout
IT_FIELDCAT = it_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = it_event[]
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
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = it_item
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.
********************************************************************
*FORM FOR ALV CALL_TCODE
********************************************************************
FORM call_tcode USING r_ucomm ls_selfield LIKE ls_selfield.
CASE r_ucomm.
WHEN '&IC1'.
IF ls_selfield-fieldname = 'EBELN'.
SET PARAMETER ID 'BES' FIELD ls_selfield-value.
CALL TRANSACTION 'ME23N'.
ENDIF.
IF ls_selfield-fieldname = 'BANFN'.
SET PARAMETER ID 'BAN' FIELD ls_selfield-value.
CALL TRANSACTION 'ME53N' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM.
regards,
Prabhu
reward if it is helpful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
For the secord requirement, on the double click event, you will need to call transaction ME23 passing the purchase order number of the line selected.
CALL TRANSACTION 'ME23'
USING w_ponum#.
Thanks and Best Regards,
Vikas Bittera.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
7 | |
6 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.