How to control the output fields in ALV
Hi Pals,
I have a Z program which outputs around 400 characters length. It is working fine when we run in foreground(online).. But i have the problem with the length of the output of the report when i run in BACKGROUND mode. That is, only 255 characters are being displayed.
So, i have decided to supress some of the unwanted output fields being diplayed, so that the total output length becomes 255 characters.
How can i handle this situation in the ALV's?
Someone please send me some sample code.
Thanks in advance,
Ram.
Hi
Better create the Layout Variants with the desired columns.
ALV is providing that functionality.
Use
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = alv_variant
i_save = 'A'
IMPORTING
es_variant = alv_variant
EXCEPTIONS
not_found = 2.
Regards,
Kumar
Similar Messages
-
How could control the scroll events in ALV OO?
Hello experts!
I'm programing a report, inside there is a field that need time of processing. I'm using ALV OO.
I have thought that it could only calculate the field for the lines that visualize.
How could control the scroll events to calculate the field of the visualized lines?
I'm using CL_SALV_TABLE class and cl_salv_events_table to control the events, but there aren't any event to control the scroll.
best regards!Hi Sriram,
I did view the information that you was attaching, but this don't resolve my problem. With methods get_scroll_info_via_id and set_scroll_info_via_id, we can get and put information of selection and view rows in the screen but we don't control when the user click in the scroll for advance or to back down a page.
I would like to refresh the data in ALV when the user view news rows.
I want your genial ideas.
Best regards! -
HOW TO READ THE EDITABLE FIELD IN ALV
CAN ANYONE HELP ME IN READING THE EDITABLE FIELD IN ALV.
I AM DOING THE FOLLOWING.
BUT STILL THE EDITABLE FIELD IN NOT READ.
WHEN 'EXE' OR 'EXEC'.
LOOP AT I_RB1 INTO L_WA_STRU.
L_WA_STRU-LIFSK = L_WA_STRU-LIFSK1.
MODIFY I_RB1 FROM L_WA_STRU.
CLEAR L_WA_STRU.
ENDLOOP.
I_RB1 IS MY TABLE WHICH I PASSED IN TABLES OF REUSE_ALV_GRID_DISPLAY.LIFSK1 IS MY EDITABLE FIELD.
AND LIFSK IS THE FIELD WHERE THE DATA SHOULD GET TRANSFERRED WHEN I HIT EXECUTE BUTTON.DATA: lt_display LIKE TABLE OF gt_display.
REFRESH lt_display.
CLEAR lt_display.
lt_display[] = gt_display[].
CLEAR ref_grid.
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
IF lt_display[] NE gt_display[].
gv_tosave = 'X'.
ENDIF.
Check this program. It will help you.
awrd points if helpful
Bhupal -
How to set the output list in alv
hai all,
i have copied the standard alv program into customized and the out put of customized have changed . but the output listy of this customized program is to be changed like standard program . please tell me how to do this i have setting the current layout of it . it will display only for time been whemni come out of that program it will change .Hi,
After changing the layout to desired output. Save the layout and set it as default. Then it will work for every time.
Thanks
Chandra -
How to control the output types in PO MESSAGES
Hi Friends,
As per the requirement I need to control the message in Standard PO(ME22N). Scenario is like below.
1. I am modifying some field value in PO and saving it. Then clicking on MESSAGES tab. Now I am seeing some output types are adding in EDIT mode.
2. Requirement is , when ever user changed one particular filed(Order acknowledgement ) and saved it, then he doesnu2019t want to see the message in EDIT mode.
Could you please suggest me the way? Any user exit is there to reach this? Please do the needful.
Thanks,
Kumarhi,
its may be useful for u.
In the release strategy,if the indicator changeablity is 1 the system will not allow you to take repeat out put.
Solution is that you have to change the release indicator changeability to 6(SPRO>MM>Purchasing>Purchase order>Define release procedure for purchase order>Release indicator>Changeability).
Another option is that in the message output of the PO in further data change despatch time to 3 and take a repeat out put.
Also check,
SPRO > MM > PO > Release Procedure for PO > Release indicator > Changeability of Purchasing Document During/After Release as 2 for Release ID - G and save
And then Create go to chage mode of PO and repeat the messages
Regards,
venkat m -
How to save the edited fields in ALV list
Hi
hope you could help me find a solution, I made my fields editable in ALV grid display as you can see in the code ZID_NUM, ZLAST_NAME and ZMIDDLE_NAME is editable..
an example scenario would be if I execute the program it will show me 5 lines, all the fields can be edited by the user...(example he edited all data in the result). When he press save, it will automatically update the ztable (ZMEMPLIST in this case). How do you go about the saving?
thanks!!
select * from zmemplist client specified
into corresponding fields of table it_ztable.
it_fieldcat-fieldname = 'ZID_NUM'.
it_fieldcat-seltext_m = ' ID Number '.
it_fieldcat-col_pos = 1.
it_fieldcat-input = 'X'.
it_fieldcat-edit = 'X'.
append it_fieldcat to it_fieldcat.
clear it_fieldcat.
it_fieldcat-fieldname = 'ZLAST_NAME'.
it_fieldcat-seltext_m = ' Last Name '.
it_fieldcat-col_pos = 2.
it_fieldcat-input = 'X'.
it_fieldcat-edit = 'X'.
append it_fieldcat to it_fieldcat.
clear it_fieldcat.
it_fieldcat-fieldname = 'ZFIRST_NAME'.
it_fieldcat-seltext_m = ' First Name '.
it_fieldcat-col_pos = 3.
it_fieldcat-input = 'X'.
it_fieldcat-edit = 'X'.
append it_fieldcat to it_fieldcat.
clear it_fieldcat.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
it_fieldcat = it_fieldcat[]
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'SET_PF_STATUS'
tables
t_outtab = it_ztable.
*& Form user_command
Handling custom function codes
-->R_UCOMM Function code value
-->RS_SELFIELD Info. of cursor position in ALV
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
when 'SAVE'.
endformHi Lawrence,
Include follwoing code on your user command for 'SAVE'.
*& Form user_command
* Handling custom function codes
* -->R_UCOMM Function code value
* -->RS_SELFIELD Info. of cursor position in ALV
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
when 'SAVE'.
DATA ref1 TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref1.
CALL METHOD ref1->check_changed_data.
............... " your action
* endform
Hope this will sovle your query.
Pratik Vora -
How to merge the 2 field in alv gride display
Tables for ALV display
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
wa_layout TYPE slis_layout_alv,
it_exclude TYPE slis_t_extab,
wa_exclude TYPE slis_extab,
it_header TYPE STANDARD TABLE OF zqm_imir_hdr,
wa_header LIKE LINE OF it_header,
it_final TYPE STANDARD TABLE OF zqm_imir_itm,
wa_final LIKE LINE OF it_final,
it_vcode TYPE RANGE OF zqm_wtr_itm-vcode,
wa_vcode LIKE LINE OF it_vcode.
DEFINE m_fieldcat.
wa_fieldcat-fieldname = &1.
wa_fieldcat-tabname = &2.
wa_fieldcat-seltext_m = &3.
wa_fieldcat-outputlen = &4.
wa_fieldcat-col_pos = &5.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
END-OF-DEFINITION.
DEFINE m_vcode.
wa_vcode-option = &1.
wa_vcode-sign = &2.
wa_vcode-low = &3.
wa_vcode-high = ''.
append wa_vcode to it_vcode.
clear wa_vcode.
END-OF-DEFINITION.
START-OF-SELECTION.
PERFORM data_retrival.
PERFORM lead_time_calculation.
IF it_final[] IS NOT INITIAL.
PERFORM alv_display.
ENDIF.
Display ALV
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = wa_layout
it_fieldcat = it_fieldcat
i_save = c_x
it_excluding = it_exclude
TABLES
t_outtab = IT_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.
m_fieldcat: 'ZIMIRNO' 'IT_OUTPUT' text-003 21 0,
'PRUEFLOS' 'IT_OUTPUT' text-004 21 1,
'ZCRDAT' 'IT_OUTPUT' text-030 9 2,
'INITS' 'IT_OUTPUT' text-031 6 3,
'SPLIT' 'IT_OUTPUT' text-005 12 4,
'WERK' 'IT_OUTPUT' text-006 5 5,
'LOSMENGE' 'IT_OUTPUT' text-007 24 6,
'MENGENEINH' 'IT_OUTPUT' text-008 15 7,
'NAMEVEND' 'IT_OUTPUT' text-009 11 8,
*& Hypercare - 721600 - IMIR Changes - Start
'KONT_PSPNR' 'IT_OUTPUT' text-023 15 7,
'POSID' 'IT_OUTPUT' text-023 15 9,
*& Hypercare - 721600 - IMIR Changes - End
'LTEX1' 'IT_OUTPUT' text-024 24 10,
'EBELN' 'IT_OUTPUT' text-010 26 11,
'MBLNR' 'IT_OUTPUT' text-011 24 12,
'ANZGEB' 'IT_OUTPUT' text-012 17 13,
'GEBEH' 'IT_OUTPUT' text-013 4 14,
'MATNR' 'IT_OUTPUT' text-014 18 15,
'TXZ01' 'IT_OUTPUT' text-015 128 16,
'SPECE' 'IT_OUTPUT' text-016 23 17,
'VCODE' 'IT_OUTPUT' text-017 24 18,
'TAGNO' 'IT_OUTPUT' text-018 10 19,
'HEATNO' 'IT_OUTPUT' text-019 11 20,
'IDCODE' 'IT_OUTPUT' text-020 7 21,
'TCNO' 'IT_OUTPUT' text-021 9 22,
'REMARKS' 'IT_OUTPUT' text-022 30 23,
'BUDAT' 'IT_OUTPUT' text-025 30 24,
'CPUTM' 'IT_OUTPUT' text-026 30 25,
'VDATUM' 'IT_OUTPUT' text-027 30 26,
'VEZEITERF' 'IT_OUTPUT' text-028 30 27,
'ZLTIME' 'IT_OUTPUT' text-029 30 26,
'LEADTIME' 'IT_OUTPUT' text-029 30 28.
DATA : v_unit like T006-MSEHI VALUE 'HR',
v_FCALID like SCAL-FCALID,
v_zltim TYPE f,
v_zltime TYPE p LENGTH 8 DECIMALS 2.
SELECT SINGLE FABKL INTO v_FCALID FROM T001W WHERE WERKS = s_werks.
SELECT zcrdat INTO TABLE it_zqm_imir_hdr
from zqm_imir_hdr
FOR ALL ENTRIES IN it_final
where zcrdat EQ it_final-zcrdat.
SELECT mblnr mjahr budat cputm
INTO TABLE it_mkpf
from mkpf
FOR ALL ENTRIES IN it_final
where mblnr EQ it_final-mblnr
AND mjahr EQ it_final-mjahr.
SELECT prueflos vdatum vezeiterf
INTO TABLE it_qave
from qave
FOR ALL ENTRIES IN it_final
where prueflos EQ it_final-prueflos.
SORT it_mkpf BY mblnr mjahr.
SORT it_qave by prueflos.
SORT it_zqm_imir_hdr BY zcrdat.
LOOP AT it_final into wa_final.
CLEAR: wa_output,wa_mkpf,wa_qave,wa_zqm_imir_hdr.
MOVE-CORRESPONDING wa_final to wa_output.
READ TABLE it_zqm_imir_hdr INTO wa_zqm_imir_hdr WITH KEY zcrdat = wa_final-zcrdat
BINARY SEARCH.
READ TABLE it_mkpf INTO wa_mkpf WITH KEY mblnr = wa_final-mblnr
mjahr = wa_final-mjahr
BINARY SEARCH.
MOVE wa_zqm_imir_hdr-zcrdat TO wa_output-zcrdat.
MOVE wa_mkpf-budat TO wa_output-budat.
MOVE wa_mkpf-cputm TO wa_output-cputm.
READ TABLE it_qave INTO wa_qave WITH KEY prueflos = wa_final-PRUEFLOS
BINARY SEARCH.
MOVE wa_qave-vdatum TO wa_output-vdatum.
MOVE wa_qave-vezeiterf TO wa_output-vezeiterf.
LV_START_DATE = wa_zqm_imir_hdr-zcrdat.
LV_START_DATE = wa_mkpf-budat.
LV_START_TIME = wa_mkpf-cputm.
LV_END_TIME = wa_qave-vezeiterf.
LV_END_DATE = wa_qave-vdatum.
IF LV_START_DATE IS NOT INITIAL.
IF LV_END_DATE IS NOT INITIAL.
CALL FUNCTION 'SD_CALC_DURATION_FROM_DATETIME'
EXPORTING
i_date1 = LV_START_DATE
i_time1 = LV_START_TIME
i_date2 = LV_END_DATE
i_time2 = LV_END_TIME
IMPORTING
E_TDIFF = LV_DIFF
E_DATE2_EARLY = E_DATE2_EARLY
EXCEPTIONS
INVALID_DATETIME = 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.
eNDFORM.}
This is my code unable to merge the to tabs position is on 3rd and 4th.
need help ......
thanks,Hi,
From Your code I saw that you called Macro of fieldcat after Calling the ALV Function Did You Check That One.
Following links may be useful for you ,
ALV report: How to merge 2 columns into 1 column?
Hope this information helps You
Regards,
Raghava Channooru -
How to controle the output of a key figure based on an attribute
As part of following up on a select range of materials during their launch period a report is needed, where the key figures are controlled by a specific attribute.
The attribute is called End Launch Control Date and it holds the specific day where the product goes from launch to replenishment. When the product goes into repleneshment it is no longer relevant to follow up on.
The follow up list contains around 80 materials (SKU's) and the challenge is that they have different End Launch Control Dates.
So, I would like to design a report that does the following:
1) When drill on material, the key figures only show values before the End Launch Control Date for the specific material. After this date, the key figure should state either zero or blank cells.
2) The key figures should not be controlled by a specific date in the prompt, because the End Launch Control date is different for each material.
Does anyone have experience in constructing this functionality?Hi,
you could maybe do this with using formula variables and and IF statement in the keyfigure you want to be blank after a certain date
basically you want/need to compare a date (which date would that be, one in the columns or smth?) with the end launch control date and if this date is bigger then this leave KF 0.
so you need to create a formula using two formula variables (of type replacement path and being replaced by the 2 dates) and compare these two in the formula. Then you use the outcome of this (which should be 0 or 1) in a new formula with the keyfigure (statement true * KF ) + (statement false * KF). This will give a value when comparison is ok and 0 when it is not ok.
This description might be not complete and bit short but I dont have the time to fully look it up, please let me know if you didnt understand the idea behind it.
Regards
C. -
How to remove the mandatory field setting in output control
Hi everybody,
While printing a Payment Voucher through F-58 and FBZ5(reprint), there are two output devices, the first one is - printer for forms and second is - payment advice printer.
In our case we have configured the cheque printing and payment voucher printing seperately. The cheque goes to first printer(kept mandatory field) and the payment voucher goes to second printer. One of our plant does not print the cheque from SAP, they only print the payment voucher because the cheque is manually prepared. How do I avoid the cheque printing. Is there any way out to print only the payment voucher through F-58 and FBZ5
Please guide me how to tackle it or how to remove the mandatory field setting in the output control screen?
Regards
PaulHi
As of my understanding, there is no relation ship between the Sales Organization and this mandatory partner function.
Here are few suggestions.
1. Since Partner functions are defualted and made mandatory in the Partner Determination Procedure so you have to remove this Mandatory option for PE from the Partner Determination Procedure that is AG if using standard one.
2. If you are using a single partner function than , Copy and create a New partner procedure and a new account group . Where in one you can default PE as mandatory and in another one you make a optional where it can be choosen manually while creating the customer.
Follow the path to check for entries :
SPRO > sales & distribution > Basic Function > Partner Determination > set up partner determination > select for customer master > select the partner procedure you are using AG as standard > then partner function in procedure > here maintian the check as required like, Mandatory or No check for Non Mandatory .
Thanks
RB -
How to find the selected item in alv grid or table control
can any one tell me please
how to find the selected item in alv grid or table controlIn table control, If you goto screen painter and goto table control properties ( f2 ), there is one check-box w/selColumn check that and give column name. Then add that column to your internal table.
IN PAI
LOOP AT it_tkhdr.
FIELD it_tkhdr-sel_row
MODULE tab_tkhdr_mark ON REQUEST.
ENDLOOP.
MODULE tab_tkhdr_mark INPUT.
MODIFY it_tkhdr INDEX tc_tkhdr-current_line.
ENDMODULE. " tab_tkhdr_mark INPUT
here it_TKHDR is internal table sel_row is field for selection
After that, you can loop at it_tkhdr where sel_row is 'X' to get selected rows.
regards,
Gagan -
How to call a screen /t-code by double clicking on the output of an alv?
Hi,
I want to call a screen / t-code on double clicking on the output of an alv report.
Suppose we click on a value in the "Pur Req" feild of the ALV output it should open the the transaction code and give us the details of that particular value. How can I do that?
Thanx in advance..If you displaying ALV using Classes..( CL_GUI_ALV_GRID)... You need to create event receiver and register the double click event handler method dynamically.... Here's the sample code...
* C L A S S E S *
class lcl_event_receiver definition.
public section.
methods: handle_double_click
for event double_click
of cl_gui_alv_grid
importing e_row e_column.
endclass.
* CLASS lcl_event_receiver IMPLEMENTATION
class lcl_event_receiver implementation.
method handle_double_click.
data: l_cc like line of gt_cc.
data:
g_row type i,
g_value(10),
g_col type i,
g_row_id type lvc_s_row,
g_col_id type lvc_s_col,
g_row_no type lvc_s_roid.
* Read the double click cell
call method gr_grid->get_current_cell
importing
e_row = g_row
e_value = g_value
e_col = g_col
es_row_id = g_row_id
es_col_id = g_col_id
es_row_no = g_row_no.
clear wa_itab
read table gt_itab index g_row_id into wa_itab.
case g_col_id.
when 'EBELN'. "Show Process Order
if not wa_itab-ebeln is initial.
set parameter id 'BES' field wa_cc-ebeln.
call transaction 'ME22N' and skip first screen.
endif.
call method gr_grid->set_table_for_first_display
exporting
i_consistency_check = g_consistency_check
it_toolbar_excluding = gt_exclude
is_variant = gs_variant
i_save = g_save
i_default = 'X'
is_layout = g_layout
changing it_outtab = gt_cc[]
it_fieldcatalog = gt_fieldcat[]
it_sort = gt_sortcat[].
create object event_receiver.
* Register the 'Double Click' event handler method dynamically.
set handler event_receiver->handle_double_click for gr_grid. -
How to get a minus sign with the cost field in ALV.
Hi ,
How to get a minus sign with the cost field in ALV.
The Ouput will be displayed like Rs -1500 instead of 1500-
I can't use concatenate also as i may have to use the sum functionality of ALV .
Cheers
SunnyHi sunny,
1. The OTHER FIELD
has to be character field of say length 15.
2. Write the original numeric value to
this character field (in a loop)
3. But simply writing won't help.
4. use this kind of logic.
5.
REPORT abc.
DATA : m TYPE i.
DATA : chr(15) TYPE c.
m = -100.
WRITE m TO chr.
IF m < 0.
SHIFT chr RIGHT BY 1 PLACES.
CONDENSE chr.
CONCATENATE '-' chr INTO chr.
ENDIF.
WRITE chr.
regards,
amit m. -
How to control the number of fields in the Advanced mode in af:query
Hi,
How to control the number of fields in the Advanced mode in <af:query>?
Say i have 20 fields in my table and i created a view criteria with 2 fields. It would work perfectly in Basic mode. But in the Advanced mode all other fields selection is possible on clicking the ADD Fields button. I did not want the client to make a search with all 20 fields. Only 10 fields are to be listed in the Advanced Mode even though there are 20 fields in my table.
How do i control the list of fields in ADDFields button?
Any ideas?
KRYou can uncheck the Querable property of the attributes which you need not show up in the Advanced Mode (but they will not show up in other modes too !) or programatically set the same as mentioned here -
http://adfcodebits.blogspot.com/2010/11/bit-27-setting-view-object-attributes.htmlAlso you can hide the AddFields button as suggested here - http://www.notjustjava.com/2011/12/cool-tips-to-showhide-components-of-the-query-control-of-adf/ -
Hi gurur's how we do the interactive report in ALV
hi gurur's how we do the interactive report in ALV.
PLZ HELP MEHi Srivasu,
I will send a sample code along with Comments check it once ok.copy the below code and execute it and debug it ok..
*& Report YPURCHASEORDER_ALV_LISTDISP *
*& DEVELOPER : KIRAN KUMAR.G *
& PURPOSE : CREATING A PURCHASE ORDER BASED ON PURCHASE DOC NUMBER
*& CREATION DT: 22/11/2007 *
*& REQUEST : ERPK900035 *
REPORT YPURCHASEORDER_ALV_LISTDISP.
Tables
TABLES : ekko, "Purchasing Document Header
ekpo. "Purchasing Document Item
Type pools
TYPE-POOLS: slis.
Internal Tables
DATA: BEGIN OF gt_headerdat OCCURS 0,
ebeln LIKE ekko-ebeln, " Purchasing Document Number
bukrs LIKE ekko-bukrs, " Company Code
bstyp LIKE ekko-bstyp, " Purchasing Document Category
bsart LIKE ekko-bsart, " Purchasing Document LIKE
aedat LIKE ekko-aedat, " Date on which the recordwascreate
ernam LIKE ekko-ernam, " Name of Person who Created Object
lifnr LIKE ekko-lifnr, " Vendor's account number
spras LIKE ekko-spras, " Language Key
ekorg LIKE ekko-ekorg, " Purchasing Organization
ekgrp LIKE ekko-ekgrp, " Purchasing group
END OF gt_headerdat.
DATA: BEGIN OF gt_item OCCURS 0,
matnr LIKE ekpo-matnr, "Material Number
werks LIKE ekpo-werks, "Plant
lgort LIKE ekpo-lgort, "Storage location
matkl LIKE ekpo-matkl, "Material group
menge LIKE ekpo-menge, "Purchase order quantity
meins LIKE ekpo-meins, "Order unit
netpr LIKE ekpo-netpr, "Net price in purchasing document
kunnr LIKE ekpo-kunnr, "Customer Number 1
END OF gt_item.
Global Structures
DATA: gt_header TYPE slis_t_listheader, "For Headings
wa_header TYPE slis_listheader,
gt_fieldcat TYPE slis_t_fieldcat_alv, "Structure Defintion
wa_fieldcat TYPE slis_fieldcat_alv,
gt_fieldcat1 TYPE slis_t_fieldcat_alv,
wa_fieldcat1 TYPE slis_fieldcat_alv,
wa_layout TYPE slis_layout_alv, "Layout
gt_events TYPE slis_t_event, "For Events
wa_events TYPE slis_alv_event.
Selection Screen
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_ebeln FOR ekko-ebeln.
SELECTION-SCREEN: END OF BLOCK b1.
Initialization
INITIALIZATION.
PERFORM initial.
Fetch Data
START-OF-SELECTION.
PERFORM fetch_data.
END-OF-SELECTION.
Bulid fieldcatalog
PERFORM fieldcat.
Change fieldcatalog
PERFORM fieldcat_change.
Events Triggering
PERFORM place_events.
Layout.
PERFORM layout.
Display Data
SORT gt_headerdat BY ebeln.
PERFORM display_list.
*& Form initial
text
--> p1 text
<-- p2 text
FORM initial .
s_ebeln-sign = 'I'.
s_ebeln-option = 'BT'.
s_ebeln-low = '3000000090'.
s_ebeln-high = '3000000166'.
APPEND s_ebeln.
ENDFORM. " initial
*& Form fetch_data
text
--> p1 text
<-- p2 text
FORM fetch_data .
REFRESH gt_headerdat. "Clear the Body of Internal Table
CLEAR gt_headerdat. "Clear Header Line
SELECT ebeln
bukrs
bstyp
bsart
aedat
ernam
lifnr
spras
ekorg
ekgrp
FROM ekko
INTO TABLE gt_headerdat
WHERE ebeln IN s_ebeln.
ENDFORM. " fetch_data
*& Form display_list
text
--> p1 text
<-- p2 text
FORM display_list .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-cprog
I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = 'USERCOMMAND'
I_STRUCTURE_NAME =
is_layout = wa_layout
it_fieldcat = gt_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = gt_events
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = gt_headerdat
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_list
*& Form place_events
text
--> p1 text
<-- p2 text
FORM place_events .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = gt_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.
CLEAR wa_events. "Clear Header Line
READ TABLE gt_events INTO wa_events WITH KEY name = 'TOP_OF_PAGE'.
IF sy-subrc = 0.
wa_events-form = 'HEADING'.
MODIFY gt_events FROM wa_events INDEX sy-tabix.
ENDIF.
CLEAR wa_events. "Clear Header Line
READ TABLE gt_events INTO wa_events WITH KEY name = 'END_OF_LIST'.
IF sy-subrc = 0.
wa_events-form = 'PAGEDOWN'.
MODIFY gt_events FROM wa_events INDEX sy-tabix.
ENDIF.
CLEAR wa_events. "Clear Header Line
READ TABLE gt_events INTO wa_events WITH KEY name = 'USER_COMMAND'.
IF sy-subrc = 0.
wa_events-form = 'USERCOMMAND'.
MODIFY gt_events FROM wa_events INDEX sy-tabix.
ENDIF.
ENDFORM. " place_events
*& Form layout
text
--> p1 text
<-- p2 text
FORM layout .
CLEAR wa_layout. "Clear Header Line
wa_layout-zebra = 'X'. "Zebra Lines in the Output
wa_layout-colwidth_optimize = 'X'. "Optimize the Column Width
ENDFORM. " layout
*& Form heading
text
FORM heading.
WRITE:/6 'THIS REPORT DISPLAYS THE PURCHASE ORDER DETAILS'.
WRITE:/6 'CLICK ON PURCHASE DOC NO FIELD(INTERACTIVE LIST)'.
ENDFORM. "heading
*& Form fieldcat
text
--> p1 text
<-- p2 text
FORM fieldcat .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = SY-CPROG
i_internal_tabname = 'GT_HEADERDAT'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = SY-CPROG
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = gt_fieldcat
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. " fieldcat
*& Form fieldcat_change
text
--> p1 text
<-- p2 text
FORM fieldcat_change .
LOOP AT gt_fieldcat INTO wa_fieldcat.
CASE wa_fieldcat-fieldname.
WHEN 'EBELN'.
wa_fieldcat-hotspot = 'X'.
ENDCASE.
MODIFY gt_fieldcat FROM wa_fieldcat INDEX sy-tabix.
ENDLOOP.
ENDFORM. " fieldcat_change
*& Form pagedown
text
FORM pagedown.
WRITE:/35 'HAVE A NICE DAY...' COLOR 4.
ENDFORM. "pagedown
*& Form usercommand
text
-->UCOMM text
-->SELFIELD text
FORM usercommand USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
READ TABLE gt_headerdat INDEX selfield-tabindex.
CASE selfield-sel_tab_field.
WHEN 'GT_HEADERDAT-EBELN'.
REFRESH : gt_item.
CLEAR : gt_item.
SELECT matnr
werks
lgort
matkl
menge
meins
netpr
kunnr
FROM ekpo
INTO TABLE gt_item
WHERE ekpo~ebeln EQ gt_headerdat-ebeln.
*Build a Field Catalog
PERFORM fieldcat1.
*For Heading in the Interactive List
PERFORM heading1.
*Display Interactive Data
PERFORM display_data1.
ENDCASE.
ENDFORM. "usercommand
*& Form fieldcat1
text
--> p1 text
<-- p2 text
FORM fieldcat1 .
REFRESH : gt_fieldcat1.
CLEAR : wa_fieldcat1.
wa_fieldcat1-col_pos = '1'. "Column Postion
wa_fieldcat1-fieldname = 'MATNR'. "Field Name
wa_fieldcat1-tabname = 'GT_ITEM'. "Internal Table
wa_fieldcat1-key = 'X'. "Blue Color
wa_fieldcat1-seltext_l = 'MATERIAL NO'. "Display Text Screen
APPEND wa_fieldcat1 TO gt_fieldcat1.
CLEAR wa_fieldcat1.
wa_fieldcat1-col_pos = '2'. "Column Postion
wa_fieldcat1-fieldname = 'WERKS'. "Field Name
wa_fieldcat1-tabname = 'GT_ITEM'. "Internal Table
wa_fieldcat1-seltext_l = 'PLANT'. "Display Text Screen
APPEND wa_fieldcat1 TO gt_fieldcat1.
CLEAR wa_fieldcat1.
wa_fieldcat1-col_pos = '3'. "Column Postion
wa_fieldcat1-fieldname = 'LGORT'. "Field Name
wa_fieldcat1-tabname = 'GT_ITEM'. "Internal Table
wa_fieldcat1-seltext_l = 'STORAGE LOCATION'."Display Text Screen
APPEND wa_fieldcat1 TO gt_fieldcat1.
CLEAR wa_fieldcat1.
wa_fieldcat1-col_pos = '4'. "Column Postion
wa_fieldcat1-fieldname = 'MATKL'. "Field Name
wa_fieldcat1-tabname = 'GT_ITEM'. "Internal Table
wa_fieldcat1-seltext_l = 'MATERIAL GRP'. "Display Text Screen
APPEND wa_fieldcat1 TO gt_fieldcat1.
CLEAR wa_fieldcat1.
wa_fieldcat1-col_pos = '5'. "Column Postion
wa_fieldcat1-fieldname = 'MENGE'. "Field Name
wa_fieldcat1-tabname = 'GT_ITEM'. "Internal TAble
wa_fieldcat1-seltext_l = 'PO QUANTITY'. "Display Text Screen
APPEND wa_fieldcat1 TO gt_fieldcat1.
CLEAR wa_fieldcat1.
wa_fieldcat1-col_pos = '6'. "Column Pos tion
wa_fieldcat1-fieldname = 'MEINS'. "Field Name
wa_fieldcat1-tabname = 'GT_ITEM'. "Internal TAble
wa_fieldcat1-seltext_l = 'BASE UNIT MEASURE'."Display Text Screen
APPEND wa_fieldcat1 TO gt_fieldcat1.
CLEAR wa_fieldcat1.
wa_fieldcat1-col_pos = '7'. "Column Postion
wa_fieldcat1-fieldname = 'NETPR'. "Field Name
wa_fieldcat1-tabname = 'GT_ITEM'. "Internal Table
wa_fieldcat1-seltext_l = 'NET PRICE'. "Display Text Screen
APPEND wa_fieldcat1 TO gt_fieldcat1.
CLEAR wa_fieldcat1.
wa_fieldcat1-col_pos = '8'. "Column Postion
wa_fieldcat1-fieldname = 'KUNNR'. "Field Name
wa_fieldcat1-tabname = 'GT_ITEM'. "Internal Table
wa_fieldcat1-seltext_l = 'CUSTOMER NO'. "Display Text Screen
APPEND wa_fieldcat1 TO gt_fieldcat1.
CLEAR wa_fieldcat1.
ENDFORM. " fieldcat1
*& Form heading1
text
--> p1 text
<-- p2 text
FORM heading1 .
REFRESH : gt_header.
CLEAR : wa_header.
wa_header-typ = 'H'.
wa_header-info = 'THIS IS AN INTERACTIVE LIST'.
APPEND wa_header TO gt_header.
ENDFORM. " heading1
*& Form top
text
FORM top.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_header
I_LOGO =
I_END_OF_LIST_GRID =
ENDFORM. "top
*& Form display_data1
text
--> p1 text
<-- p2 text
FORM display_data1 .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = SY-CPROG
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
i_callback_top_of_page = 'TOP'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
it_fieldcat = gt_fieldcat1
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = gt_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. " display_data1
Reward points if helpful.
Kiran Kumar.G.A
Have a Nice Day.. -
How to get the actual data in ALV report
I am doing some upgradation work in that i am using Submit & And return and also i am using some function modules like LIST FROM MEMORY , LIST TO TXT wnd WRITE LIST , it gives output in normal list format , But i need to print in ALV report .
With the use of set table for 1st display i got the ALV report but not with actual data, (some junk value is showing) , So can any 1 suggest me how to get the actual data in ALV report, With the use of Any Function Module or with Coding,
with regards,Hi Saravana
I am sure you must be getting the values in tables of table parameters from every FM.
consolidate the values from tables of all FMs in one table and built ALV for that table only.
I hope this way you can show the actual data in ALV.
thanks
Lalit
Maybe you are looking for
-
Amount of key presses a user makes over time - BPM
Hi, Im working on a small program that needs to get the amount of keypresses a user makes over time. Basically its for calcuating the BPM a user is inputting. So a uers taps a beat for 5 seconds and the amount of tap is saved and multiplied by 12 to
-
How to add header and footer image in pdf
Hi, I want to add image in header and footer for the pdf generation. how I can add this? Following my xsl ?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org
-
Why the text field frame's line width cannot be adjusted?
I am now working on a PDF file with some text fields with combo turned on, specifying the number of chars the fields can hold. Their frames' line width is not thick. This is what I want. This is shown in the picture below: But when I try to preview t
-
II need to use Java 6 to run a web application because it isnt compatible with java 7 update 7. is this possible?
-
Is there a way to add/change the modifier keys?
Hi I would like to have the smooth tool be a modifier key like it used to be. aaah the old days. anyway I'm sure I'm not the only one. Thanks!