How to achieve alv output headers in middle
Hi I have a requirement about displaying headings using alv . I am using reuse_alv_commentary_write FM but i can able to display headings it start from the first colomn . But I require some text should display in the middle and some should start from begin of the line and some text end of the line.
Ex: in Header data required as
ABCD Company
from the losangles to in
date
user
time
plant openbal
above is my header format and below i am displaying values
field1 field2 field3 field4 so on.
My requirement is how i kept text in the middle and end .
Hey,
Check this URL [http://sapprograms.blogspot.com/2008/11/header-to-alv-report.html]
Raul Natu
Similar Messages
-
How to send ALV output data into Excel sheet format via Mail to the user?
Hi friends,
I have a doubt ie,
How to send ALV output data into Excel sheet format via Mail to the user?
regards
MoosaHi,
Provide the output internal table to the objbin in the below FM
Send Message
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = i_docdata
put_in_outbox = c_x
TABLES
packing_list = i_objpack
object_header = i_objhead
contents_bin = i_objbin
contents_txt = i_objtxt
receivers = i_reclist
and specify the document type
i_objpack-doc_type = 'XLS'.
and try.
Regards,
Nandha -
How To Send ALV Output By Email.
Hi !
I wanted to ask how to send ALV output of report by email.
I know that i have to use the fms :
1. 'WWW_HTML_FROM_LISTOBJECT' - in order to convert the table to HTML.
2. 'SO_NEW_DOCUMENT_ATT_SEND_API1' - in order to send the HTML file.
My problem is how to convert the ALV screen output to the apropriate table parameter of the function 'WWW_HTML_FROM_LISTOBJECT' to listobject type ?
thanks
mosheHi look at the following program.
*& Report ZSM17_EMAIL1
REPORT zsm17_email.
tables : mara.
data: begin of it_mara occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
mtart like mara-mtart,
matkl like mara-matkl,
end of it_mara.
data: begin of it_final occurs 0,
v_string(255),
end of it_final.
*DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
DATA: objpack LIKE sopcklsti1 OCCURS 0 with header line,
objhead LIKE solisti1 OCCURS 0 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
data: wa_objbin like line of objbin.
DATA: doc_chng LIKE sodocchgi1.
DATA: tab_lines LIKE sy-tabix.
select-options s_matnr for mara-matnr.
*--- Selecting data from mara
select matnr
ernam
mtart
matkl
into table it_mara
from mara
where matnr in s_matnr.
if sy-subrc ne 0.
write:/ 'no data found'.
exit.
else.
loop at it_mara.
concatenate it_mara-matnr
it_mara-ernam
it_mara-mtart
it_mara-matkl
into it_final-v_string separated by '~'.
append it_final.
clear it_final.
endloop.
endif.
Creating the document to be sent
doc_chng-obj_name = 'TEST'. "name of the document
title of document or subject
doc_chng-obj_descr = 'Test Email program'.
body of the mail
objtxt = 'A test report'.
APPEND objtxt.
objtxt = 'is enclosed as an attachment.'.
APPEND objtxt.
*clear objtxt.
DESCRIBE TABLE objtxt LINES tab_lines.
Size of SAPoffice Document (for API1)
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
Creating the entry for the compressed attachment
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'.
*objpack-obj_name = 'ATTACHMENT'.
*objpack-obj_descr = 'Test Email Program'.
*objpack-doc_size = tab_lines * 255.
APPEND objpack..
*--- Populating the records in the attachment
data: w_str(255) TYPE c.
loop at it_final into wa_objbin.
append wa_objbin to objbin.
append objbin.
clear wa_objbin.
endloop.
DESCRIBE TABLE objbin LINES tab_lines.
tab_lines = tab_lines + 1.
objhead = 'test_report.txt'.
append objhead.
Creating the entry for the compressed attachment
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'txt'.
objpack-obj_name = 'txt'.
objpack-obj_descr = 'Test Email Program'.
objpack-doc_size = tab_lines * 255.
APPEND objpack..
*write:/ 'object text', objtxt.
Entering names in the distribution list
reclist-receiver = '[email protected]'.
reclist-rec_type = 'U'.
APPEND reclist.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
CASE sy-subrc.
WHEN 0.
WRITE: / 'Result of the send process:'.
LOOP AT reclist.
WRITE: reclist-receiver(48), ':'.
IF reclist-retrn_code = 0.
WRITE 'sent successfully'.
ELSE.
WRITE 'not sent'.
ENDIF.
ENDLOOP.
loop at objbin.
write: objbin-line.
endloop.
WHEN 1.
WRITE: / 'no authorization to send to the specified number of' .
"'recipients!'.
WHEN 2.
WRITE: / 'document could not be sent to any of the recipients!'.
WHEN 4.
WRITE: / 'no authorization to send !'.
WHEN OTHERS.
WRITE: / 'error occurred during sending !'.
ENDCASE. -
How to make ALV output Colorless
Hi All,
How to make ALV output Colorless at all....
I have Sum field which after all the rows it iwll do sum and it is showing in ALV .it is showing in Yellow color. Client dont want that.
Currently I am using ALV_LIST_DISPLAY Fm to see this report output via Mss.
So the client want a plane paper color which 2 things are strukcing me up.
1) How to make Sum row(Final Sum up row) as colorless
2) How to make header as colorless.(Header column like emp no , emp name ,e.t.c)
Regards
sas
Can any body any Idea is this possible or not..
Edited by: saslove sap on Apr 13, 2011 11:26 AMHi sap.,
I don't think decolor header is possible., but u can show totals color less by calculating manually.,
as., in field catalog donot use do_sum = 'X'. so it will not calculate totals and yellow color will not appear., now u calculate total and append at last row.,
ex: loop at itab into wa.
wa_alv-f1 = wa-f1.
wa_alv-f2 = wa-f2.
temp_total = temp_total + wa-f2.
append wa_alv to itab_alv.
endloop.
wa_alv-f1 = 'Total'.
wa_alv-f2 = temp_total.
append wa_alv to itab_alv.
now itab_alv contains all records along with total..
hope this helps u.,
reply if u need some more clarifications.,
Thanks & Regards
Kiran -
How to attch ALV output to mailthrough report ?
HI,
Experts,
I have displayed ALV output but i want to attach this ALV output to compose mail in attachments you people can suggest me how to achieve me this scenario.
Thanks in advance,
Shabeer Ahmed.Shabheer,
As far as I know, there is no other way. SCOT transaction will have the setting through which you will connect to the external network.
If you get to know about any other way. Please do let me know as well.
Thanks,
Babu Kilari -
How to Download ALV Output LOGO to Excel ?
Hi
I have Used the LOGO in ALV Output. Iam getting the LOGO through REUSE_ALV_GRID_DISPLAY. If i download the Data to Excel file, the LOGO is not coming. How to solve this problem.
Thanks & Regards,
N.L.Hi,
I had a sample code wich will insert LOGO from PRESENTATION server into excel / word.
TYPE-POOLS ole2.
DATA:
o_word TYPE ole2_object,
excel TYPE ole2_object,
o_documents TYPE ole2_object,
o_actdoc TYPE ole2_object,
o_inlineshapes TYPE ole2_object,
o_logo TYPE ole2_object,
WORKBOOK TYPE ole2_object.
*CREATE OBJECT o_word 'Word.Application'.
CREATE OBJECT EXCEL 'Excel.Application'.
*FREE OBJECT EXCEL.
*SET PROPERTY OF o_word 'Visible' = '1'.
SET PROPERTY OF excel 'Visible' = '1'.
*GET PROPERTY OF o_word 'Documents' = o_documents.
GET PROPERTY OF excel 'Documents' = o_documents.
CALL METHOD OF o_documents 'Add' = o_actdoc.
CALL METHOD OF EXCEL 'WORKBOOKS' = WORKBOOK.
GET PROPERTY OF o_actdoc 'InlineShapes' = o_inlineshapes.
CALL METHOD OF o_inlineshapes 'AddPicture' = o_logo
EXPORTING
#1 = 'C:\Temp\OTHERS\Scrap\COMPANY_LOGO.BMP'
#2 = 0
#3 = 1.
WRITE: / 'Test'.
Let us see if some one will come out with good idea/Example.
Thanks. -
How to convert ALV output into XML format.
Hi all,
I just want to know how to convert an ALV output into a XML format, this is really urgent.
regards,
Ruchika sainiThis program exports an internal table to an XML file. *----
Report ZPRUEBA_MML_13 *
Export an internal table to XML document *
NO BORRAR ESTE CODIGO *
REPORT ZPRUEBA_MML_13.
PANTALLA SELECCION *
PARAMETERS: GK_RUTA TYPE RLGRAP-FILENAME.
PANTALLA SELECCION *
TYPE TURNOS *
TYPES: BEGIN OF TURNOS,
LU LIKE T552A-TPR01,
MA LIKE T552A-TPR01,
MI LIKE T552A-TPR01,
JU LIKE T552A-TPR01,
VI LIKE T552A-TPR01,
SA LIKE T552A-TPR01,
DO LIKE T552A-TPR01,
END OF TURNOS.
TYPE TURNOS *
TYPE SOCIO *
TYPES: BEGIN OF SOCIO,
NUMERO LIKE PERNR-PERNR,
REPOSICION LIKE PA0050-ZAUVE,
NOMBRE LIKE PA0002-VORNA,
TURNOS TYPE TURNOS,
END OF SOCIO.
TYPE SOCIO *
ESTRUCTURA ACCESOS *
DATA: BEGIN OF ACCESOS OCCURS 0,
SOCIO TYPE SOCIO,
END OF ACCESOS.
ESTRUCTURA ACCESOS *
START OF SELECTION *
START-OF-SELECTION.
PERFORM LLENA_ACCESOS.
PERFORM DESCARGA_XML.
END-OF-SELECTION.
END OF SELECTION *
FORM LLENA_ACCESOS *
FORM LLENA_ACCESOS.
REFRESH ACCESOS.
CLEAR ACCESOS.
MOVE: '45050' TO ACCESOS-SOCIO-NUMERO,
'MOISES MORENO' TO ACCESOS-SOCIO-NOMBRE,
'0' TO ACCESOS-SOCIO-REPOSICION,
'T1' TO ACCESOS-SOCIO-TURNOS-LU,
'T2' TO ACCESOS-SOCIO-TURNOS-MA,
'T3' TO ACCESOS-SOCIO-TURNOS-MI,
'T4' TO ACCESOS-SOCIO-TURNOS-JU,
'T5' TO ACCESOS-SOCIO-TURNOS-VI,
'T6' TO ACCESOS-SOCIO-TURNOS-SA,
'T7' TO ACCESOS-SOCIO-TURNOS-DO.
APPEND ACCESOS.
CLEAR ACCESOS.
MOVE: '45051' TO ACCESOS-SOCIO-NUMERO,
'RUTH PEÑA' TO ACCESOS-SOCIO-NOMBRE,
'0' TO ACCESOS-SOCIO-REPOSICION,
'T1' TO ACCESOS-SOCIO-TURNOS-LU,
'T2' TO ACCESOS-SOCIO-TURNOS-MA,
'T3' TO ACCESOS-SOCIO-TURNOS-MI,
'T4' TO ACCESOS-SOCIO-TURNOS-JU,
'T5' TO ACCESOS-SOCIO-TURNOS-VI,
'T6' TO ACCESOS-SOCIO-TURNOS-SA,
'T7' TO ACCESOS-SOCIO-TURNOS-DO.
APPEND ACCESOS.
ENDFORM.
FORM LLENA_ACCESOS *
FORM DESCARGA_XML *
FORM DESCARGA_XML.
DATA: L_DOM TYPE REF TO IF_IXML_ELEMENT,
M_DOCUMENT TYPE REF TO IF_IXML_DOCUMENT,
G_IXML TYPE REF TO IF_IXML,
W_STRING TYPE XSTRING,
W_SIZE TYPE I,
W_RESULT TYPE I,
W_LINE TYPE STRING,
IT_XML TYPE DCXMLLINES,
S_XML LIKE LINE OF IT_XML,
W_RC LIKE SY-SUBRC.
DATA: XML TYPE DCXMLLINES.
DATA: RC TYPE SY-SUBRC,
BEGIN OF XML_TAB OCCURS 0,
D LIKE LINE OF XML,
END OF XML_TAB.
CLASS CL_IXML DEFINITION LOAD.
G_IXML = CL_IXML=>CREATE( ).
CHECK NOT G_IXML IS INITIAL.
M_DOCUMENT = G_IXML->CREATE_DOCUMENT( ).
CHECK NOT M_DOCUMENT IS INITIAL.
WRITE: / 'Converting DATA TO DOM 1:'.
CALL FUNCTION 'SDIXML_DATA_TO_DOM'
EXPORTING
NAME = 'ACCESOS'
DATAOBJECT = ACCESOS[]
IMPORTING
DATA_AS_DOM = L_DOM
CHANGING
DOCUMENT = M_DOCUMENT
EXCEPTIONS
ILLEGAL_NAME = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE 'Ok'.
ELSE.
WRITE: 'Err =',
SY-SUBRC.
ENDIF.
CHECK NOT L_DOM IS INITIAL.
W_RC = M_DOCUMENT->APPEND_CHILD( NEW_CHILD = L_DOM ).
IF W_RC IS INITIAL.
WRITE 'Ok'.
ELSE.
WRITE: 'Err =',
W_RC.
ENDIF.
CALL FUNCTION 'SDIXML_DOM_TO_XML'
EXPORTING
DOCUMENT = M_DOCUMENT
IMPORTING
XML_AS_STRING = W_STRING
SIZE = W_SIZE
TABLES
XML_AS_TABLE = IT_XML
EXCEPTIONS
NO_DOCUMENT = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE 'Ok'.
ELSE.
WRITE: 'Err =',
SY-SUBRC.
ENDIF.
LOOP AT IT_XML INTO XML_TAB-D.
APPEND XML_TAB.
ENDLOOP.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = W_SIZE
FILENAME = GK_RUTA
FILETYPE = 'BIN'
TABLES
DATA_TAB = XML_TAB
EXCEPTIONS
OTHERS = 10.
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.
Message was edited by:
Hymavathi Oruganti -
How to get ALV Output with selected Layout
I have a program which displays the output in ALV list format and i changed the layout and saved
In the selection-screen i have a field to select the layout after selecting the layout it output is not coming with that layout
can anyone tell me what is the problem
or give me a sample code
Thank youHi,
Check this code.
Hope it helps.
*& Report zSALES_ORDER
report z_sales_order.
type-pools: slis.
*DATA DECLARATION.
types: begin of i_vbak,
vbeln type vbeln_va,
augru type augru,
erdat type erdat,
end of i_vbak.
types: begin of i_vbap,
vbeln type vbeln_va,
augru type augru,
posnr type posnr_va,
matnr type matnr,
zmeng type dzmeng,
end of i_vbap.
types: begin of i_makt,
matnr type matnr,
maktx type maktx,
end of i_makt.
types: begin of i_lips,
posnr type posnr_vl,
matnr type matnr,
lfimg type lfimg,
end of i_lips.
types: begin of i_reason,
spras type spras,
augru type augru,
bezei type bezei40,
end of i_reason.
types: begin of i_vbpa,
vbeln type vbeln,
parvw type parvw,
kunnr type kunnr,
end of i_vbpa.
types: begin of i_kna1,
kunnr type kunnr,
name1 type name1_gp,
end of i_kna1.
types: begin of i_final,
vbeln type vbeln_va,
posnr type posnr_va,
matnr type matnr,
zmeng type dzmeng,
maktx type maktx,
lfimg type lfimg,
spras type spras,
augru type augru,
bezei type bezei40,
parvw type parvw,
kunnr type kunnr,
name1 type name1_gp,
end of i_final.
*INTERNAL TABLES
data: it_vbak type standard table of i_vbak.
data: it_vbap type standard table of i_vbap.
data: it_makt type standard table of i_makt.
data: it_lips type standard table of i_lips.
data: it_vbpa type standard table of i_vbpa.
data: it_kna1 type standard table of i_kna1.
data: it_final type standard table of i_final.
data: it_reason type standard table of i_reason.
data : v_flag.
*WORK AREA
data: wa_vbak type i_vbak.
data: wa_vbap type i_vbap.
data: wa_makt type i_makt.
data: wa_lips type i_lips.
data: wa_vbpa type i_vbpa.
data: wa_kna1 type i_kna1.
data: wa_final type i_final.
data: wa_reason type i_reason.
*DATA DECLARATION.
data: v_progname type sy-repid.
data: v_vbeln type vbak-vbeln.
data: v_gridtitle type lvc_title.
*PARAMETERS: D_VARI LIKE DISVARIANT-VARIANT.
data: i_variant like disvariant.
data: p_vari like disvariant-variant.
*DATA DECLARATION FOR CATALOGS LAYOUT SORT EVENTCATALOG TOPOFPAGE.
data: i_fieldcat type slis_t_fieldcat_alv.
data: i_layout type slis_layout_alv.
data: i_sortinfo type slis_t_sortinfo_alv.
data: i_listheader type slis_t_listheader.
data: i_eventcat type slis_t_event.
*INITIALIZATION - First point of execution of program
To initialize Any variables that are to be
used in the program, even before selection screen
appears.
initialization.
v_progname = sy-repid.
v_flag = space.
perform z_default_variant.
*SELECTION SCREEN
selection-screen begin of block blk1 with frame title text-002.
select-options: s_vbeln for v_vbeln.
selection-screen end of block blk1.
*Variable for ALV Variant
selection-screen begin of block b_var with frame title text-020.
parameters: d_vari like disvariant-variant.
selection-screen end of block b_var.
*AT SLECTION-SCREEN.
at selection-screen.
perform z_validations.
*AT SELECTION SCREEN.
at selection-screen on d_vari.
CHECK FOR THE EXISTENCE OF THE VARIANT SELECTED
perform zf_check_var_exist.
at selection-screen on value-request for d_vari.
PROVIDE THE F4-HELP.
perform zf_variant_f4.
*START OF SELECTION.
start-of-selection.
perform z_select.
perform check_validation_flag.
perform z_fieldcat using i_fieldcat.
perform z_layout.
perform z_sortinfo using i_sortinfo.
perform z_eventcat using i_eventcat.
perform z_gridtitle.
perform z_listheader using i_listheader.
perform z_display.
*& Form Z_VALIDATIONS
text
--> p1 text
<-- p2 text
form z_validations .
select vbeln into v_vbeln
up to 1 rows
from vbak
where vbeln in s_vbeln.
endselect.
if sy-subrc <> 0.
message i002(sy) with 'No Records'.
v_flag = 'X'.
endif.
endform. " Z_VALIDATIONS
*& Form Z_FIELDCAT
text
-->P_I_FIELDCAT text
form z_fieldcat using p_i_fieldcat type slis_t_fieldcat_alv.
data: i_fieldcat type slis_fieldcat_alv.
*VBAK-VELN
i_fieldcat-col_pos = '1'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'VBELN'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-key = 'X'. " SO THAT THIS FIELD IS NOT SCROLLABLE AND HIDDABLE.
i_fieldcat-just = 'C'. " FOR JUSTIFICATION.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'SALES ORDER'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 15. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'VBAK'. " FOR F1 & F4 HELP AS REFERNCED TO THE DDIC TABLE.
append i_fieldcat to p_i_fieldcat.
*VBAP-SPRAS
i_fieldcat-col_pos = '2'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'SPRAS'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'LANGUAGE'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 5. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'TVAUT'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
*VBAP-AUGRU
i_fieldcat-col_pos = '3'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'AUGRU'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'REASON'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 5. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'VBAK'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
*VBAP-bezei
i_fieldcat-col_pos = '4'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'BEZEI'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'DESCRIPTION'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'TVAUT'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
*VBAP-POSNR
i_fieldcat-col_pos = '5'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'POSNR'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'ITEM'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 8. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'VBAP'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
*VBAP-MATNR.
i_fieldcat-col_pos = '6'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'MATNR'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'MATERIAL'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 10. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'VBAP'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
*VBAP-ZMENG
i_fieldcat-col_pos = '7'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'ZMENG'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'QUANT'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 10. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'VBAP'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
*MAKT-MAKTX
i_fieldcat-col_pos = '8'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'MAKTX'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'DESCRIPTION'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'MAKT'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
*LIPS-VBELN
i_fieldcat-col_pos = '9'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'VBELN'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'DELIVERY'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 15. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'LIPS'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
*LIPS-LFIMG
i_fieldcat-col_pos = '10'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'LFIMG'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-do_sum = 'X'.
i_fieldcat-seltext_l = 'LFIMG'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 18. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'LIPS'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
*parvw
i_fieldcat-col_pos = '11'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'PARVW'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'PARTNER FUN'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 18. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'VBPA'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
*KUNNR
i_fieldcat-col_pos = '12'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'KUNNR'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'SHIP'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 18. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'VBPA'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
*NAME1
i_fieldcat-col_pos = '13'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'NAME1'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'NAME'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 18. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'KNA1'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
endform. " Z_FIELDCAT
*& Form Z_SELECT
text
--> p1 text
<-- p2 text
form z_select .
select vbeln
augru erdat into corresponding fields of table it_vbak
from vbak
where vbeln in s_vbeln.
loop at it_vbak into wa_vbak.
wa_vbak-erdat = '99991231'.
modify it_vbak from wa_vbak transporting erdat.
endloop.
select * from vbak into corresponding fields of table it_vbak
for all entries in it_vbak
where erdat = it_vbak-erdat.
if sy-subrc = 0.
select vbeln
posnr
matnr
zmeng into corresponding fields of table it_vbap
from vbap
for all entries in it_vbak
where vbeln = it_vbak-vbeln.
if sy-subrc = 0.
select spras
augru
bezei into corresponding fields of table it_reason
from tvaut
for all entries in it_vbak
where augru = it_vbak-augru.
if sy-subrc = 0.
select vbeln
parvw
kunnr into corresponding fields of table it_vbpa
from vbpa
for all entries in it_vbak
where vbeln = it_vbak-vbeln.
if sy-subrc = 0.
select kunnr
name1 into corresponding fields of table it_kna1
from kna1
for all entries in it_vbpa
where kunnr = it_vbpa-kunnr.
if sy-subrc = 0.
select posnr
matnr
lfimg into corresponding fields of table it_lips
from lips
for all entries in it_vbap
where posnr = it_vbap-posnr.
if sy-subrc = 0.
select matnr
maktx into corresponding fields of table it_makt
from makt
for all entries in it_vbap
where matnr = it_vbap-matnr.
endif.
endif.
endif.
endif.
endif.
else.
message i002(sy) with 'No Data found'.
leave list-processing.
endif.
if sy-subrc = 0.
loop at it_vbap into wa_vbap.
read table it_vbak into wa_vbak with key vbeln = wa_vbap-vbeln binary search.
if sy-subrc = 0.
*MOVE DATA INTO IT_FINAL.
move: wa_vbak-vbeln to wa_final-vbeln,
wa_vbak-augru to wa_final-augru,
wa_vbap-posnr to wa_final-posnr,
wa_vbap-matnr to wa_final-matnr,
wa_vbap-zmeng to wa_final-zmeng.
endif.
read table it_lips into wa_lips with key posnr = wa_final-posnr binary search.
if sy-subrc = 0.
move: wa_lips-lfimg to wa_final-lfimg.
endif.
read table it_reason into wa_reason with key augru = wa_final-augru binary search.
if sy-subrc = 0.
move: wa_reason-spras to wa_final-spras,
wa_reason-bezei to wa_final-bezei.
endif.
read table it_makt into wa_makt with key matnr = wa_final-matnr binary search.
if sy-subrc = 0.
move: wa_makt-maktx to wa_final-maktx.
endif.
read table it_vbpa into wa_vbpa with key vbeln = wa_final-vbeln binary search.
if sy-subrc = 0.
move: wa_vbpa-parvw to wa_final-parvw,
wa_vbpa-kunnr to wa_final-kunnr.
endif.
read table it_kna1 into wa_kna1 with key kunnr = wa_final-kunnr binary search.
if sy-subrc = 0.
move: wa_kna1-name1 to wa_final-name1.
endif.
append wa_final to it_final.
clear wa_final.
endloop.
endif.
endform. " Z_SELECT
*& Form Z_LAYOUT
text
--> p1 text
<-- p2 text
form z_layout .
i_layout-zebra = 'X'.
i_layout-totals_text = 'Total'(a00).
i_layout-subtotals_text = 'SubTotal'(a01).
i_layout-box_tabname = 'IT_FINAL'.
endform. " Z_LAYOUT
*& Form Z_SORTINFO
text
-->P_I_SORTINFO text
form z_sortinfo using p_i_sortinfo type slis_t_sortinfo_alv.
data: i_sortinfo type slis_sortinfo_alv.
clear i_sortinfo.
i_sortinfo-spos = '1'.
i_sortinfo-fieldname = 'VBELN'.
i_sortinfo-tabname = 'IT_FINAL'.
i_sortinfo-up = 'X'.
i_sortinfo-group = 'UL'. " I.E UNDERLINE AFTER EVERY GROUP
i_sortinfo-subtot = 'X'.
append i_sortinfo to p_i_sortinfo.
endform. " Z_SORTINFO
*& Form Z_EVENTCAT
text
-->P_I_EVENTCAT text
form z_eventcat using p_i_eventcat type slis_t_event.
data: i_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = p_i_eventcat
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 i_event.
read table p_i_eventcat with key name = slis_ev_top_of_page into
i_event.
if sy-subrc = 0.
move 'TOP_OF_PAGE' to i_event-form.
append i_event to p_i_eventcat.
endif.
read table p_i_eventcat with key name = slis_ev_pf_status_set into i_event.
if sy-subrc = 0.
move 'SET_PF_STATUS' to i_event-form.
append i_event to p_i_eventcat.
endif.
clear i_event.
read table p_i_eventcat into i_event with key name = slis_ev_user_command .
if sy-subrc = 0.
move 'USER_COMMAND' to i_event-form.
append i_event to p_i_eventcat.
endif.
endform. " Z_EVENTCAT
*& Form Z_DISPLAY
text
--> p1 text
<-- p2 text
form z_display .
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = v_progname
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
i_callback_top_of_page = 'TOP_OF_PAGE'
i_grid_title = v_gridtitle
i_save = 'A'
is_layout = i_layout
it_fieldcat = i_fieldcat[]
it_sort = i_sortinfo
it_events = i_eventcat
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = it_final
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. " Z_DISPLAY
*& Form Z_GRIDTITLE
text
--> p1 text
<-- p2 text
form z_gridtitle .
v_gridtitle = 'ALV FOR SALES ORDER DISPLAY'.
endform. " Z_GRIDTITLE
*TOP OF PAGE.
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = i_listheader.
endform. "TOP_OF_PAGE
*MENU SETTINGS.
form set_pf_status using rt_extab type slis_t_extab.
set pf-status 'ALV_MENU'.
endform. "SET_PF_STATUS
*USER-COMMAND
form user_command using p_ucomm type sy-ucomm
rs_selfield type slis_selfield.
data : vbeln type vbeln_va.
case p_ucomm.
when 'BACK'.
leave program.
when '&IC1'.
clear : vbeln.
vbeln = rs_selfield-value.
set parameter id: 'AUN' field vbeln.
call transaction 'VA03' and skip first screen.
endcase.
endform. " USER_COMMAND
*& Form Z_LISTHEADER
text
-->P_I_LISTHEADER text
form z_listheader using p_i_listheader type slis_t_listheader.
data: l_listheader type slis_listheader.
refresh p_i_listheader.
clear l_listheader.
l_listheader-typ = 'H'.
l_listheader-info = text-001.
append l_listheader to p_i_listheader.
clear l_listheader.
l_listheader-typ = 'H'.
l_listheader-info = text-002.
append l_listheader to p_i_listheader.
endform. " Z_LISTHEADER
*& Form check_validation_flag
text
--> p1 text
<-- p2 text
form check_validation_flag .
if not v_flag is initial.
leave list-processing.
endif.
endform. " check_validation_flag
*& Form Z_DEFAULT_VARIANT
text
--> p1 text
<-- p2 text
form z_default_variant .
i_variant-report = v_progname.
call function 'REUSE_ALV_VARIANT_DEFAULT_GET'
exporting
i_save = 'A'
changing
cs_variant = i_variant
exceptions
wrong_input = 1
not_found = 2
program_error = 3
others = 4.
if sy-subrc = 0.
p_vari = i_variant-variant.
D_VARI = P_VARI.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " Z_DEFAULT_VARIANT
*& Form ZF_CHECK_VAR_EXIST
text
--> p1 text
<-- p2 text
form zf_check_var_exist .
data: l_variant like disvariant.
if not p_vari is initial.
clear l_variant.
l_variant-report = v_progname.
l_variant-variant = p_vari.
call function 'REUSE_ALV_VARIANT_EXISTENCE'
exporting
i_save = 'U'
changing
cs_variant = l_variant
exceptions
wrong_input = 1
not_found = 2
program_error = 3
others = 4.
if sy-subrc = 0.
clear i_variant.
move: l_variant-variant to i_variant-variant,
l_variant-report to i_variant-report.
else.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endif.
endform. " ZF_CHECK_VAR_EXIST
*& Form ZF_VARIANT_F4
text
--> p1 text
<-- p2 text
form zf_variant_f4 .
data: x_variant like disvariant.
call function 'REUSE_ALV_VARIANT_F4'
exporting
is_variant = i_variant
I_TABNAME_HEADER =
I_TABNAME_ITEM =
IT_DEFAULT_FIELDCAT =
i_save = 'U'
i_display_via_grid = 'X'
importing
E_EXIT =
es_variant = x_variant
exceptions
not_found = 1
program_error = 2
others = 3
if sy-subrc = 0.
p_vari = x_variant-variant.
d_vari = p_vari.
clear i_variant.
move: x_variant-variant to i_variant-variant,
x_variant-report to i_variant-report.
else.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " ZF_VARIANT_F4
Regards,
Pritha. -
Hi frnds,
I want to send alv output via mail.Hi,
you have your data in the internal table. Just use the FM to send the email...here is the sample code for attachment...you need to use the appropriate type for xls.
data: IS_DOCDATA type SODOCCHGI1,
IS_RECEIVERS type SOMLRECI1,
IS_RECEIVERS_COPY type SOMLRECI1,
IT_RECEIVERS type table of SOMLRECI1,
IS_CONTENT type SOLISTI1,
IT_CONTENT type table of SOLISTI1,
*500369789+
l_txt(255) type c,
lt_objpack TYPE TABLE OF sopcklsti1 WITH HEADER LINE,
lt_objhead TYPE TABLE OF solisti1 WITH HEADER LINE,
lt_objtxt TYPE TABLE OF solisti1 WITH HEADER LINE,
l_tab_lines TYPE i,
l_att_type LIKE soodk-objtp.
*500369789+
IS_DOCDATA-OBJ_NAME = 'MAIL'.
IS_DOCDATA-PRIORITY = 5.
IS_DOCDATA-OBJ_LANGU = SY-LANGU.
IS_DOCDATA-NO_CHANGE = 'X'.
IS_DOCDATA-OBJ_DESCR = SY-CPROG.
loop at IT_MESSAGE into IS_MESSAGE.
clear : IS_CONTENT, l_txt. "500369789+
move is_message-line to l_txt. "500369789+
move IS_MESSAGE-LINE to IS_CONTENT-LINE. "500369789-
move l_txt to IS_CONTENT-LINE. "500369789+
append IS_CONTENT to IT_CONTENT.
endloop.
*---select_email_address
select single
EMAILADDR
CCEMAILADDR
into (IS_RECEIVERS-RECEIVER, IS_RECEIVERS_COPY-RECEIVER)
from ZGL_EMAILCTRL
where IDENT = ''
and ZPROGRAM = 'Z_L_SO_CREA'
and ACTIVE = 'X'.
if IS_RECEIVERS-RECEIVER is not initial.
IS_RECEIVERS-REC_TYPE = 'U'.
IS_RECEIVERS_COPY-REC_TYPE = 'U'.
IS_RECEIVERS_COPY-COPY = 'X'.
append IS_RECEIVERS to IT_RECEIVERS.
append IS_RECEIVERS_COPY to IT_RECEIVERS.
*500369789+
lt_objhead-line = 'USA Order Report'.
append lt_objhead.
DESCRIBE TABLE lt_objhead LINES l_tab_lines.
CLEAR lt_objpack-transf_bin.
lt_objpack-doc_size = STRLEN( lt_objhead ).
lt_objpack-head_start = 1.
lt_objpack-head_num = 1.
lt_objpack-body_start = 1.
lt_objpack-body_num = 1.
lt_objpack-doc_type = 'RAW'.
APPEND lt_objpack.
l_att_type = 'RAW'.
DESCRIBE TABLE it_content LINES l_tab_lines.
READ TABLE it_content into is_content INDEX l_tab_lines.
lt_objpack-doc_size = ( l_tab_lines - 1 ) * 255.
lt_objpack-doc_size = lt_objpack-doc_size + STRLEN( is_content ).
lt_objpack-transf_bin = 'X'.
lt_objpack-head_start = 1.
lt_objpack-head_num = 2.
lt_objpack-body_start = 1.
lt_objpack-body_num = l_tab_lines.
lt_objpack-doc_type = l_att_type.
lt_objpack-obj_name = 'ATTACHMENT'.
concatenate 'Usa' SY-DATUM6(2) SY-DATUM4(2) into
lt_objpack-obj_descr. "#EC *
APPEND lt_objpack.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = IS_DOCDATA
commit_work = 'X'
TABLES
packing_list = lt_objpack
object_header = lt_objhead
contents_txt = lt_objhead
contents_bin = it_content
receivers = it_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Refer these links:
How To Send ALV Output By Email.
How to send ALV report by Email
ALV: Send ALV output as mail - background processing
Regards,
Shiva Kumar -
How to acheive this output during the XML conversion ?.
I am converting the data into XML. I am using Oracle8i.
create table emp(empno number,
ename varchar2(20),
deptno number);
insert into emp values(101,'Krish',10);
insert into emp values(102,null, 10);
insert into emp values(103,'Scott',20);
commit;
CREATE OR REPLACE PROCEDURE STP_TEST_XML AS
v_context DBMS_XMLQUERY.CTXTYPE;
v_document CLOB;
v_error_code VARCHAR2(3) := 'OK';
BEGIN
v_context:= DBMS_XMLQUERY.NEWCONTEXT('SELECT * FROM EMP');
DBMS_XMLQUERY.USENULLATTRIBUTEINDICATOR(v_context,TRUE);
DBMS_XMLQUERY.SETROWSETTAG(v_context,'EMPIMPORT');
DBMS_XMLQUERY.SETROWTAG(v_context,'EMP');
v_document := DBMS_XMLQUERY.GETXML(v_context);
DBMS_XMLQUERY.CLOSECONTEXT(V_context);
PRINT_XML(v_document);
END;
CREATE OR REPLACE PROCEDURE print_xml(result IN OUT NOCOPY CLOB) is
xmlstr varchar2(32767);
line varchar2(2000);
begin
xmlstr := dbms_lob.SUBSTR(result,32767);
loop
exit when xmlstr is null;
line := substr(xmlstr,1,instr(xmlstr,chr(10))-1);
dbms_output.put_line('| '||line);
xmlstr := substr(xmlstr,instr(xmlstr,chr(10))+1);
end loop;
end;
The output is showing as below.
<?xml version = '1.0'?>
<EMPIMPORT>
<EMP num="1">
<EMPNO>101</EMPNO>
<ENAME>Krish</ENAME>
<DEPTNO>10</DEPTNO>
</EMP>
<EMP num="2">
<EMPNO>102</EMPNO>
<ENAME NULL="YES"/>
<DEPTNO>10</DEPTNO>
</EMP>
<EMP num="3">
<EMPNO>103</EMPNO>
<ENAME>Scott</ENAME>
<DEPTNO>20</DEPTNO>
</EMP>
</EMPIMPORT>
But my requirement needs my output should be as below. Please let me know how to achieve this output.
<?xml version = '1.0'?>
<EMPIMPORT>
<EMP num="1">
<EMPNO>101</EMPNO>
<ENAME>Krish</ENAME>
<DEPTNO>10</DEPTNO>
</EMP>
<EMP num="2">
<EMPNO>102</EMPNO>
<ENAME/>
<DEPTNO>10</DEPTNO>
</EMP>
<EMP num="3">
<EMPNO>103</EMPNO>
<ENAME>Scott</ENAME>
<DEPTNO>20</DEPTNO>
</EMP>
</EMPIMPORT>can you please tell me how to acheive 1,2,3 instead of the chars.
Also if I use virtual characteristic can I able to access the query structure in the user exit like the restricted key figures etc or just the records how they appear in the cube.
Thank you guys for the quick response. -
Assigning Column Headers Dynamically in ALV output
Hello Experts,
I have to create dynamic column headers based on the user input on the selection-screen. Basically users enter the period and the ALV output has to create the column headers dynamically for that along with some standard columns.
For eg, The selection screen is like this:
From: 'Q4' '2009'
To 'Q2' '2011'.
Then I have to create 12 columns for the months and rest for the Quarters.
Then the output will be like this:
Material, Description,10/09, 11/09, 12/09, 01/10, 02/10, 03/10, 04/10, 05/10, 06/10, 07/10, 08/10, 09/10, Q4/10, Q1/11, Q2/11
I have built the logic to determine the number of colums for the periods based on input.
By reading other posts, I have learnt that I have to use call method cl_alv_table_create=>create_dynamic_table to get the functionality.
I have also looked at program BCALV_TABLE_CREATE for some help. It only has column headers in increasing order. But I am not able to understand How to pass the Column Header Label (for eg 10/09 or Q1/10) to the fieldcat dynamically.
Is there any blog/sample prog close to my req? Can anybody please please help me. I grealy appreciate it.
Thanks.Hi Lope,
You need to filll column heading based on dynamic internal table column names.
In your final internal table, you will have some column names like '1009, 1109, 1209' .
While filling fieldcatalog you need to put your logic for column heading text.
If column name is 1009, concatenate '10 ' '/' '09', or calculate the quarter 10 falls into ,and display Q4/09.
Regards,
Nisha Vengal. -
Hi,
Searched but could find anything.
Would anybody know how i could code 2 headers in an ALV output.
Tnks.
eg..
Month1 Month2
Value1 Value2 Value1 Value2
5 6 7 8Hi,
Check this thread
Re: multiple headers in alv output
aRs -
How to make an checkbox editable and uneditable within a single alv output.
Hi,
How to make an checkbox editable and uneditable within a single alv output depending on condition.
I have used Reuse_alv_grid_display.
In my output every checkbox is editable. i have used edit = 'X'.
I want editable checkbox for correct value and uneditable checkbox for incorrect value in a single alv>
Mukilansap wrote:
> I want editable checkbox for correct value and uneditable checkbox for incorrect value in a single alv
Use alv styles to achieve this, set the style for each record before displaying the ALV. Structure LVC_S_STYL.
Take a look at the example BCALV_EDIT_02, it is OOPS based, but check how the style table is filled.
regards,
Advait -
How to get rid of the loop in ALV output from At selection screen event?
I have several push buttons on a selection screen.
Clikc on a button, then it pops up an editable ALV report. (This gets triggered AT SELECTION SCREEN event.). REUSE_ALV_GRID_DISPLAY_LVC..
On the ALV output, I enabled F4 for a couple of fields. Once I click on the F4 button, ONF4 method gets triggerd and a pop up appears with custom search helps.
choose a line and it fills the cell.
Upto this it works fine.
Now I click on the BACK button at the ALV output, it takes me to the selection screen. I click on the button again, it show the editable ALV. Now when I click on the F4 button, the pop up comes up twice and the cell gets filled from the second pop - up.
How to control this?
Probably I am not refreshing something?
(I am using REUSE_ALV_GRID_DISPLAY_LVC and tooks ome code for ONF4 event from BCALV_*DATATYPES (forgot the exact name) program.)
Thanks,
VenHi,
FORM refresh_grid USING pw_grid TYPE REF TO cl_gui_alv_grid.
*Work area
DATA : wal_stable TYPE lvc_s_stbl.
CHECK NOT pw_grid IS INITIAL.
wal_stable-col = c_check.
wal_stable-row = c_check.
*Method to refresh grid
CALL METHOD pw_grid->refresh_table_display
EXPORTING
is_stable = wal_stable
i_soft_refresh = c_check
EXCEPTIONS
finished = 1
OTHERS = 2.
ENDFORM. " refresh_grid
Thanks,
Sree. -
How to get check box in alv output
hi gurus
can anyone explian me how to get check box in alv output
it should not be a pop up window
i want to get in output itself
tahnk you
regards
kals.Hi
by using rs_selfield
ty to call dynamic subroutine..
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield. "#EC CALLED
read table rs-selfield with key cond = 'X'
endform.
see the below example
REPORT Z_GET_REFRESH no standard page heading.
type-pools : slis.
tables : makt,
mara.
data : i_fieldcat type slis_t_fieldcat_alv.
CONSTANTS :
gc_refresh TYPE syucomm VALUE '&REFRESH'.
data : begin of i_makt occurs 0,
matnr like makt-matnr,
maktx like makt-maktx,
end of i_makt.
data : v_repid like sy-repid,
g_user_command type slis_formname value 'USER_COMMAND',
g_status_set type slis_formname value 'SET_PF_STATUS',
lt_event_exit TYPE slis_t_event_exit,
ls_event_exit TYPE slis_event_exit.
DATA:LC_GLAY TYPE LVC_S_GLAY.
select-options s_matnr for mara-matnr .
start-of-selection.
select matnr maktx from makt into table i_makt
where matnr in s_matnr.
end-of-selection.
Fill the fieldcatlog
perform fill_field.
Call the FM
perform call_fm.
*& Form fill_field
text
--> p1 text
<-- p2 text
FORM fill_field.
data wa_fieldcat type slis_fieldcat_alv.
clear : wa_fieldcat.
wa_fieldcat-tabname = 'I_MAKT'.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-outputlen = '18'.
wa_fieldcat-seltext_l = 'Material #'.
wa_fieldcat-col_pos = '1'.
append wa_fieldcat to i_fieldcat.
clear : wa_fieldcat.
wa_fieldcat-tabname = 'I_MAKT'.
wa_fieldcat-fieldname = 'MAKTX'.
wa_fieldcat-outputlen = '40'.
wa_fieldcat-seltext_l = 'Material Desc'.
wa_fieldcat-col_pos = '2'.
append wa_fieldcat to i_fieldcat.
ENDFORM. " fill_field
*& Form call_fm
text
--> p1 text
<-- p2 text
FORM call_fm.
v_repid = sy-repid.
LC_GLAY-EDT_CLL_CB = 'X'.
CLEAR ls_event_exit.
ls_event_exit-ucomm = gc_refresh. " Refresh
ls_event_exit-after = 'X'.
APPEND ls_event_exit TO lt_event_exit.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = v_repid
I_CALLBACK_PF_STATUS_SET = g_status_set
I_CALLBACK_USER_COMMAND = g_user_command
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS = LC_GLAY
IS_LAYOUT =
IT_FIELDCAT = i_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 = lt_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_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IT_EXCEPT_QINFO =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = i_makt
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. " call_fm
FORM USER_COMMAND *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield. "#EC CALLED
data i_RSPARAMS like RSPARAMS occurs 0.
CASE R_UCOMM.
WHEN '&IC1'.
read table i_makt index rs_selfield-tabindex.
SET PARAMETER ID 'MAT' FIELD i_makt-matnr.
if not i_makt-matnr is initial.
call transaction 'MM02' and skip first screen.
endif.
when '&REFRESH'.
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
CURR_REPORT = v_repid
IMPORTING
SP =
TABLES
SELECTION_TABLE = i_RSPARAMS
EXCEPTIONS
NOT_FOUND = 1
NO_REPORT = 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.
submit z_get_refresh with selection-table i_RSPARAMS.
rs_selfield-refresh = 'X'.
ENDCASE.
MOVE '&REFRESH' TO r_ucomm.
ENDFORM.
FORM set_pf_status *
FORM SET_PF_STATUS USING rt_extab TYPE slis_t_extab.
DELETE Rt_extab WHERE fcode = gc_refresh.
SET PF-STATUS 'STANDARD_FULLSCREEN' OF PROGRAM 'SAPLKKBL'
EXCLUDING Rt_extab.
*SET PF-STATUS 'STANDARD' EXCLUDING rt_extab.
SET TITLEBAR sy-tcode.
ENDFORM.
Maybe you are looking for
-
Hello, I am new to this forum, and am hoping to get some help. In just the last couple of days my computer has began to run a bit funky, freeze, and the pinwheel spins. I have to restart the computer, and sometimes can't even access the force quit. A
-
Ipod not showing up on Itunes. I have already reset my Ipod.
-
SQL Express 2008 R2 - CREATE DATABASE permission denied in database 'master'
I have created a setup application with SQLEXpress 2008 as a prerequisite. On test SQLExpress installs OK after the application is installed it must create and install a database using a mixture of SMO and Scripting. I used SMO to add the current use
-
Adobe Illustrator CC (2014)がたちあがりません.
昨日.インストールしたのですが 初期化しています.からまったく動かない状態です. 素人なので わかりやすくお願いします.
-
I am having trouble syncing my songs in itunes to my ipod
iTunes and my iPod always worked previously. At one point, I removed all of my mp3s from my iTunes library, and then re-added them (I keep my mp3s in a separate computer/folder location then the itunes folders). Then, syncing to my ipod stopped wor