Hierarchial display of BOM in ALV
Hai Experts,
I have a small requirement to display the bom in an hierarchial tree in alv.
The tree shud be as follows:
>material
>material1
>material2
.material3
. material4
>material5
>material6
.matreil17
etc...
the tree structure in the alv shud be as shown above.
I have a structure with
MATNR
MAKTX
AMOUNT
UNIT
PAR_RECNO
SON_RECNO
IS_LEAF
LEVEL.
i have a method which returns above structure .Can anyone help me how to get the hierarchial structure?
Code will be helpful
Thanks&Regards,
Madhu
Hi Madhu,
have a look to this..
http://aiokeh.wdf.sap.corp:1080/SAPIKS2/contentShow.sap?_SCLASS=IWB_STRUCT&_SLOIO=7C3545415EA6F523E10000000A155106&TMP_IWB_TASK=PREVIEW&RELEASE=672&LANGUAGE=EN&_SEQNUM=143&_LOIO=3E904B2624534E0DB707C7314A5E1E9D&_CLASS=IWB_EXTHLP
For WD ALV you need for each level of your Tree a column.
=>The WD ALV Tree is more like a sorted table, where each tree column is part of the aggregation
regards, Martin
Similar Messages
-
hi friendz
i am new to abap.i tried executing the hierarchial display alv, but i did not get the output.though i got the field names in the output but there are no contents displayed.i am including the code here.please help me out.
rg
sandeep
REPORT ZVV_ALV_HIERARCHIAL .
*--type pools
TYPE-POOLS: slis.
*--tables declaration
TABLES: SFLIGHT,SPFLI.
*--types declaration
DATA: BEGIN OF i_SFLIGHT OCCURS 0,
CARRID LIKE SFLIGHT-CARRID,
CONNID LIKE SFLIGHT-CONNID,
FLDATE LIKE SFLIGHT-FLDATE,
END OF i_SFLIGHT.
DATA: BEGIN OF i_SPFLI OCCURS 0,
CARRID LIKE SPFLI-CARRID,
CONNID LIKE SPFLI-CONNID,
AIRPFROM LIKE SPFLI-AIRPFROM,
AIRPTO LIKE SPFLI-AIRPTO,
DISTANCE LIKE SPFLI-DISTANCE,
END OF i_SPFLI.
*--variables
DATA: i_repid LIKE sy-repid.
i_repid = sy-repid.
DATA: i_field TYPE slis_t_fieldcat_alv.
DATA: G_TABNAME_HEADER TYPE SLIS_TABNAME.
DATA: G_TABNAME_ITEM TYPE SLIS_TABNAME.
DATA: G_KEYINFO TYPE SLIS_KEYINFO_ALV.
*--select options
SELECT-OPTIONS : S_CARRID FOR SFLIGHT-CARRID .
*--initialosation
INITIALIZATION.
*--selection screen on
AT SELECTION-SCREEN .
*--start of selection
START-OF-SELECTION.
SELECT CARRID
CONNID
FLDATE
FROM SFLIGHT INTO TABLE i_SFLIGHT
WHERE CARRID IN S_CARRID.
IF NOT i_SFLIGHT IS INITIAL.
SELECT CARRID
CONNID
DISTANCE
INTO TABLE i_SPFLI FROM SPFLI
FOR ALL ENTRIES IN I_SFLIGHT
WHERE CARRID = i_SFLIGHT-CARRID.
ENDIF.
PERFORM fill_fieldcatalog1.
PERFORM fill_fieldcatalog2.
PERFORM HIERARCHY_ALV.
PERFORM alv_events.
G_KEYINFO-header01 = 'CARRID'.
G_KEYINFO-item01 = 'CONNID'.
G_TABNAME_HEADER = 'I_SFLIGHT'.
G_TABNAME_ITEM = 'I_SPFLI'.
*& Form fill_fieldcatalog
FORM fill_fieldcatalog1 .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = i_repid
i_internal_tabname = 'I_SFLIGHT'
i_structure_name = EKPO
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = i_repid
I_BYPASSING_BUFFER = 'X'
I_BUFFER_ACTIVE = ''
CHANGING
ct_fieldcat = i_field
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 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.
ENDFORM. " fill_fieldcatalog
*& Form fill_fieldcatalog2
form fill_fieldcatalog2 .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = i_repid
i_internal_tabname = 'I_SPFLI'
i_structure_name = EKPO
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = i_repid
I_BYPASSING_BUFFER = 'X'
I_BUFFER_ACTIVE = ''
CHANGING
ct_fieldcat = i_field
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 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.
endform. " fill_fieldcatalog2
*& Form HIERARCHY_ALV
form HIERARCHY_ALV .
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = I_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
IS_LAYOUT =
IT_FIELDCAT = I_FIELD
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_DEFAULT = 'X'
I_SAVE = 'A '
IS_VARIANT =
IT_EVENTS = I_EVENTS
IT_EVENT_EXIT =
i_tabname_header = G_TABNAME_HEADER
i_tabname_item = G_TABNAME_ITEM
I_STRUCTURE_NAME_HEADER =
I_STRUCTURE_NAME_ITEM =
is_keyinfo = G_KEYINFO
IS_PRINT =
IS_REPREP_ID =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab_header = I_SFLIGHT
t_outtab_item = I_SPFLI
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. " HIERARCHY_ALVThe program works fine if there is no data in the I_SPFLI. But if the table I_SPFLI is populated it shows an error like 'Unable to interpret "AA " as a number' where AA is the CARRID.
If the header01 is changed to CONNID the program works well. Here is the program.
TYPE-POOLS: slis.
*--tables declaration
TABLES: SFLIGHT,SPFLI.
*--types declaration
DATA: BEGIN OF i_SFLIGHT OCCURS 0,
CARRID LIKE SFLIGHT-CARRID,
CONNID LIKE SFLIGHT-CONNID,
FLDATE LIKE SFLIGHT-FLDATE,
END OF i_SFLIGHT.
DATA: BEGIN OF i_SPFLI OCCURS 0,
CARRID LIKE SPFLI-CARRID,
CONNID LIKE SPFLI-CONNID,
* AIRPFROM LIKE SPFLI-AIRPFROM,
* AIRPTO LIKE SPFLI-AIRPTO,
DISTANCE LIKE SPFLI-DISTANCE,
END OF i_SPFLI.
*--variables
DATA: i_repid LIKE sy-repid.
i_repid = sy-repid.
DATA: i_field TYPE slis_t_fieldcat_alv.
DATA: i_field2 TYPE slis_t_fieldcat_alv.
DATA: G_TABNAME_HEADER TYPE SLIS_TABNAME.
DATA: G_TABNAME_ITEM TYPE SLIS_TABNAME.
DATA: G_KEYINFO TYPE SLIS_KEYINFO_ALV.
*--select options
SELECT-OPTIONS : S_CARRID FOR SFLIGHT-CARRID .
*--initialosation
INITIALIZATION.
*--selection screen on
AT SELECTION-SCREEN .
*--start of selection
START-OF-SELECTION.
SELECT CARRID
CONNID
FLDATE
FROM SFLIGHT INTO TABLE i_SFLIGHT
WHERE CARRID IN S_CARRID.
IF i_SFLIGHT[] IS NOT INITIAL.
SELECT CARRID
CONNID
DISTANCE
INTO TABLE i_SPFLI FROM SPFLI
FOR ALL ENTRIES IN I_SFLIGHT
WHERE CARRID = i_SFLIGHT-CARRID.
IF sy-subrc NE 0.
MESSAGE e001(z538msg).
ENDIF.
ENDIF.
PERFORM fill_fieldcatalog1.
PERFORM fill_fieldcatalog2.
PERFORM HIERARCHY_ALV.
* PERFORM alv_events.
G_KEYINFO-header01 = 'CARRID'.
G_KEYINFO-item01 = 'CONNID'.
G_TABNAME_HEADER = 'I_SFLIGHT'.
G_TABNAME_ITEM = 'I_SPFLI'.
*& Form fill_fieldcatalog
FORM fill_fieldcatalog1 .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = i_repid
i_internal_tabname = 'I_SFLIGHT'
* i_structure_name = EKPO
* I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = i_repid
* I_BYPASSING_BUFFER = 'X'
* I_BUFFER_ACTIVE = ''
CHANGING
ct_fieldcat = i_field
* EXCEPTIONS
* INCONSISTENT_INTERFACE = 1
* PROGRAM_ERROR = 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.
ENDFORM. " fill_fieldcatalog
*& Form fill_fieldcatalog2
form fill_fieldcatalog2 .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = i_repid
i_internal_tabname = 'I_SPFLI'
* i_structure_name = EKPO
* I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = i_repid
* I_BYPASSING_BUFFER = 'X'
* I_BUFFER_ACTIVE = ''
CHANGING
ct_fieldcat = i_field
* EXCEPTIONS
* INCONSISTENT_INTERFACE = 1
* PROGRAM_ERROR = 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.
endform. " fill_fieldcatalog2
*& Form HIERARCHY_ALV
form HIERARCHY_ALV .
<b>*G_KEYINFO-header01 = 'CARRID'.</b>
<b>G_KEYINFO-header01 = 'CONNID'.</b>
G_KEYINFO-item01 = 'CONNID'.
G_TABNAME_HEADER = 'I_SFLIGHT'.
G_TABNAME_ITEM = 'I_SPFLI'.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = I_REPID
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* IS_LAYOUT =
IT_FIELDCAT = I_FIELD
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_DEFAULT = 'X'
I_SAVE = 'A'
* IS_VARIANT =
* IT_EVENTS = I_EVENTS
* IT_EVENT_EXIT =
i_tabname_header = G_TABNAME_HEADER
i_tabname_item = G_TABNAME_ITEM
* I_STRUCTURE_NAME_HEADER =
* I_STRUCTURE_NAME_ITEM =
is_keyinfo = G_KEYINFO
* IS_PRINT =
* IS_REPREP_ID =
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
tables
t_outtab_header = I_SFLIGHT
t_outtab_item = I_SPFLI
* 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. " HIERARCHY_ALV -
Is it possible to display LOGO in simple ALV list?
Hi Guys,
Is it possible to display LOGO in simple ALV list. If yes plz explain in details.
Thanks
SharatYes it is possible to display logo at the top of the page.
TYPE-POOLS: slis.
* Data Decalaration
DATA: it_vbak TYPE TABLE OF vbak.
DATA: g_repid TYPE sy-repid.
DATA: it_listheader TYPE slis_t_listheader,
wa_listheader TYPE slis_listheader.
* START-OF-SELECTION
START-OF-SELECTION.
g_repid = sy-repid.
SELECT * FROM vbak INTO TABLE it_vbak.
PERFORM build_alv_header.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_callback_top_of_page = 'TOP_OF_PAGE'
i_structure_name = 'vbak'
TABLES
t_outtab = it_vbak.
*& Form BUILD_ALV_HEADER
FORM build_alv_header .
* Type H is used to display headers i.e. big font
wa_listheader-typ = 'H'.
wa_listheader-info ='Flight Details'.
APPEND wa_listheader TO it_listheader.
CLEAR wa_listheader.
* Type S is used to display key and value pairs
wa_listheader-typ = 'S'.
APPEND wa_listheader TO it_listheader.
CLEAR wa_listheader.
* Type A is used to display italic font
wa_listheader-typ = 'A'.
wa_listheader-key = 'Date :' .
wa_listheader-info ='SAP ALV Report'.
APPEND wa_listheader TO it_listheader.
CLEAR wa_listheader.
ENDFORM. " BUILD_ALV_HEADER
*& Form top_of_page
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_listheader
i_logo = 'PARI'.
ENDFORM. "top_of_page -
Displaying special characters in ALV report.
Hi Experts,
Can we display special characters in ALV reports? Special characters such as tick mark.(Like in character map(Font Bookshelf Symbol 7) of windows ).
I tried with icons in ALV report, I was able to display tick icon in the ALV report, but when we export the report in to a excel, the icons comes in as Hexadecimal code.
Can any we display special characters like tick in ALV report or display the icons in excel aswell?
I will be gratefull for the <urgency reduced by moderator> response.
Regards,
Sharath.
Edited by: Thomas Zloch on May 10, 2011 10:26 AMSharath,
I think it is possible to do so.
Please check this link.
http://www.sapfans.com/forums/viewtopic.php?f=13&t=322569
Thanks,
Guru. -
WebI issue with hierarchy display and aggregation
Trying to wrangle what looks like a defect in WebI's handling of hierarchy display and aggregation. We just completed an update cycle and are running BOBJ 4.1 SP4.
The hierarchy is a standard FM Commitment Item hierarchy in which both the nodes and leaves are Commitment Items (i.e. it uses InfoObject nodes, not text nodes). An example of one of these nodes looks like this in BW:
Cmmt_Item A - Node
Cmmt_Item B - Leaf
Cmmt_Item C - Leaf
Let's pretend Commitment Item A has $50 posted to it, B has $20 and C has $30. Analysis for OLAP handles this by adding a virtual leaf line to distinguish postings that are on the parent node like so:
Cmmt_Item A - Node $100
Cmmt_Item A - Leaf $50
Cmmt_Item B - Leaf $20
Cmmt_Item C - Leaf $30
So you see both the total for the node ($100) and a line for each Commitment Items with KFs posted to them. Our users like this. They can easily see the aggregation and the breakdown.
WebI, on the other hand, will display it like this:
Cmmt_Item A - Node $150
Cmmt_Item B - Leaf $20
Cmmt_Item C - Leaf $30
It doesn't create a separate line for the value of the parent node, but it does add it's value into the aggregate. Twice. Modifying the table with the 'avoid duplicate row aggregation' checkbox yields output like this:
Cmmt_Item A - Node $100
Cmmt_Item A - Node $50
Cmmt_Item B - Leaf $20
Cmmt_Item C - Leaf $30
We're about halfway there. While the top row now shows the correct aggregation and it creates a new line to show the distinct amount on the parent node, that new line appears on the same level as the parent. It's no longer clear that there's an aggregate and a breakdown. And attempting to expand or contract a node will now crash the report with one of those 'Error 16' messages.
Has anyone encountered this issue with hierarchies in WebI? This report was built from scratch in 4.1, so I'm not sure if this affects older versions or not. Or if it would affect any hierarchy that uses InfoObject nodes instead of text nodes.Without a fix, the simplest workaround I can think of would be to restructure the hierarchy. It can't use postable nodes, so Cmmt_Item A - Node from my example would need to be converted into a text node and the postable characteristic added as a child on the same level as the B and C leaves.
This looks like it would affect anyone using hierarchies with postable nodes in a WebI report.
Another oddity in WebI's behavior here - even though the postable nodes show incorrect sums the sum at the root node is correct. So extending my examples from the original post:
Root Node $100
Cmmt_Item A - Node $150
Cmmt_Item B - Leaf $20
Cmmt_Item C - Leaf $30 -
Error in BO Webi using Authorization analysis in Bex with hierarchy display
Hi Experts ,
When we run the WEBI report created on bex query which has 0comp_code restricted with characteristic variable of processing type Authorization and Not ready for input.
The hierarchy display is active in Bex (as we want to see L01, L02.... in webi)
The authorization analysis is working perfectly when I test in Bex analyser (at any drill down level).
But in BO webi, I get below error
The database error text is: The supplied XML is not valid. [char name & Level].
I dont get this error when I deactivate hierarchy display in Bex.
Also I dont get this error for user ids having 0BI_ALL
Please help me to resolve this.
Thanks
SavioHi Atul,
You can achieve this by dragging these two fields in the filter bar section of the webi. then apply variables on these fields.
hope it helps
Regards,
Rathy -
How to display the fields in ALV Output without using Field catalog?
How to display the fields in ALV Output without using Field catalog?
Could you pls tell me the coding?
Akshitha.Hi,
u mean without building field catalog. is it? I that case, we can use the FM REUSE_ALV_FIELDCATALOG_MERGE.
data: itab type table of mara.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_structure_name = itab
CHANGING
ct_fieldcat = lt_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
*Pass that field catalog into the fillowing FM
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_grid_title = 'REPORTING'
is_layout = gt_layout
it_fieldcat = lt_fieldcat[]
tables
t_outtab = itab. -
Problem in display of text in ALV report
Dear experts,
I am working on a MM Report in which I need to display Material Basic data text maintained in MM01,02 Tcodes through ALV report.
I have declared a string type variable for the Basic data text in the Final Internal Table.
For reading the Standard text I am using Read_Text FM, from which I am looping the Text internal table and concatenating it into
String variable.
What I notice is all the content beyond 255 chars is not getting displayed, Even when the ALV report is downloaded to Excel file.
Can you suggest some approach to over come this issue.
Regards,
MurthyHi,
Use the below code
Data : lt_content TYPE TABLE OF tline,
lw_content TYPE tline.
Data : lt_text Type Table of solisti1,
lw_text TYPE solisti1.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = lv_id
language = tdspras
name = lv_name
object = lv_object
archive_handle = 0
local_cat = ' '
TABLES
lines = lt_content
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
loop at lt_content into lw_content.
lw_text-line = lw_content-tdline.
APPEND lw_text TO lt_text.
CLEAR: lw_content, lw_text.
endloop.
Now your whole text is in "lt_text".
Regards,
Avish Mittal -
How to change the text of item's displaying in the folowing ALV.
Hi Experts,
I want to change the text of item's displaying in the folowing ALV.
Go to ME23N->Click 'Messages'->Click 'Further Data' -> Click 'Displ.Originals'.
Here one small ALV grid is appearing.
Currently it is showing same name's under the 'Title' column of that ALV. My requirement is to change the text coming under the column 'Title' in that display.
Can any one throw some light in the issue.
Thanks&Regards,
AnvershaHi Anversha ,
i think you need to use Enhancement point for it.
check the program DV70AF0A-->ARCHIV_ANZEIGE(Subtoutine).
i had similar kind of requirement ,while attaching the supporting documents to FI document , i need to update title field with File name , so i used EP and BADI to do so.
regards
Prabhu -
Display Traffic Lights in ALV TREE
Hi,
I have to display traffic light in ALV tree but i am not able to find out what parameter i should pass like in ALV grid where we can set is_layout (BCALV_GRID_04).
Thanks in advance.
Regards,
HarshHi,
Please take a look at my code below. Hope it suits your requirement.
P.S. Please award points if it helps...
*& Report ZMM_R_PO_TO_IPURCH_XI
*& PROGRAM TYPE : Report
*& RICEF ID :
*& TITLE : ZMM_R_PO_TO_IPURCH_XI
*& SAP Module : MM
*& CREATION DATE : 02/06/2008
*& AUTHOR : Aris Hidalgo
*& DESIGNER : Aris Hidalgo
*& DESCRIPTION :
*$**********************************************************************
*$ CHANGE HISTORY
*$----------------------------------------------------------------------
*$ DATE | T-Num | Description | Reference
** | | |
*$**********************************************************************
REPORT zmm_r_po_to_ipurch_xi
NO STANDARD PAGE HEADING
MESSAGE-ID zmm.
* Data Dictionary Table/s *
TABLES: edidc.
* SELECTION-SCREEN *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_credat FOR edidc-credat OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS: rb_sum RADIOBUTTON GROUP grp1,
rb_det RADIOBUTTON GROUP grp1.
SELECTION-SCREEN END OF BLOCK b2.
*/ CLASS DEFINITION/S /*
* CLASS lcl_data_def DEFINITION
CLASS lcl_data_def DEFINITION ABSTRACT.
PUBLIC SECTION.
TYPES: BEGIN OF t_edidc,
docnum TYPE edidc-docnum,
docrel TYPE edidc-docrel,
status TYPE edidc-status,
doctyp TYPE edidc-doctyp,
direct TYPE edidc-direct,
rcvpor TYPE edidc-rcvpor,
rcvprt TYPE edidc-rcvprt,
rcvprn TYPE edidc-rcvprn,
rcvsad TYPE edidc-rcvsad,
sndpor TYPE edidc-sndpor,
sndprt TYPE edidc-sndprt,
sndprn TYPE edidc-sndprn,
sndsad TYPE edidc-sndsad,
credat TYPE edidc-credat,
cretim TYPE edidc-cretim,
mestyp TYPE edidc-mestyp,
idoctp TYPE edidc-idoctp,
END OF t_edidc.
TYPES: BEGIN OF t_output,
exception TYPE char1,
ebeln TYPE ekko-ebeln,
lifnr TYPE lfa1-lifnr,
name1 TYPE lfa1-name1,
credat TYPE edidc-credat,
cretim TYPE edidc-cretim,
END OF t_output.
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekko-ebeln,
lifnr TYPE ekko-lifnr,
END OF t_ekko.
TYPES: BEGIN OF t_lfa1,
lifnr TYPE lfa1-lifnr,
name1 TYPE lfa1-name1,
END OF t_lfa1.
DATA: gt_edidc TYPE STANDARD TABLE OF t_edidc,
gt_output TYPE STANDARD TABLE OF t_output,
wa_output LIKE LINE OF gt_output,
gt_ekko TYPE HASHED TABLE OF t_ekko
WITH UNIQUE KEY ebeln,
gt_lfa1 TYPE HASHED TABLE OF t_lfa1
WITH UNIQUE KEY lifnr.
ENDCLASS. "lcl_data_def DEFINITION
CLASS lcl_alv_routines DEFINITION DEFERRED.
CLASS lcl_handle_events DEFINITION DEFERRED.
* CLASS lcl_get_data DEFINITION
CLASS lcl_get_data DEFINITION INHERITING FROM lcl_data_def.
PUBLIC SECTION.
METHODS: get_idocs,
read_idocs,
process_data
IMPORTING
im_docnum TYPE edidc-docnum.
PRIVATE SECTION.
CONSTANTS: lc_mestyp TYPE edidc-mestyp VALUE 'ZMARKETSITE_PURCHASE_ORDER',
lc_idoctp TYPE edidc-idoctp VALUE 'ZMARKETSITE_PURCHASE_ORDER01',
lc_segnam TYPE edid4-segnam VALUE 'ZMARKETSITE_ORDER_HEADER1'.
CONSTANTS: lc_red TYPE i VALUE 1,
lc_yellow TYPE i VALUE 2,
lc_green TYPE i VALUE 3.
DATA: lv_stat_message TYPE bdidocattr-message,
o_lcl_alv_routines TYPE REF TO lcl_alv_routines.
DATA: ls_idoc_control TYPE edidc,
lv_tot_data_recs TYPE sy-dbcnt, "#EC NEEDED
lv_tot_status_recs TYPE sy-dbcnt. "#EC NEEDED
DATA: lt_edids TYPE STANDARD TABLE OF edids,
lt_edidd TYPE STANDARD TABLE OF edidd.
ENDCLASS. "lcl_get_data DEFINITION
* CLASS lcl_alv_routines DEFINITION
CLASS lcl_alv_routines DEFINITION INHERITING FROM lcl_get_data.
PUBLIC SECTION.
DATA: lcl_table TYPE REF TO cl_salv_table,
lcl_container TYPE REF TO cl_gui_custom_container,
lcl_handle_events TYPE REF TO lcl_handle_events,
lcl_columns TYPE REF TO cl_salv_columns_table,
lcl_column TYPE REF TO cl_salv_column_table,
lcl_events2 TYPE REF TO cl_salv_events_table,
lcl_display_settings TYPE REF TO cl_salv_display_settings,
lcl_functions TYPE REF TO cl_salv_functions_list,
lcl_display TYPE REF TO cl_salv_display_settings,
lcl_aggregations TYPE REF TO cl_salv_aggregations,
lcl_sorts TYPE REF TO cl_salv_sorts,
lcl_content TYPE REF TO cl_salv_form_element,
lcl_header TYPE REF TO cl_salv_form_header_info,
ls_color TYPE lvc_s_colo.
DATA: lcl_grid TYPE REF TO cl_salv_form_layout_grid,
lcl_grid_1 TYPE REF TO cl_salv_form_layout_grid,
lcl_grid_2 TYPE REF TO cl_salv_form_layout_grid,
lcl_label TYPE REF TO cl_salv_form_label,"#EC NEEDED
lcl_text TYPE REF TO cl_salv_form_text,
gt_t247 TYPE STANDARD TABLE OF t247,
wa_t247 LIKE LINE OF gt_t247,
lv_text TYPE string.
METHODS: display_data
IMPORTING
im_output LIKE gt_output,
display_top_of_page.
PRIVATE SECTION.
DATA: lv_string TYPE string,
lv_date1 TYPE c LENGTH 10,
lv_time TYPE c LENGTH 10,
lv_title TYPE string.
ENDCLASS. "lcl_alv_routines DEFINITION
* CLASS lcl_handle_events DEFINITION
CLASS lcl_handle_events DEFINITION.
PUBLIC SECTION.
METHODS:
on_link_click FOR EVENT link_click OF cl_salv_events_table
IMPORTING row column.
ENDCLASS. "lcl_handle_events DEFINITION
*/ IMPLEMENTATION/S /*
* CLASS lcl_get_data IMPLEMENTATION
CLASS lcl_get_data IMPLEMENTATION.
* METHOD get_idocs
METHOD get_idocs.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
text = text-p01.
SELECT docnum docrel status doctyp
direct rcvpor rcvprt rcvprn
rcvsad sndpor sndprt sndprn
sndsad credat cretim mestyp
idoctp
FROM edidc
INTO TABLE gt_edidc
WHERE mestyp = lc_mestyp
AND idoctp = lc_idoctp
AND credat IN s_credat.
IF gt_edidc[] IS NOT INITIAL.
* Get IDOC details
CALL METHOD me->read_idocs.
ENDIF.
ENDMETHOD. "get_idocs
* METHOD read_idocs
METHOD read_idocs.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
text = text-p02.
FIELD-SYMBOLS: <fs_edidc> LIKE LINE OF gt_edidc,
<fs_output> LIKE LINE OF gt_output,
<fs_ekko> LIKE LINE OF gt_ekko,
<fs_lfa1> LIKE LINE OF gt_lfa1.
LOOP AT gt_edidc ASSIGNING <fs_edidc>.
CLEAR ls_idoc_control.
REFRESH: lt_edids, lt_edidd.
* Get status text of IDOC
CALL FUNCTION 'IDOC_GET_MESSAGE_ATTRIBUTE'
EXPORTING
idoc_number = <fs_edidc>-docnum
IMPORTING
idoc_message = lv_stat_message.
* Get IDOC details
CALL FUNCTION 'IDOC_READ_COMPLETELY'
EXPORTING
document_number = <fs_edidc>-docnum
IMPORTING
idoc_control = ls_idoc_control
number_of_data_records = lv_tot_data_recs
number_of_status_records = lv_tot_status_recs
TABLES
int_edids = lt_edids
int_edidd = lt_edidd
EXCEPTIONS
document_not_exist = 1
document_number_invalid = 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.
* Pass data to output table
CALL METHOD me->process_data
EXPORTING
im_docnum = <fs_edidc>-docnum.
ENDLOOP.
DELETE gt_output WHERE ebeln IS INITIAL.
IF gt_output[] IS NOT INITIAL.
* Get vendor for fetched POs
SELECT ebeln lifnr
FROM ekko
INTO TABLE gt_ekko
FOR ALL ENTRIES IN gt_output
WHERE ebeln = gt_output-ebeln.
IF gt_ekko[] IS NOT INITIAL.
* Get name of vendors
SELECT lifnr name1
FROM lfa1
INTO TABLE gt_lfa1
FOR ALL ENTRIES IN gt_ekko
WHERE lifnr = gt_ekko-lifnr.
ENDIF.
* Pass vendor details to output table
LOOP AT gt_output ASSIGNING <fs_output>.
READ TABLE gt_ekko ASSIGNING <fs_ekko>
WITH TABLE KEY ebeln = <fs_output>-ebeln.
IF sy-subrc = 0.
READ TABLE gt_lfa1 ASSIGNING <fs_lfa1>
WITH TABLE KEY lifnr = <fs_ekko>-lifnr.
IF sy-subrc = 0.
<fs_output>-lifnr = <fs_lfa1>-lifnr.
<fs_output>-name1 = <fs_lfa1>-name1.
ENDIF.
ENDIF.
ENDLOOP.
CREATE OBJECT o_lcl_alv_routines.
CALL METHOD o_lcl_alv_routines->display_data
EXPORTING
im_output = gt_output[].
ENDIF.
ENDMETHOD. "read_idocs
* METHOD process_data
METHOD process_data.
FIELD-SYMBOLS: <fs_edidd> LIKE LINE OF lt_edidd.
IF lv_stat_message CP 'ok' OR
lv_stat_message CP 'positive'.
wa_output-exception = lc_green.
ELSEIF lv_stat_message CP 'error' OR
lv_stat_message CP 'negative'.
wa_output-exception = lc_red.
ELSE.
wa_output-exception = lc_yellow.
ENDIF.
READ TABLE lt_edidd ASSIGNING <fs_edidd>
WITH KEY docnum = im_docnum
segnam = lc_segnam.
IF sy-subrc = 0.
wa_output-ebeln = <fs_edidd>-sdata+0(10).
ENDIF.
wa_output-credat = ls_idoc_control-credat.
wa_output-cretim = ls_idoc_control-cretim.
APPEND wa_output TO gt_output.
CLEAR wa_output.
ENDMETHOD. "process_data
ENDCLASS. "lcl_get_data IMPLEMENTATION
* CLASS lcl_alv_routines IMPLEMENTATION
CLASS lcl_alv_routines IMPLEMENTATION.
* METHOD display_data
METHOD display_data.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
percentage = 0
text = text-p03.
gt_output[] = im_output[].
TRY.
cl_salv_table=>factory(
EXPORTING
list_display = ''
IMPORTING
r_salv_table = lcl_table
CHANGING
t_table = gt_output ).
CATCH cx_salv_msg. "#EC NO_HANDLER
ENDTRY.
lcl_functions = lcl_table->get_functions( ).
* Set all standard ALV functions
lcl_functions->set_all( abap_true ).
lcl_columns = lcl_table->get_columns( ).
lcl_columns->set_optimize( '' ).
* Set display to striped pattern
lcl_display = lcl_table->get_display_settings( ).
lcl_display->set_striped_pattern( cl_salv_display_settings=>true ).
*/Sort columns
TRY.
lcl_sorts = lcl_table->get_sorts( ).
CATCH cx_salv_not_found. "#EC NO_HANDLER
ENDTRY.
lcl_sorts->set_group_active( ).
TRY.
lcl_sorts->add_sort(
columnname = 'EBELN'
subtotal = '' ).
CATCH cx_salv_not_found cx_salv_existing cx_salv_data_error."#EC NO_HANDLER
ENDTRY.
*/Set column names
TRY.
lcl_columns->set_exception_column( 'EXCEPTION' ).
CATCH cx_salv_data_error. "#EC NO_HANDLER
ENDTRY.
TRY.
lcl_column ?= lcl_columns->get_column( 'EXCEPTION' ).
lcl_column->set_short_text( text-h01 ).
lcl_column->set_medium_text( text-h01 ).
lcl_column->set_long_text( text-h01 ).
lcl_column->set_output_length( '6' ).
CATCH cx_salv_not_found. "#EC NO_HANDLER
ENDTRY.
TRY.
lcl_column ?= lcl_columns->get_column( 'EBELN' ).
lcl_column->set_short_text( text-h02 ).
lcl_column->set_medium_text( text-h02 ).
lcl_column->set_long_text( text-h02 ).
lcl_column->set_output_length( '9' ).
CATCH cx_salv_not_found. "#EC NO_HANDLER
ENDTRY.
TRY.
lcl_column ?= lcl_columns->get_column( 'LIFNR' ).
* lcl_column->set_short_text( text-h03 ).
lcl_column->set_medium_text( text-h03 ).
lcl_column->set_long_text( text-h03 ).
lcl_column->set_output_length( '11' ).
CATCH cx_salv_not_found. "#EC NO_HANDLER
ENDTRY.
TRY.
lcl_column ?= lcl_columns->get_column( 'NAME1' ).
* lcl_column->set_short_text( text-h04 ).
* lcl_column->set_medium_text( text-h04 ).
lcl_column->set_long_text( text-h04 ).
lcl_column->set_output_length( '30' ).
CATCH cx_salv_not_found. "#EC NO_HANDLER
ENDTRY.
TRY.
lcl_column ?= lcl_columns->get_column( 'CREDAT' ).
* lcl_column->set_short_text( text-h05 ).
* lcl_column->set_medium_text( text-h05 ).
lcl_column->set_long_text( text-h05 ).
lcl_column->set_output_length( '13' ).
CATCH cx_salv_not_found. "#EC NO_HANDLER
ENDTRY.
TRY.
lcl_column ?= lcl_columns->get_column( 'CRETIM' ).
* lcl_column->set_short_text( text-h06 ).
* lcl_column->set_medium_text( text-h06 ).
lcl_column->set_long_text( text-h06 ).
lcl_column->set_output_length( '13' ).
CATCH cx_salv_not_found. "#EC NO_HANDLER
ENDTRY.
*/Set aggregations
* TRY.
* lcl_aggregations = lcl_table->get_aggregations( ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
* TRY.
* lcl_aggregations->add_aggregation( '' ).
* CATCH cx_salv_not_found cx_salv_data_error cx_salv_existing."#EC NO_HANDLER
* ENDTRY.
*/Hide columns
* TRY.
* lcl_column ?= lcl_columns->get_column( 'DESCRIPT' ).
* lcl_column->set_visible( if_salv_c_bool_sap=>false ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
*/Display top of page
CALL METHOD me->display_top_of_page.
lcl_table->set_top_of_list( lcl_content ).
*/Handle ALV events
lcl_events2 = lcl_table->get_event( ).
CREATE OBJECT lcl_handle_events.
SET HANDLER lcl_handle_events->on_link_click FOR lcl_events2.
lcl_display_settings = lcl_table->get_display_settings( ).
lcl_table->display( ).
ENDMETHOD. "display_data
* METHOD display_top_of_page
METHOD display_top_of_page.
CREATE OBJECT lcl_grid.
lv_title = text-t01.
lcl_grid->create_header_information(
row = 1
column = 1
text = lv_title
tooltip = lv_title ).
lcl_grid->add_row( ).
lcl_grid_1 = lcl_grid->create_grid(
row = 3
column = 1 ).
CLEAR lv_string.
CONCATENATE: sy-datum+4(2) '/' sy-datum+6(2) '/' sy-datum+0(4)
INTO lv_date1.
CONCATENATE: text-t02 lv_date1
INTO lv_string
SEPARATED BY space.
lcl_label = lcl_grid_1->create_label(
row = 1
column = 1
text = lv_string
tooltip = lv_string ).
CLEAR lv_string.
CONCATENATE: sy-uzeit+0(2) ':' sy-uzeit+2(2) ':' sy-uzeit+4(2)
INTO lv_time.
CONCATENATE: text-t03 lv_time
INTO lv_string
SEPARATED BY space.
lcl_label = lcl_grid_1->create_label(
row = 2
column = 1
text = lv_string
tooltip = lv_string ).
lcl_content = lcl_grid.
ENDMETHOD. "display_top_of_page
ENDCLASS. "lcl_alv_routines IMPLEMENTATION
* CLASS lcl_handle_events IMPLEMENTATION
CLASS lcl_handle_events IMPLEMENTATION.
* METHOD on_link_click
METHOD on_link_click.
ENDMETHOD. "on_link_click
ENDCLASS. "lcl_handle_events IMPLEMENTATION
* START-OF-SELECTION *
START-OF-SELECTION.
DATA: o_lcl_get_data TYPE REF TO lcl_get_data.
CREATE OBJECT o_lcl_get_data.
CALL METHOD o_lcl_get_data->get_idocs. -
Alv- displaying long text in alv output
hi,
as per my requirement, i need to be display long text (length >1000 characters) in alv list or alv grid.
i get the entaire long text and keep it in final internal table and pass it to alv functional module, but it unable to display the compleate long text( in alv-grid).
the alv list displays the complete long text but not in the row, it displays in the second rown and few field labes of long text and its previous field label are displayed in impro[per order.
is there any possible way to display long text in alv.
regards,
revooriHi Ashok,
try to pass the below while filling your long text.
wa_fieldcat-seltext_l = 'Your Long Text'.
wa_fieldcat-ddictxt = 'L'.
for more info check below
Long Text --- 1000 characters
hope it works
Thnaks!
Edited by: Prasanth on Mar 8, 2009 4:03 PM -
Dear Experts,
I have a requirement where the user wants me to display the standard text in SO10 using ALV.
The text must be displayed exactly like how the user maintaned in SO10.
What is the best way? The user do not want the solution to have a button in the text field, and pop up screen in alv to display the text.The problem not related to the data retrieval.
Its about how to display the text in ALV. I dont wantto display the text in single line in alv coz it gonna be very long and will no longer in original format.
Edited by: Castelloz Alfonso on Sep 24, 2009 7:59 AM -
To display multiple BOMS by selection
I'm trying to avoid havig to create a report to collectively display multiple BOMS by selection (eg MRP controller, group of header materials etc) to satisfy the following:
- collective display
- multi-level display (indented)
- factor scrap, giving component qtys as per base qty of BOM header
Trans CS11 provides this info, only on an individual BOM basis.Hi,
Can explain your query a bit more in brief?
Thanks
Kathir~ -
Display multilevel BOM for multiple materials
Hi,
I am to trying to display multilevel BOM explosion for multiple BOMs valid to custom date. Then I would like to export this list of all components to Excel.
Best solution would be if to create QuickView to do this.
So far I have been able to Join tables MAST - STPO, this shows me only one level of BOM (sort of like CS03 transaction) not a multilevel view (CS12). Is it possible to modify this to display multilevel view?
Thank you,
TomasDear Thomas,
in order to have a multilevel Bom explosion you must use only fm : CS_BOM_EXPL_MAT_V2 because you won't succeed to have a multiplevel with a simple query.
I advise you set MEHRS = X for active multilevel logic.
Let me know if i have been useful for you
Daniele -
In a report we are using orgunit hierarchy and we have another field in the report Manager name (manager of the orgunit). Currently at the top level of the hierarchy all managers are displayed for every node under it. Example
Level 1
Org 1----Manager 3
Manager 2
Manager 1
Level 2
Org 2-----Manager 2
Manager 1
Level 3
Org 3----Manager 1
Is there a way to only display Manager 3 for Org 1 and Manager 2 for Org 2? We thought about compounding orgunit with manager but we could run into an issue with time dependency. Any other suggestions without removing the hierarchy display?Not sure if this fits your situation or not, but look in orgunit and see if there is a manager in there already (if not you can customize it and add it in). Then you can display the orgunit on your report and then also display the orgunit's manager attribute.
You are displaying the manager and orgunit from transaction data. This manager could be the employee's manager, cost center manager, orgunit manager, etc...
Brian
Maybe you are looking for
-
Apps bought before 3.0 upgrade are synced but don't show up
After I upgraded to iPhone OS 3.0 (I also upgraded to iTunes 8.2 just before that) all of the apps I bought/downloaded (priced and free apps) before the upgrade except two (about 33 apps) will sync to my iphone. Itunes shows the information at the to
-
How to Import the Enterprise Portal EAR files in Track.
Dear All, I developing Portal components in local development system (NWDS).Now i need to move into track (NWDI).I checked but i am not getting any option to move that. I try to create Enterprise Portal component.But that is in disable mode and gray
-
Download Adobe Flash Opens only in Chrome
Please read carefully: The problem is that the download opens in Chrome automatically and I cannot find a way to open it in Firefox. It isn't a question of finding a way to download for all browsers, it is a problem with the fact that it opens in Chr
-
Writing large amount of data to db
I have set the max size of berkeley db to 1G. But the data that i want to cache might go over 1G. I am just wondering how berkeley DB handles this case. Does it automatically write it to a seconday storage or just throws an exception? I am looking fo
-
Middleware gurus, Our delta changes with the BPs from CRM to ECC are generating a "Message type is unknown". Has anyone ever seen this? It works fine from ECC to CRM. We're on CRM 5.0 and ECC 5.0. Does anyone have any clue???