Issue regarding ALV report
Hi all,
I've created an ALV report which is having a editable checkbox box field and some more fields that are not editable.
My requirement is that when i check any checkbox, some of the fields in that particular row should become editable.
In table control it can be done easily but can it be done in ALV.
Note: I have created the ALV through container as it was required.
Thanks in Advance.
Regards
Dheeraj
Hi,
Basically you will have to first register the data change event after you display the grid as follows:-
CALL METHOD y_lobj_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>MC_EVT_MODIFIED
EXCEPTIONS
error = 1
OTHERS = 2.
Here Y_LOBJ_GRID is my grid object of type CL_GUI_ALV_GRID.
Then you will have to set a handler method for this.
SET HANDLER y_obj_evt_handler->y_m_handle_cell_modified
FOR Y_LOBJ_GRID.
Here y_obj_evt_handler is a local class in your program and y_m_handle_cell_modified is the method of that class.
In this method you can change the fields to make then editable or non editable.
Regards,
Ankur Parab
Similar Messages
-
Dear All,
I have an issue in ALV reporting. Pls look at the follow table.
<u>Duty Post</u> <u>Date</u> <u>Time</u>
jurong 12/06 3.45
jurong 13/06 3.50
jurong 14/06 4.50
In the above table jurong is repeated. I do not want jurong to be repeated but other fields should be present.
Kindly help me solve it.
Regards,
Karthikeyan
<u></u><u></u>Hi Karthik,
Another way of handling this without doing if else comparision is using the SORT functionality.
I am giving an example here:
Sort data in the output based on Duty_Post
CLEAR itab_sort.
itab_sort-fieldname = 'DUTY_POST' . (Replace DUTY_POST with the actual field name used in ur report)
itab_sort-up = c_x.
APPEND itab_sort.
CLEAR itab_sort.
Then while calling the ALV FM: include the ITAB_SORT table also.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_call_back_pgm
i_grid_title = w_text
it_fieldcat = itab_fldcat
it_sort = itab_sort[]
is_layout = w_layout
it_events = itab_events[]
i_default = 'X'
i_save = 'A'
IMPORTING
e_exit_caused_by_caller = w_exit_by_caller
es_exit_caused_by_user = w_exit_by_user
TABLES
t_outtab = itab_output_gr
EXCEPTIONS
program_error = 1
OTHERS = 2.
This way data would not repeat.
Hope this helps.
Rgds,
HR -
Hi,
I have a issue in ALV Report for displaying one field's data into output.
I am getting data into all other fields in ALV Report except for this field.
This field & related fields are declared as below: in final internal table.
sta_no TYPE z3status,
status(10) TYPE c,
Here z3status is of type Char(1).
In Report
I have put a condition :
IF i_tab-sta_no EQ 1.
i_tab-status = 'Created'.
ELSE.
i_tab-status = 'Closed'.
ENDIF.
and to field catalog also i am passing right information as for every other field in ALV Report.
Till the point use of REUSE_ALV_LIST_DISPLAY F.M also final internal table is having status field filled.
But in output nothing gets displayed for Status field.
Can anybody tell me what can be the issue!
Thanks in advance.
Thanks,
Deep.Hi,
I have no problem in data fetching into final internal table.
Everything is coming well to REUSE_ALV_DISPLAY F.M.
But still Status field data is not getting displayed.
I have posted some code for reference:
LOOP AT t_z3manboxid INTO wa_z3manboxid.
wa_result-manifest_no = wa_z3manboxid-zmanno.
wa_result-item_no = wa_z3manboxid-item_no.
IF l_item_no NE wa_z3manboxid-item_no.
wa_result-piece_quantity = wa_z3manboxid-vemng.
wa_result-unit = wa_z3manboxid-vemeh.
wa_result-manifester = wa_z3manboxid-usnam.
wa_result-manifest_sta_no = wa_z3manboxid-z3status.
IF wa_result-manifest_sta_no EQ 1.
wa_result-manifest_status = c_created.
ELSEIF wa_result-manifest_sta_no EQ 2.
wa_result-manifest_status = c_in_transit.
ELSEIF wa_result-manifest_sta_no EQ 3.
wa_result-manifest_status = c_arrived.
ELSEIF wa_result-manifest_sta_no EQ 4.
wa_result-manifest_status = c_closed.
ENDIF.
ENDIF.
l_item_no = wa_z3manboxid-item_no.
APPEND wa_result TO t_result.
CLEAR: wa_result, wa_z3manboxid.
ENDLOOP.
Building field catalog following code is added:
For status call is as below:
PERFORM f_build_fieldcat USING c_tab
c_manifest_status
c_space
c_space
c_mannf_status
c_space1
15.
FORM f_build_fieldcat USING p_tabname p_fldname
p_rtabname p_rfldname
p_fldhdg p_check
p_length.
CLEAR t_fieldcat_ln1.
ADD 1 TO g_col_pos.
t_fieldcat_ln1-tabname = p_tabname.
t_fieldcat_ln1-fieldname = p_fldname.
t_fieldcat_ln1-ref_tabname = p_rtabname.
t_fieldcat_ln1-ref_fieldname = p_rfldname.
t_fieldcat_ln1-ddictxt = c_l.
t_fieldcat_ln1-seltext_l = p_fldhdg.
t_fieldcat_ln1-no_zero = space.
t_fieldcat_ln1-do_sum = space.
t_fieldcat_ln1-col_pos = g_col_pos.
t_fieldcat_ln1-no_out = space.
t_fieldcat_ln1-just = c_c.
t_fieldcat_ln1-qfieldname = space.
t_fieldcat_ln1-checkbox = p_check.
t_fieldcat_ln1-input = p_check.
t_fieldcat_ln1-reptext_ddic = p_fldhdg.
IF p_fldname EQ c_manno.
t_fieldcat_ln1-key = c_x.
t_fieldcat_ln1-hotspot = c_x.
ELSE.
t_fieldcat_ln1-key = space.
t_fieldcat_ln1-hotspot = p_check.
ENDIF.
t_fieldcat_ln1-outputlen = p_length.
t_fieldcat_ln1-intlen = p_length.
t_fieldcat_ln1-ddic_outputlen = p_length.
APPEND t_fieldcat_ln1 TO t_fieldcat1.
ENDFORM. " f_build_fieldcat
FORM f_build_sortcat USING p_fldname.
CLEAR t_sortcat_ln1.
ADD 1 TO g_col_pos.
t_sortcat_ln1-spos = g_col_pos.
t_sortcat_ln1-fieldname = p_fldname.
t_sortcat_ln1-up = c_x.
t_sortcat_ln1-down = space.
t_sortcat_ln1-subtot = c_x.
APPEND t_sortcat_ln1 TO t_sortcat1.
ENDFORM. " f_build_sortcat
FORM f_build_layout.
t_layout1-zebra = c_x.
t_layout1-no_vline = c_space1.
t_layout1-reprep = c_x.
t_layout1-detail_popup = c_x.
t_layout1-window_titlebar = text-005.
t_layout1-no_scrolling = c_space1.
t_layout1-detail_titlebar = text-005.
t_layout1-numc_sum = c_x.
t_layout1-get_selinfos = c_x.
t_layout1-min_linesize = 132.
ENDFORM. " f_build_layout
DATA: l_pgm TYPE syrepid,
l_exit(1) TYPE c.
CLEAR: l_pgm,
l_exit.
l_pgm = sy-repid.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = l_pgm
i_callback_user_command = c_user_command
is_layout = t_layout1
it_fieldcat = t_fieldcat1
i_save = c_a
it_events = t_eventcat1
IMPORTING
e_exit_caused_by_caller = l_exit
TABLES
t_outtab = t_result
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
l_exit = l_exit.
ENDIF.
To ALV F.M t_result table is updated with correct data.
But it is not getting displayed.
What can be the reason!
Can anybody give the solution!
Thanks for your replies.
Thanks,
Deep. -
Help needed regarding ALV report
Hi,
I have a query regarding ALV report.
The requirement is as follows:-
When the user executes the ALV report and if he sums one numeric field column values and filters out some of the field columns ( for example there r 5 columns in the report and the user has filtered out 2 of them and viewing only 3 columns)
and now the requirements is that when the user runs the report later he should see the modified report ( i mean only 3 cloumns and the total value of the column which he has made) but not the original output which was there when the report was developed.
First of all i wanna know is it possible to do r not. If yes then how
Hope u have got what i want.
eagerly waiting for ur reply.
regards,
maqsoodHi
Yes you can! You have to manage the layout variant.
So when you call your ALV you have to set the parameter I_SAVE = 'A'.
In this way you'll allow the user to save the variants for layout.
After you has to have a chance to choose the variant in selection-screen.
See the demo program BCALV_GRID_11 to manage the variant in selection-screen.
Max -
Data Displaying issue in ALV report
Hi,
I have made a ALV report, the presetn display layout is as below
it is displaying the material shortage reprot against issued production order
ORDER NO. Order Qty. MATERIAL TOTAL QTY SHORTAGE QTY
3000000 100 610 100 5
3000000 100 101 200 43
3000000 100 8795 400 400
3000000 100 456 100 67
3000001 50 548 50 33
3000004 62 710 62 3
3000005 15 7895 15 15
3000020 11 456 22 10
now the user requirement is the report should come as per below formate
AT EACH NEW ORDER NUMBER :
****************first display main order no. and order qty.
ORDER NO. Order Qty
3000000 100
************************then below this display the indiviual material and qty.
MATERIAL TOTAL QTY SHORTAGE QTY
610 100 5
101 200 43
8795 400 400
456 100 67
*******again at new order******
ORDER NO. Order Qty
3000001 50
**********then below display the items
MATERIAL TOTAL QTY SHORTAGE QTY
548 50 33
how to do this is there any output layout with this i can get this formate in LAV report
regards,
zafarHi Zafar,
You can populate your internal table as per the requirement.
at new order only.
itab-Order = 3000000 .
itab-Order quantity = 100.
append itab
for all materials for that order
itab-MATERIAL = 610 .
itab-TOTAL QTY = 100 .
itab-SHORTAGE QTY = 5.
append itab.
Cheers,
Suhail -
HI all,
I have developed an ALV Report. In the ALV display, i would like to sum see the Sum (Total) of few fields like Qty, Net value etc when i select that particular column and click the 'SUM" icon.
In my Report when i do so, the Program is displaying Runtime Error.
How to resolve this issue?
Any idea?
Regards
PavanYou must make sure that these columns are defined correctly in the field catalog and in the internal table. For example, make sure that the quantity field is typed as such in the internal table.
data: begin of itab occurs 0,
qty type p decimals 2,
end of itab.
And then in your field catalog, make sure that the DATATYPE is set correctly.
ls_fcat-datatype = 'QUAN'.
Do this may help your situation. Also make sure that the data in these columns is all numeric.
Regards,
Rich Heilman -
Field Length issue in ALV Report
Hi,
I am using FM REUSE_ALV_GRID_DISPLAY to display few fields. Among them I have a field with length 200 characters text.
During ALV report display I am able to see only 128 characters, But when I download it and see the field, the it is showing complete text.
Can anybody help me out?
Thanks,
RamakrishnaCheck out the last answer of this post.
Re: ALV Grid Display - 255 characters
<i>I found a SAP document called "Using ALV for list display.pdf" that says the following:
"Size of data fields: While the list-based ALVList can display only tables of up to 90 columns, the control-based ALVGrid and ALVFullscreen have the limitation of 128 characters per data cell."</i>
Please make sure to award point for helpful answers and mark the post as solved. Thanks.
Regards,
Rich HEilman -
Hi experts 1 query regarding alv report running in background
when i run my alv report with 40 columns in background in spool when i get output disturbed 20 lines of first row is moving to second row so when i download to excel the o/p is completely disturbed and no use for me is there any way to solve this problem.please reply
hi ,
this will solve your problem
http://www.****************/Tutorials/ALV/Spool/width.htm
Increasing the width of the spool when using ALV List
By Aafaque Husain, YASH Technologies
Whenever an ALV report (with more number of columns) is scheduled in background, the output will be displayed in a zigzag fashion as shown below:
If we try to download the output from the spool or try to view the output, then we observe that the output is not in an appropriate fashion.
To get the right format of output in the spool we generally increase the u201Cno. of columns fieldu201D in the Format typesu201D. Have a look at the following screenshot:
Sometimes even when we change this field, we get the output truncated at the end, like last few columns are not displayed. There is certain limitation for this field, so that even if increase this value again, we find no change in the output display in spool.
This value is effective only when we check the check box u201CNumber of columns from list display formatu201D in the SPAD transaction.
Ø GO to SPAD Transaction code
Ø In the menu Settings -> Spool System as shown belowu2026
Ø In the others tab check the first check box in the Output Controller block, SAVE and exit.
Now Schedule the ALV report again by providing the output device and format, and then we get the full output in the spool as shown below:
Regards,
Madhavi -
Urgent: regarding ALV report display problem
hi,
There are 3 problems:-
1.) I had made a ALV report in which i have to display 'POSTING DATE' (iseg-budat) when we execute the report i.e. it should be displayed as PERIOD :- _______ to _______ on alv report ..
2.)the 2nd problem is dat when i use the ' wa_fieldcat-no_zero = 'X'. It eliminates all the leading zeros which are present which is okay when i it displays material no.. but the problem is dat it also deletes the other fields where the values are to be zeros.
i had used this FM:-
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = ITS1-MATNR
IMPORTING
OUTPUT = ITS1-MATNR.
so that only matnr field are to be 0's.
3.) I want to delete the rows which use to contain the values 0's as there are no calculations are performing as these are displayed .
ANYbody having solution of this problem ,plzzzz provide the soluion of it as it is most urgent to me and dat person will definately rewarded.
regards,
ric.shi kiran,
thanks for ur response. here is d code which i am using it and plzz help me to figure out where i have to make changes:-
REPORT ZTEST03.
TABLES: ISEG,MARA.
TYPE-POOLS : SLIS.
INTERNAL TABLE FOR INVENTORY STOCK *****************
DATA: BEGIN OF ITS1 OCCURS 0,
MATNR LIKE ISEG-MATNR,
MEINS LIKE ISEG-MEINS,
MENGE LIKE ISEG-MENGE,
WRTZL LIKE ISEG-WRTZL,
BUCHM LIKE ISEG-BUCHM,
WRTBM LIKE ISEG-WRTBM,
WERKS LIKE ISEG-WERKS,
BUDAT LIKE ISEG-BUDAT,
MTART LIKE MARA-MTART,
ITEMDESC LIKE MAKT-MAKTX,
DIFFQTY LIKE ISEG-BUCHM,
DIFFVALUE LIKE ISEG-WRTBM,
END OF ITS1.
data: t_heading type slis_t_listheader.
SELECTION-SCREEN BEGIN OF BLOCK PAR1 WITH FRAME TITLE TEXT-001.
*********PARAMETERS*********
PARAMETERS : PLANT LIKE ISEG-WERKS OBLIGATORY.
*********SELECTION SCREEN OPTIONS*********
SELECT-OPTIONS : R_DATE FOR ISEG-BUDAT,
M_TYPE FOR MARA-MTART,
IT_M FOR MARA-MATNR.
*********DEFINING VARIABLES*********
SELECTION-SCREEN END OF BLOCK par1.
TOP-OF-PAGE.
PERFORM PG_HEADER.
START-OF-SELECTION.
SELECT DISTINCT A~MATNR A~MEINS A~MENGE A~WRTZL A~BUCHM A~WRTBM A~WERKS A~BUDAT B~MTART
FROM ISEG AS A INNER JOIN MARA AS B ON B~MATNR = A~MATNR
INTO CORRESPONDING FIELDS OF TABLE ITS1 WHERE B~MATNR = A~MATNR AND B~MEINS = A~MEINS AND A~WERKS = PLANT AND A~BUDAT IN R_DATE AND B~MTART IN M_TYPE AND B~MATNR IN IT_M.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = ITS1-MATNR
IMPORTING
OUTPUT = ITS1-MATNR.
SORT ITS1 BY MATNR.
DELETE ADJACENT DUPLICATES FROM ITS1 WHERE MENGE = 0 AND BUCHM = 0.
LOOP AT ITS1.
ITS1-DIFFQTY = ITS1-MENGE - ITS1-BUCHM.
ITS1-DIFFVALUE = ITS1-WRTZL - ITS1-WRTBM.
SELECT SINGLE MAKTX FROM MAKT INTO ITS1-ITEMDESC WHERE MATNR = ITS1-MATNR.
MODIFY ITS1.
ENDLOOP.
PERFORM PRN_SMSTOCK_ALV.
WRITING DATA FROM D TABLES**********
FORM PG_HEADER.
WRITE : 'PHYSICAL INVENTORY AUDIT REPORT PLANT : ', PLANT.
ENDFORM.
*& Form PRN_SMSTOCK_ALV
text
--> p1 text
<-- p2 text
form PRN_SMSTOCK_ALV .
data: w_title type lvc_title,
w_repid type syrepid,
w_comm type slis_formname,
w_status type slis_formname,
x_layout type slis_layout_alv,
t_event type slis_t_event,
t_fieldcat type slis_t_fieldcat_alv,
t_sort type slis_t_sortinfo_alv.
refresh t_fieldcat.
refresh t_event.
refresh t_sort.
clear x_layout.
clear w_title.
perform set_fieldcat2 using:
1 'MTART' 'MTART' 'MARA' '15' space 'MATERIAL TYPE' space space space space space space space space SPACE t_fieldcat 'L' 'C',
2 'MATNR' 'MATNR' 'MARA' '13' space 'MATERIAL NO. ' space space space space space space space space SPACE t_fieldcat 'R' 'C',
3 'ITEMDESC' 'MAKTX' 'MAKT' '25' space 'MATERIAL DESCRIPTION' space space space space space space space space SPACE t_fieldcat 'L' 'C',
4 'MEINS' 'MEINS' 'MARA' '5' space 'UOM' space space space space space space space space SPACE t_fieldcat 'C' 'C',
5 'MENGE' 'MENGE' 'ISEG' '13' space 'ORG.INV.QTY' space space space space space space space space SPACE t_fieldcat 'R' 'C',
6 'WRTZL' 'WRTZL' 'ISEG' '13' space 'ORG.INV.VALUE' space space space space space space space space SPACE t_fieldcat 'R' 'C',
7 'BUCHM' 'BUCHM' 'ISEG' '13' space 'PHY.INV.QTY' space space space space space space space space SPACE t_fieldcat 'R' 'C',
8 'WRTBM' 'WRTBM' 'ISEG' '13' space 'PHY.INV.VALUE' space space space space space space space space SPACE t_fieldcat 'R' 'C',
9 'DIFFQTY' 'MENGE' 'ISEG' '13' space 'DIFF.INV.QTY' space space space space space space space space SPACE t_fieldcat 'R' 'C',
10 'DIFFVALUE' 'WRTZL' 'ISEG' '13' space 'DIFF.INV.VALUE' space space space space space space space space SPACE t_fieldcat SPACE 'P'.
x_layout-zebra = 'X'.
perform set_top_page_heading using t_heading t_event.
perform set_events using t_event.
w_status = ''.
w_repid = sy-repid.
w_comm = 'USER_COMMAND'.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = w_repid
it_fieldcat = t_fieldcat
i_Callback_top_of_page = 'Top-of-page'
is_layout = x_layout
it_sort = t_sort
i_callback_pf_status_set = w_status
i_callback_user_command = w_comm
i_save = 'X'
it_events = t_event
i_grid_title = w_title
tables
t_outtab = ITS1
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 set_fieldcat2 USING
p_colpos p_fieldname p_ref_fieldname p_ref_tabname
p_outputlen p_noout
p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt
p_hotspot p_showasicon p_checkbox p_edit
p_dosum
t_fieldcat TYPE slis_t_fieldcat_alv
P_JUST
P_FTYPE.
DATA: wa_fieldcat TYPE slis_fieldcat_alv.
CLEAR wa_fieldcat.
General settings
wa_fieldcat-fieldname = p_fieldname.
wa_fieldcat-no_zero = 'X'.
wa_fieldcat-col_pos = p_colpos.
wa_fieldcat-no_out = p_noout.
wa_fieldcat-hotspot = p_hotspot.
wa_fieldcat-checkbox = p_checkbox.
wa_fieldcat-icon = p_showasicon.
wa_fieldcat-do_sum = p_dosum.
Set output length.
IF NOT p_outputlen IS INITIAL.
wa_fieldcat-outputlen = p_outputlen.
ENDIF.
Set text headers.
IF NOT p_seltext_m IS INITIAL.
wa_fieldcat-seltext_m = p_seltext_m.
ENDIF.
IF NOT p_seltext_l IS INITIAL.
wa_fieldcat-seltext_l = p_seltext_l.
ENDIF.
IF NOT p_seltext_s IS INITIAL.
wa_fieldcat-seltext_s = p_seltext_s.
ENDIF.
IF NOT p_reptext_ddic IS INITIAL.
wa_fieldcat-reptext_ddic = p_reptext_ddic.
ENDIF.
IF NOT p_ddictxt IS INITIAL.
wa_fieldcat-ddictxt = p_ddictxt.
ENDIF.
IF NOT P_JUST IS INITIAL.
WA_FIELDCAT-JUST = P_JUST.
ENDIF.
Set as editable or not.
IF NOT p_edit IS INITIAL.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
ENDIF.
APPEND wa_fieldcat TO t_fieldcat.
ENDFORM. "set_fieldcat2
======================== Subroutines called by ALV ================
*& Form top_of_page
Called on top_of_page ALV event.
Prints the heading.
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_heading.
ENDFORM.
form set_top_page_heading using t_heading type slis_t_listheader
t_events type slis_t_event.
data: x_heading type slis_listheader,
x_event type line of slis_t_event.
Report title
clear t_heading[].
clear x_heading.
x_heading-typ = 'H'.
x_heading-info = 'PHYSICAL INVENTORY AUDIT REPORT'.
append x_heading to t_heading.
Plant Name
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'PLANT: '.
x_heading-info = its1-werks.
append x_heading to t_heading.
Posting Date
*clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'POSTING DATE: '.
x_heading-info = ITS1-BUDAT.
append x_heading to t_heading.
Control Date
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'CONTROL No: '.
x_heading-info = its1-werks.
append x_heading to t_heading.
Control date
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'CONTROL DATE: '.
x_heading-info = its1-werks.
append x_heading to t_heading.
User who is running the report
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'User: '.
x_heading-info = sy-uname.
append x_heading to t_heading.
Date of execution
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Date: '.
write sy-datum to x_heading-info.
append x_heading to t_heading.
Time of execution
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Time: '.
write sy-uzeit to x_heading-info.
append x_heading to t_heading.
Top of page event
x_event-name = slis_ev_top_of_page.
x_event-form = 'TOP_OF_PAGE'.
append x_event to t_events.
endform.
form set_events using t_events type slis_t_event.
data: x_event type line of slis_t_event.
endform.
plzzz help me out as it is most urgent to me.
regards,
ric.s -
i need to develop alv report which displays po and corresponding invoice receipt information.
what all fields can i include in invoice receipt information.please help on this.thanks in advance.credit will be given.Hi,
Check the following link:
http://www.sapbrain.com/TUTORIALS/TECHNICAL/ALV_tutorial.html
http://www.sapbrain.com/ARTICLES/TECHNICAL/ABAP/company%20logo%20in%20the%20top%20of%20alv%20report.html
Regards,
Bhaskar -
Hi to all
I am preparing a ALV report.
In which I want to display the values which are entered on selection screen.
On the selection screen these are the fields :
s_werks for pa0001-werks
s_orgeh for pa0001-orgeh
I am successful to capture one value (s_orgeh-low) but if multiple values are selected then how to display.
Plz guide me...Hi,
try like this..in the belwo code first FM captures the selection screen fields and the second function mdoule dispalys them in the output.
DATA :
Internal table for Selection screen parameters
i_seltable TYPE STANDARD TABLE OF rsparams.
*& Form get_selection_screen
Subroutine to get the user selection on selection screen
FORM get_selection_screen .
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = sy-repid
TABLES
selection_table = i_seltable
EXCEPTIONS
not_found = 01
no_report = 02.
IF sy-subrc NE 0.
REFRESH i_seltable.
ENDIF.
ENDFORM. " get_selection_screen
*& Form display_selection_criteria
Subroutine to display the selction criteria in the output
FORM display_selection_criteria .
CALL FUNCTION 'RS_LIST_SELECTION_TABLE'
EXPORTING
report = sy-repid
seltext = c_x
newpage = space
TABLES
sel_tab = i_seltable
EXCEPTIONS
sel_tab_empty = 1
OTHERS = 2.
IF sy-subrc <> 0.
REFRESH i_seltable.
ENDIF.
ENDFORM. " display_selection_criteria
Regards,
Nagaraj -
Regarding ALV Reporting in ABAP
Hi All,
I have some clarifications related to <b>ALV Reporting</b> in ABAP.
<b>Actually i have to create ALV report with Structure Length/Each record length is around 300 characters.</b>
Is it possible to create a ALV Report with <b>300</b> length for each record!
If possible which is the best<b>[ALV]</b> method for the same!
Can anybody give me the solution!
Thanks in advance.
Thanks & Regards,
Prasad.Hai Prasad
Check with the code
*& Report ZALV_PRAKASH_SAMP *
REPORT ZALV_PRAKASH_SAMP .
TABLES: MARA.
TYPE-POOLS : SLIS.
Data declaration
DATA: BEGIN OF I_MARA OCCURS 0.
INCLUDE STRUCTURE MARA.
DATA: END OF I_MARA.
DATA: V_REPID LIKE SY-REPID.
selection-screen
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.
PARAMETERS: P_MTART LIKE MARA-MTART DEFAULT 'ROH'.
SELECTION-SCREEN END OF BLOCK B1.
initialisation
INITIALIZATION.
S_MATNR-LOW = '1400'.
S_MATNR-HIGH = '1500'.
APPEND S_MATNR.
V_REPID = SY-REPID.
start-of-selection
START-OF-SELECTION.
SELECT * FROM MARA
INTO TABLE I_MARA
WHERE MATNR IN S_MATNR AND
MTART = P_MTART.
CHECK SY-SUBRC = 0.
end of selection
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = 'MARA'
IS_LAYOUT =
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_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 = I_MARA
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at i_mara.
write:/ i_mara.
endloop.
Thanks & Regards
Sreenivasulu P -
An issue in ALV reports.
Hi,
I am new to ALV reporting. I have one doubt. When I am declaring the internal table as
itab type standard table of stucture.
and then using merge catalog and reuse list disp FM it is not showing any output.
I want to know why is this happening?
Experts please help me out.Hai Abir
Go through the following Code
*& Report ZALV_BLOCK *
REPORT ZALV_BLOCK NO STANDARD PAGE HEADING
LINE-SIZE 150
LINE-COUNT 60(4)
MESSAGE-ID Z00.
*..Type Definitions for ALV Report
TYPE-POOLS SLIS.
*..Includes
*for ICONs
*INCLUDE <ICON>.
Table/Structure declarations. *
TABLES: MARA,
MARC,
T134.
Types Declaration *
TYPES: BEGIN OF typ_mara,
MATNR TYPE MARA-MATNR,
MTART TYPE MARA-MTART,
MATKL TYPE MARA-MATKL,
MEINS TYPE MARA-MEINS,
NTGEW TYPE MARA-NTGEW,
END OF typ_mara.
TYPES: BEGIN OF typ_marc,
WERKS TYPE MARC-WERKS,
LADGR TYPE MARC-LADGR,
MTVFP TYPE MARC-MTVFP,
DISPR TYPE MARC-DISPR,
DISMM TYPE MARC-DISMM,
DISPO TYPE MARC-DISPO,
END OF typ_marc.
Intrnal tables Declaration *
DATA: it_mara TYPE STANDARD TABLE OF typ_mara WITH HEADER LINE.
DATA: it_marc TYPE STANDARD TABLE OF typ_marc WITH HEADER LINE.
ALV Type declaration *
DATA:V_NO_DATA TYPE C.
ALV Type declaration *
DATA:V_REPID TYPE SYREPID.
DATA: IT_FIELDCATALOG_MARA TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCATALOG_MARA TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCATALOG_MARC TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCATALOG_MARC TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCATALOG_MATKL TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCATALOG_MATKL TYPE SLIS_FIELDCAT_ALV,
WA_LAYOUT TYPE SLIS_LAYOUT_ALV,
IT_EVENTS TYPE SLIS_T_EVENT,
WA_EVENTS TYPE SLIS_ALV_EVENT,
WA_KEYINFO TYPE SLIS_KEYINFO_ALV.
Selection Screen. *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-H01.
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR ,
S_MTART FOR MARA-MTART .
SELECTION-SCREEN END OF BLOCK B1.
Event:Initialization *
INITIALIZATION.
*Report Name
V_REPID = SY-REPID.
AT Selection Screen. *
AT SELECTION-SCREEN.
Event: Start-of-Selection *
START-OF-SELECTION.
PERFORM FETCH_DATA.
Event: End-of-Selection *
END-OF-SELECTION.
IF V_NO_DATA = ''.
MESSAGE I010 WITH 'NO DATA TO DISPLAY ! '.
EXIT.
ELSE.
PERFORM FILL_FIELDCAT_MARA.
PERFORM FILL_FIELDCAT_MAKT.
PERFORM FILL_FIELDCAT_MARC.
PERFORM FILL_LAYOUT.
PERFORM CALL_ALV_INIT.
PERFORM ADD_LISTS.
PERFORM DISPLAY_BLOCK_LIST.
ENDIF.
FORM DEFINITIONS *
*& Form FETCH_DATA
text
--> p1 text
<-- p2 text
FORM FETCH_DATA.
SELECT MATNR
MTART
MATKL
MEINS
NTGEW
INTO CORRESPONDING FIELDS OF TABLE IT_MARA
FROM MARA
WHERE MATNR IN S_MATNR
AND MTART IN S_MTART.
IF SY-SUBRC <> 0.
V_NO_DATA = ''.
ELSE.
V_NO_DATA = 'X'.
SELECT WERKS
LADGR
MTVFP
DISPR
DISMM
DISPO
INTO CORRESPONDING FIELDS OF TABLE IT_MARC
FROM MARC
WHERE MATNR IN S_MATNR.
ENDIF.
ENDFORM. " FETCH_DATA
*& Form FILL_FIELDCAT_MARA
text
--> p1 text
<-- p2 text
FORM FILL_FIELDCAT_MARA.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = V_REPID
I_INTERNAL_TABNAME =
I_STRUCTURE_NAME = 'IT_MARA'
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = V_REPID
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = IT_FIELDCATALOG_MARA
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.
LOOP AT IT_FIELDCATALOG_MARA INTO WA_FIELDCATALOG_MARA.
CASE WA_FIELDCATALOG_MARA-FIELDNAME.
WHEN 'MATNR'.
WA_FIELDCATALOG_MARA-COL_POS = '1'.
WA_FIELDCATALOG_MARA-OUTPUTLEN = '15'.
WA_FIELDCATALOG_MARA-SELTEXT_L = 'Material NO'.
WHEN 'MTART'.
WA_FIELDCATALOG_MARA-COL_POS = '2'.
WA_FIELDCATALOG_MARA-OUTPUTLEN = '15'.
WA_FIELDCATALOG_MARA-SELTEXT_L = 'Mat Type'.
WHEN 'MATKL'.
WA_FIELDCATALOG_MARA-COL_POS = '3'.
WA_FIELDCATALOG_MARA-OUTPUTLEN = '15'.
WA_FIELDCATALOG_MARA-SELTEXT_L = 'Mat Group'.
WHEN 'MEINS'.
WA_FIELDCATALOG_MARA-COL_POS = '4'.
WA_FIELDCATALOG_MARA-OUTPUTLEN = '15'.
WA_FIELDCATALOG_MARA-SELTEXT_L = 'Measure Unit'.
WHEN 'NTGEW'.
WA_FIELDCATALOG_MARA-COL_POS = '5'.
WA_FIELDCATALOG_MARA-OUTPUTLEN = '15'.
WA_FIELDCATALOG_MARA-SELTEXT_L = 'Net Wt'.
WA_FIELDCATALOG_MARA-DO_SUM = 'X'.
ENDCASE.
MODIFY IT_FIELDCATALOG_MARA FROM WA_FIELDCATALOG_MARA INDEX SY-TABIX.
ENDLOOP.
ENDFORM. " FILL_FIELDCAT_MARA
*& Form FILL_FIELDCAT_MARC
text
--> p1 text
<-- p2 text
FORM FILL_FIELDCAT_MARC.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = V_REPID
I_INTERNAL_TABNAME = 'IT_MARC'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = V_REPID
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = IT_FIELDCATALOG_MARC
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.
LOOP AT IT_FIELDCATALOG_MARC INTO WA_FIELDCATALOG_MARC.
CASE WA_FIELDCATALOG_MARC-FIELDNAME.
WHEN 'WERKS'.
WA_FIELDCATALOG_MARC-COL_POS = '1'.
WA_FIELDCATALOG_MARC-OUTPUTLEN = '15'.
WA_FIELDCATALOG_MARC-SELTEXT_L = 'PLANT NAME'.
WHEN 'LADGR'.
WA_FIELDCATALOG_MARC-COL_POS = '2'.
WA_FIELDCATALOG_MARC-OUTPUTLEN = '15'.
WA_FIELDCATALOG_MARC-SELTEXT_L = 'Loading Group'.
WHEN 'MTVFP'.
WA_FIELDCATALOG_MARC-COL_POS = '3'.
WA_FIELDCATALOG_MARC-OUTPUTLEN = '20'.
WA_FIELDCATALOG_MARC-SELTEXT_L = 'Checking group'.
WHEN 'DISPR'.
WA_FIELDCATALOG_MARC-COL_POS = '4'.
WA_FIELDCATALOG_MARC-OUTPUTLEN = '15'.
WA_FIELDCATALOG_MARC-SELTEXT_L = 'MRP PROFILE'.
WHEN 'DISMM'.
WA_FIELDCATALOG_MARC-COL_POS = '5'.
WA_FIELDCATALOG_MARC-OUTPUTLEN = '15'.
WA_FIELDCATALOG_MARC-SELTEXT_L = 'MRP TYPE'.
WHEN 'DISPO'.
WA_FIELDCATALOG_MARC-COL_POS = '6'.
WA_FIELDCATALOG_MARC-OUTPUTLEN = '15'.
WA_FIELDCATALOG_MARC-SELTEXT_L = 'MRP CONTROLLER'.
ENDCASE.
MODIFY IT_FIELDCATALOG_MARC FROM WA_FIELDCATALOG_MARC INDEX SY-TABIX.
ENDLOOP.
ENDFORM. " FILL_FIELDCAT_MARC
*& Form FILL_FIELDCAT_MAKT
text
--> p1 text
<-- p2 text
FORM FILL_FIELDCAT_MAKT.
ENDFORM. " FILL_FIELDCAT_MAKT
*& Form CALL_ALV_INIT
text
--> p1 text
<-- p2 text
FORM CALL_ALV_INIT.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
IT_EXCLUDING =
ENDFORM. " CALL_ALV_INIT
*& Form ADD_LISTS
text
--> p1 text
<-- p2 text
FORM ADD_LISTS.
*ADD IT_MARA TABLE TO THE OUTPUT
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCATALOG_MARA
I_TABNAME = 'IT_MARA'
IT_EVENTS = IT_EVENTS
IT_SORT =
I_TEXT = ' '
TABLES
T_OUTTAB = IT_MARA
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.
**ADD IT_MARC TABLE TO THE OUTPUT
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCATALOG_MARC
I_TABNAME = 'IT_MARC'
IT_EVENTS = IT_EVENTS
IT_SORT =
I_TEXT = ' '
TABLES
T_OUTTAB = IT_MARC
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.
ENDFORM. " ADD_LISTS
*& Form FILL_LAYOUT
text
--> p1 text
<-- p2 text
FORM FILL_LAYOUT.
WA_LAYOUT-ZEBRA = 'X'.
WA_LAYOUT-TOTALS_TEXT = 'TOTAL'.
ENDFORM. " FILL_LAYOUT
*& Form DISPLAY_BLOCK_LIST
text
--> p1 text
<-- p2 text
FORM DISPLAY_BLOCK_LIST.
WA_KEYINFO-HEADER01 = 'MATNR'.
WA_KEYINFO-ITEM01 = 'MATNR'.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
IS_PRINT =
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_BLOCK_LIST .
Thanks & regards
Sreenivasulu P -
Reg : Print Issue in ALV Report
Hi Experts,
I have created an ALV Report for USER Requirement and it is working fine. While taking printout the SORTED Field is not working, it gets repeated in the Print... How to rectify..?hi,
did u use SORT-UP equal to 'X'?
wa_sort-up = c_x.
ags. -
Regarding ALV report to output in excel
How to do ALV report to output in excel format?
*& DATA DECLARATION *
TABLES: MARA, "GENERAL MASTER DATA
MARC, "PLANT DATA FOR MATERIAL
MARD, "STORAGE LOCATION DATA FOR MATERIAL
MBEW, "MATERIAL VALUATION
MVKE, "SALES DATA FOR MATERIAL
MAKT, "MATERIAL DESCRIPTION
EKKO, "PURCHASING DOCUMENT HEADER
EKPO, "PURCHASING DOCUMENT ITEM
VBAK, "SALES DOCUMENT HEADER DATA
VBAP. "SALES DOCUMENT ITEM DATA
TYPE-POOLS : SLIS.
DATA: VT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
V_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
V_LAYOUT TYPE SLIS_LAYOUT_ALV,
BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
BEGIN OF I_MARA OCCURS 0,
MATNR LIKE MARA-MATNR, "MATERIAL NUMBER
MBRSH LIKE MARA-MBRSH, "INDUSTRY SECTOR
MEINS LIKE MARA-MEINS, "BASE UNIT OF MEASURE
MATKL LIKE MARA-MATKL, "MATERIAL GROUP
END OF I_MARA,
BEGIN OF I_MARC OCCURS 0,
MATNR LIKE MARC-MATNR, "MATERIAL NUMBER
WERKS LIKE MARC-WERKS, "PLANT
LVORM LIKE MARC-LVORM, "FLAG MATERIAL FOR DELETION AT PLANT
"LEVEL
DISPO LIKE MARC-DISPO, "MRP CONTROLLER
END OF I_MARC,
BEGIN OF I_MAKT OCCURS 0,
MATNR LIKE MAKT-MATNR, "MATERIAL NUMBER
MAKTX LIKE MAKT-MAKTX, "MATERIAL DESCRIPTION
SPRAS LIKE MAKT-SPRAS, "LANGUAGE KEY
END OF I_MAKT,
BEGIN OF I_MVKE OCCURS 0,
MATNR LIKE MVKE-MATNR, "MATERIAL NUMBER
VKORG LIKE MVKE-VKORG, "SALES ORGANIZATION
VTWEG LIKE MVKE-VTWEG, "DISTRIBUTION CHANNEL
END OF I_MVKE,
BEGIN OF I_MARD OCCURS 0,
MATNR LIKE MARD-MATNR, "MATERIAL NUMBER
LGORT LIKE MARD-LGORT, "STORAGE LOCATION
LABST LIKE MARD-LABST, "VALUATED STOCK WITH UNRESTRICTED USE
END OF I_MARD,
BEGIN OF I_EKPO OCCURS 0,
EBELN LIKE EKPO-EBELN, "PURCHASING DOCUMENT NUMBER
EBELP LIKE EKPO-EBELP, "ITEM NUMBER OF PURCHASING DOCUMENT
MATNR LIKE EKPO-MATNR, "MATERIAL NUMBER
END OF I_EKPO,
BEGIN OF I_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN, "SALES DOCUMENT
POSNR LIKE VBAP-POSNR, "SALES DOCUMENT ITEM
MATNR LIKE VBAP-MATNR, "MATERIAL NUMBER
END OF I_VBAP,
BEGIN OF I_OUT OCCURS 0,
MATNR LIKE MARC-MATNR,
WERKS LIKE MARC-WERKS,
LVORM LIKE MARC-LVORM,
DISPO LIKE MARC-DISPO,
MBRSH LIKE MARA-MBRSH,
MEINS LIKE MARA-MEINS,
MATKL LIKE MARA-MATKL,
VKORG LIKE MVKE-VKORG,
VTWEG LIKE MVKE-VTWEG,
SPRAS LIKE MAKT-SPRAS,
MAKTX LIKE MAKT-MAKTX,
LGORT LIKE MARD-LGORT,
LABST LIKE MARD-LABST,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
END OF I_OUT,
BEGIN OF I_HEADING OCCURS 0,
TEXT1(20),
TEXT2(20),
TEXT3(20),
TEXT4(20),
TEXT5(20),
TEXT6(20),
TEXT7(20),
TEXT8(20),
TEXT9(20),
TEXT10(20),
TEXT11(40),
TEXT12(20),
TEXT13(20),
TEXT14(20),
TEXT15(20),
TEXT16(20),
TEXT17(20),
END OF I_HEADING.
*& S E L E C T I O N - S C R E E N *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-100.
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR. "OBLIGATORY.
PARAMETERS: P_WERKS LIKE MARC-WERKS. "OBLIGATORY.
SELECT-OPTIONS: S_LGORT FOR MARD-LGORT,
S_DISPO FOR MARC-DISPO,
S_EBELN FOR EKPO-EBELN .
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-101.
PARAMETERS : RB1 RADIOBUTTON GROUP G1,
RB2 RADIOBUTTON GROUP G1,
RB3 RADIOBUTTON GROUP G1.
SELECTION-SCREEN END OF BLOCK B2.
*& S T A R T - O F - S E L E C T I O N *
START-OF-SELECTION.
SELECT MATNR WERKS LVORM DISPO FROM MARC
INTO CORRESPONDING FIELDS OF TABLE I_MARC
WHERE MATNR IN S_MATNR
AND DISPO IN S_DISPO
AND WERKS = P_WERKS.
IF I_MARC[] IS INITIAL.
WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MARC'.
EXIT.
ENDIF.
PERFORM PURCHASEDATA_VALIDATION.
PERFORM SALESDATA_VALIDATION.
SELECT MATNR LGORT LABST FROM MARD INTO TABLE I_MARD
FOR ALL ENTRIES IN I_MARC
WHERE MATNR = I_MARC-MATNR
AND WERKS EQ P_WERKS
AND LGORT IN S_LGORT.
IF I_MARD[] IS INITIAL.
WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MARD'.
EXIT.
ENDIF.
SELECT MATNR VKORG VTWEG FROM MVKE INTO TABLE I_MVKE
FOR ALL ENTRIES IN I_MARC
WHERE MATNR = I_MARC-MATNR.
IF I_MVKE[] IS INITIAL.
WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MVKE'.
EXIT.
ENDIF.
LOOP AT I_MARC.
MOVE-CORRESPONDING I_MARC TO I_OUT.
CLEAR MARC.
SELECT SINGLE MATNR MBRSH MEINS MATKL FROM MARA
INTO CORRESPONDING FIELDS OF MARA
WHERE MATNR = I_OUT-MATNR.
IF SY-SUBRC = 0.
MOVE: MARA-MBRSH TO I_OUT-MBRSH,
MARA-MEINS TO I_OUT-MEINS,
MARA-MATKL TO I_OUT-MATKL.
ELSE.
CONTINUE.
ENDIF.
SELECT SINGLE MATNR MAKTX SPRAS FROM MAKT
INTO CORRESPONDING FIELDS OF MAKT
WHERE MATNR = I_OUT-MATNR.
IF SY-SUBRC = 0.
MOVE: MAKT-MAKTX TO I_OUT-MAKTX,
MAKT-SPRAS TO I_OUT-SPRAS.
ELSE.
CONTINUE.
ENDIF.
LOOP AT I_EKPO WHERE MATNR = I_MARC-MATNR.
MOVE: I_EKPO-EBELN TO I_OUT-EBELN,
I_EKPO-EBELP TO I_OUT-EBELP.
ENDLOOP.
LOOP AT I_VBAP WHERE MATNR = I_MARC-MATNR.
MOVE: I_VBAP-VBELN TO I_OUT-VBELN,
I_VBAP-POSNR TO I_OUT-POSNR.
ENDLOOP.
LOOP AT I_MARD WHERE MATNR = I_MARC-MATNR.
MOVE: I_MARD-LABST TO I_OUT-LABST,
I_MARD-LGORT TO I_OUT-LGORT.
ENDLOOP.
LOOP AT I_MVKE WHERE MATNR = I_MARC-MATNR.
MOVE: I_MVKE-VKORG TO I_OUT-VKORG,
I_MVKE-VTWEG TO I_OUT-VTWEG.
APPEND I_OUT.
ENDLOOP.
CLEAR I_OUT.
ENDLOOP.
PERFORM OPTIONS.
FORM OPTIONS *
FORM OPTIONS.
IF RB2 = 'X'.
PERFORM FIELDCAT.
PERFORM OUTPUT.
ELSE.
IF RB1 = 'X'.
PERFORM HEADINGS.
PERFORM DLOAD.
ELSE.
IF RB3 = 'X'.
PERFORM HEADINGS.
PERFORM DLOAD.
PERFORM FIELDCAT.
PERFORM OUTPUT.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. "OPTIONS
FORM HEADINGS *
FORM HEADINGS.
I_HEADING-TEXT1 = 'MATNR'.
I_HEADING-TEXT2 = 'WERKS'.
I_HEADING-TEXT3 = 'LVORM'.
I_HEADING-TEXT4 = 'DISPO'.
I_HEADING-TEXT5 = 'MBRSH'.
I_HEADING-TEXT6 = 'MEINS'.
I_HEADING-TEXT7 = 'MATKL'.
I_HEADING-TEXT8 = 'VKORG'.
I_HEADING-TEXT9 = 'VTWEG'.
I_HEADING-TEXT10 = 'SPRAS'.
I_HEADING-TEXT11 = 'MAKTX'.
I_HEADING-TEXT12 = 'LGORT'.
I_HEADING-TEXT13 = 'LABST'.
I_HEADING-TEXT14 = 'EBELN'.
I_HEADING-TEXT15 = 'EBELP'.
I_HEADING-TEXT16 = 'VBELN'.
I_HEADING-TEXT17 = 'POSNR'.
APPEND I_HEADING.
ENDFORM. "HEADINGS
FORM DLOAD *
FORM DLOAD.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\MATSTK.XLS'
FILETYPE = 'DAT'
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = I_HEADING
EXCEPTIONS
FILE_WRITE_ERROR = 1.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\MATSTK.XLS'
FILETYPE = 'DAT'
APPEND = 'X'
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = I_OUT.
ENDFORM. "DLOAD
FORM FIELDCAT *
FORM FIELDCAT.
V_FIELDCAT-COL_POS = '1'.
V_FIELDCAT-FIELDNAME = 'MATNR'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-HOTSPOT = 'X'.
V_FIELDCAT-REF_FIELDNAME = 'MATNR'.
V_FIELDCAT-REF_TABNAME = 'MARC'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '2'.
V_FIELDCAT-FIELDNAME = 'WERKS'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'WERKS'.
V_FIELDCAT-REF_TABNAME = 'MARC'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '3'.
V_FIELDCAT-FIELDNAME = 'LVORM'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'LVORM'.
V_FIELDCAT-REF_TABNAME = 'MARC'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '4'.
V_FIELDCAT-FIELDNAME = 'DISPO'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'DISPO'.
V_FIELDCAT-REF_TABNAME = 'MARC'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '5'.
V_FIELDCAT-FIELDNAME = 'MBRSH'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'MBRSH'.
V_FIELDCAT-REF_TABNAME = 'MARA'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '6'.
V_FIELDCAT-FIELDNAME = 'MEINS'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'MEINS'.
V_FIELDCAT-REF_TABNAME = 'MARA'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '7'.
V_FIELDCAT-FIELDNAME = 'MATKL'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'MATKL'.
V_FIELDCAT-REF_TABNAME = 'MARA'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '8'.
V_FIELDCAT-FIELDNAME = 'VKORG'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'VKORG'.
V_FIELDCAT-REF_TABNAME = 'MVKE'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '9'.
V_FIELDCAT-FIELDNAME = 'VTWEG'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'VTWEG'.
V_FIELDCAT-REF_TABNAME = 'MVKE'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '10'.
V_FIELDCAT-FIELDNAME = 'SPRAS'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'SPRAS'.
V_FIELDCAT-REF_TABNAME = 'MAKT'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '11'.
V_FIELDCAT-FIELDNAME = 'MAKTX'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'MAKTX'.
V_FIELDCAT-REF_TABNAME = 'MAKT'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '12'.
V_FIELDCAT-FIELDNAME = 'LGORT'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'LGORT'.
V_FIELDCAT-REF_TABNAME = 'MARD'.
V_FIELDCAT-SELTEXT_L = 'STRG LOCT'.
V_FIELDCAT-OUTPUTLEN = 10.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '13'.
V_FIELDCAT-FIELDNAME = 'LABST'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-SELTEXT_M = 'STOCK'.
V_FIELDCAT-OUTPUTLEN = 15.
V_FIELDCAT-REF_FIELDNAME = 'LABST'.
V_FIELDCAT-REF_TABNAME = 'MARD'.
V_FIELDCAT-DO_SUM = 'X'.
V_LAYOUT-TOTALS_TEXT = 'TOTAL STOCK:'.
V_FIELDCAT-HOTSPOT = 'X'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '14'.
V_FIELDCAT-FIELDNAME = 'EBELN'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-HOTSPOT = 'X'.
V_FIELDCAT-REF_FIELDNAME = 'EBELN'.
V_FIELDCAT-REF_TABNAME = 'EKPO'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '15'.
V_FIELDCAT-FIELDNAME = 'EBELP'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'EBELP'.
V_FIELDCAT-REF_TABNAME = 'EKPO'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '16'.
V_FIELDCAT-FIELDNAME = 'VBELN'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-HOTSPOT = 'X'.
V_FIELDCAT-REF_FIELDNAME = 'VBELN'.
V_FIELDCAT-REF_TABNAME = 'VBAP'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '17'.
V_FIELDCAT-FIELDNAME = 'POSNR'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'POSNR'.
V_FIELDCAT-REF_TABNAME = 'VBAP'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
ENDFORM. "FIELDCAT
FORM OUTPUT *
FORM OUTPUT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
I_GRID_TITLE = 'CLICK ON MATERIAL/PURDOC/SALESDOC FOR DETAILS'
I_CALLBACK_USER_COMMAND = 'DISPLAYDETAILS'
IS_LAYOUT = V_LAYOUT
IT_FIELDCAT = VT_FIELDCAT1
TABLES
T_OUTTAB = I_OUT.
IF SY-SUBRC 0.
ENDIF.
ENDFORM. "OUTPUT
FORM TOP-OF-PAGE *
FORM TOP-OF-PAGE.
DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
WA_HEADER TYPE SLIS_LISTHEADER.
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = 'REPORT FOR : '.
APPEND WA_HEADER TO T_HEADER.
CLEAR WA_HEADER.
WA_HEADER-TYP = 'S'.
WA_HEADER-INFO = 'MATERIAL DETAILS'.
APPEND WA_HEADER TO T_HEADER.
CLEAR WA_HEADER.
WA_HEADER-TYP = 'S'.
WA_HEADER-INFO = 'PURCHASE ORDER DETAILS'.
APPEND WA_HEADER TO T_HEADER.
CLEAR WA_HEADER.
WA_HEADER-TYP = 'S'.
WA_HEADER-INFO = 'SALES ORDER DETAILS'.
APPEND WA_HEADER TO T_HEADER.
CLEAR WA_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
I_LOGO = 'GEAR'
IT_LIST_COMMENTARY = T_HEADER.
ENDFORM. "TOP-OF-PAGE
*& FORM PURCHASEDATA_VALIDATION *
FORM PURCHASEDATA_VALIDATION.
SELECT EBELN EBELP MATNR
FROM EKPO
INTO TABLE I_EKPO
FOR ALL ENTRIES IN I_MARC
WHERE MATNR = I_MARC-MATNR
AND EBELN IN S_EBELN
AND WERKS EQ P_WERKS.
IF I_EKPO[] IS INITIAL.
WRITE:/ 'NO MATCHING DATA IS SELECTED FROM TABLE EKPO'.
EXIT.
ENDIF.
DATA: T_EKPO LIKE I_EKPO OCCURS 0 WITH HEADER LINE.
T_EKPO] = I_EKPO[.
REFRESH I_EKPO.
FREE I_EKPO.
LOOP AT T_EKPO.
SELECT SINGLE EBELN FROM EKKO INTO EKPO-EBELN
WHERE EBELN = T_EKPO-EBELN.
IF SY-SUBRC = 0.
MOVE-CORRESPONDING T_EKPO TO I_EKPO.
APPEND I_EKPO.
CLEAR I_EKPO.
ELSE.
CONTINUE.
ENDIF.
ENDLOOP.
SORT I_EKPO.
ENDFORM. "PURCHASEDATA_VALIDATION
*& FORM SALESDATA_VALIDATION *
FORM SALESDATA_VALIDATION.
SELECT VBELN POSNR MATNR
FROM VBAP
INTO CORRESPONDING FIELDS OF TABLE
I_VBAP FOR ALL ENTRIES IN I_MARC
WHERE MATNR = I_MARC-MATNR.
DATA: T_VBAP LIKE I_VBAP OCCURS 0 WITH HEADER LINE.
T_VBAP] = I_VBAP[.
REFRESH I_VBAP.
FREE I_VBAP.
LOOP AT T_VBAP.
SELECT SINGLE VBELN FROM VBAK INTO VBAK-VBELN
WHERE VBELN = T_VBAP-VBELN.
IF SY-SUBRC = 0.
MOVE-CORRESPONDING T_VBAP TO I_VBAP.
APPEND I_VBAP.
CLEAR I_VBAP.
ELSE.
CONTINUE.
ENDIF.
ENDLOOP.
SORT I_VBAP.
ENDFORM. "SALESDATA_VALIDATION
Maybe you are looking for
-
I am trying to retrieve what was on a lost Ipad. I THOUGHT when I signed into APple it would just BE there. All my photos, program apps installed and etc but apparently there were not compatible - one was a 6.1.0 and the other was 6.1.2. Soooo, I
-
How to View the Actual Remaining Budget for Earmarked Fund?
Hi All, First of all, pardon if my questions below are very basic, I'm an ABAPer trying to gasp the big FI process. Background: I created a project definition then allocate a budget via CJ30. I created WBS Element then allocate a budget again. I cre
-
The link to the labview VIs for the HP 35670A is no longer valid and the search for the same returns nothing. Does anyone have the Labview VIs for that instrument? The last post was back in 2004(see below) The instrument driver for the HP 35670A is
-
Display number of messages in mailboxes?
I know that Mail will display the number of unread messages next to the mailbox/folder name and that you can see how many messages are in a mailbox/folder by choosing that mailbox/folder and looking at the title bar... ...but how do you display the n
-
Security settings for specific pages
I originally posted this question in the eBooks forum and was told this might be a better location for an answer. So, if you have seen it there please disregard. Question: I am developing a line of publications for our company and they want them to b