Data in alv report
i have column of-- MFRPN-MARA the part number shown
___123456789
EET5656434
____3444444
with blanks
i want them look all in left like in excel
123456789
EET5656434
3444444
Make sure that the field in the internal table is typed as MARA-MATNR and that the field catalog references this table and field, it should always put the material number on the left. If still having problems, try to force the justification using the field catalog, there is a field, JUSTIFIED, set it to 'L'.
Regards,
RIch Heilman
Similar Messages
-
Exporting data from ALV Report...
Dear All,
While I am exporting data from ALV report to any other Format (Excel, Txt, HTML) it only export the data of last column, but the heading is comming properly and also the column heading is displaying properly.
So how to rectify it. (the report is Object Oriented).
Regards,
DahrmeshHi Davabap,
Refer this sample program "BCALV_GRID_VERIFY" . I hope it is problem with structure mismatching.
Otherwise can you paste your code ?
Regards,
Vicky
PS: Award points if helpful -
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 -
To display the date in ALV report
Hi All,
In the header part of the ALV report, how to write a particular date by the day,month & year and simultaneously how to get the orders due for the week with displaying the weekend date..by the day, month & year.
example :
monday, december 16 2007
orders for the weekend : sunday, december 22 2007.
**and the orders will be displayed here..**
How to get it? is there any function module to display as such, <REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Feb 21, 2008 10:42 AMHi,
Please refer to the below code:
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c.
*Use FM DATE_TO_DAY to get the day, month and year by specifying the date.
*Date
wa_header-typ = 'H'.
wa_header-info = <variable>.
append wa_header to t_header.
clear wa_header.
* Time
wa_header-typ = 'H'.
wa_header-info = <variable>.
append wa_header to t_header.
clear wa_header.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header.
* i_logo = 'Z_LOGO'.
endform.
Thanks,
Sriram Ponna. -
HOW TO ADD NEW VARIABLE DATAS ON ALV REPORT
Hi gurus,
I have cretaed one alv report using
REUSE_ALV_GRID_DISPLAY.
I HAVE CALCULATED SOME TOTALS AND STORED ON
ONE VARIABLE .
that variable name is 'toterror'.
now i want to add this variable on first line OF ALV REPORT.
that is i should get LIKE THIS.
PERNR TEXT ACTION [ TITLES OF FIELDS ].THEN
TOTAL ERROR RECORDS '900'.
THEN THE CORRESPONDING FIELDS DATA SHOULD BE DISPLAYED.
HELP ME.
THANKS IN ADVANCE.Hi
Thanks Ajeet.
The scenario is that I have to create a formula (contract end date-current date) and have to display the result using exeption to highlight the contracts ending in 30-60 days.
The problem is that the info provider does not have any infoobject for date(only valid to and validity start date)
I have created a formula variable on valid to date using replacement path. But dont have any variable to use for current date.
The only time char in the cube is Fiscal yera variant.
How should I go futher creating such formula? Shall I user customer exit variable? But I dont have any date char to create on.
Can you shed some light on this problem
Thanks -
Fatch data in ALV Reports from multiple Tables
Respected Sir,
How to fatch data in ALV Grid report from selected Field and selected Table.
Please Help and My require Field and Table is :
sono LIKE vbak-vbeln,
sodat LIKE vbak-erdat,
cust LIKE kna1-name1,
pono LIKE vbkd-bstkd,
podat LIKE vbkd-bstdk,
item_no LIKE vbap-posnr,
item_des LIKE vbap-arktx,
name LIKE vbak-kunnr,
pdate LIKE vbak-bstdk,
acdel LIKE lips-lgmng,
netweight LIKE likp-ntgew,
ordval LIKE VBRP-netwr,
CUST_MAT_NO LIKE VBAP-KDMAT,
order_qty LIKE vbap-kwmeng,
desp_qty(5) TYPE p DECIMALS 2, "LIKE lips-lfimg,
balance(5) TYPE p DECIMALS 2,
delv_no LIKE likp-vbeln,
delv_dat LIKE likp-bldat,
invoice LIKE vbrk-vbeln,
exnum like J_1IEXCHDR-exnum,
invoice_dat LIKE vbrk-fkdat,
invoice_val LIKE konv-kwert,
END OF it_out.
*Please Refere the following code and if u wnt to change at ur own ieda u can change and reply me back.*
*Thnaks In ADVANCE.*
*Please Do need full it.*
*Bhavesh Panchal*
*Baroda*
Also I Make Reports For SO : full coding is.
*& Report Z_NEW1
REPORT Z_NEW1.
TABLES : vbak, "Sales Document: Header Data
vbkd, "Sales Document: Business Data
likp, "SD Document: Delivery Header Data
vbrk, "Billing Document: Header Data
konv, "Conditions (Transaction Data)
lips, "SD document: Delivery: Item data
vbap, "Sales Document: Item Data
vbrp, "Billing Document: Item Data
kna1, "General Data in Customer Master
J_1IEXCHDR.
DATA : i_vbak LIKE vbak OCCURS 10 WITH HEADER LINE.
DATA : it_vbkd LIKE vbkd OCCURS 10 WITH HEADER LINE.
DATA : it_likp LIKE likp OCCURS 10 WITH HEADER LINE.
DATA : it_vbrk LIKE vbrk OCCURS 10 WITH HEADER LINE.
DATA : it_konv LIKE konv OCCURS 10 WITH HEADER LINE.
DATA : it_lips LIKE lips OCCURS 10 WITH HEADER LINE.
DATA : it_vbap LIKE vbap OCCURS 10 WITH HEADER LINE.
DATA : it_vbrp LIKE vbrp OCCURS 10 WITH HEADER LINE.
DATA : it_kna1 LIKE kna1 OCCURS 10 WITH HEADER LINE.
DATA : it_vbrp1 LIKE vbrp OCCURS 10 WITH HEADER LINE.
DATA : it_temp LIKE lips OCCURS 10 WITH HEADER LINE.
DATA : it_lips1 LIKE lips OCCURS 10 WITH HEADER LINE.
DATA : it_lips2 LIKE lips OCCURS 10 WITH HEADER LINE.
DATA : it_lips3 LIKE lips OCCURS 10 WITH HEADER LINE.
DATA : it_vbak1 LIKE vbak OCCURS 10 WITH HEADER LINE.
DATA : it_vbak2 LIKE vbak OCCURS 10 WITH HEADER LINE.
DATA : it_vbap1 LIKE vbap OCCURS 10 WITH HEADER LINE.
DATA : it_posnv LIKE zdelprt OCCURS 10 WITH HEADER LINE.
DATA : BEGIN OF it_out OCCURS 10,
sono LIKE vbak-vbeln,
sodat LIKE vbak-erdat,
cust LIKE kna1-name1,
pono LIKE vbkd-bstkd,
podat LIKE vbkd-bstdk,
item_no LIKE vbap-posnr,
item_des LIKE vbap-arktx,
name LIKE vbak-kunnr,
pdate LIKE vbak-bstdk,
acdel LIKE lips-lgmng,
netweight LIKE likp-ntgew,
ordval LIKE VBRP-netwr,
CUST_MAT_NO LIKE VBAP-KDMAT,
order_qty LIKE vbap-kwmeng,
desp_qty(5) TYPE p DECIMALS 2, "LIKE lips-lfimg,
balance(5) TYPE p DECIMALS 2,
delv_no LIKE likp-vbeln,
delv_dat LIKE likp-bldat,
invoice LIKE vbrk-vbeln,
exnum like J_1IEXCHDR-exnum,
invoice_dat LIKE vbrk-fkdat,
invoice_val LIKE konv-kwert,
END OF it_out.
SELECT-OPTIONS: sono FOR vbak-vbeln.
SELECT-OPTIONS: customer FOR vbak-kunnr.
SELECT-OPTIONS: d_date FOR likp-bldat.
LOOP AT it_OUT.
select * into table i_vbak from vbak
where vbeln IN sono.
sono = vbak-vbeln.
append it_out.
modify it_out.
endloop.
LOOP AT it_out.
SELECT single vbeln netwr FROM vbak
INTO (it_out-pono,it_out-podat)
WHERE vbeln = it_out-sono.
"it_out-item_no.
append it_out.
ENDLOOP.
select * into table i_vbak from vbak
where vbeln IN sono.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_structure_name = 'VBAK'
I_grid_title = 'Bhavesh Panchal'
tables
t_outtab = i_vbak
t_outtab = it_out
exceptions
others = 1.Hi Bhavesh Panchal ,
You have to create another internal table with fields which you would like to display in the ALV output.
once you fetch the data from different tables into respective internal tables. loop those internal tables and insert the field values to internal table which you want to display in ALV output.
Create field catalog for the internal table created for ALV output.
Hope it shall be useful.
Regards
Santosh Kumaar.M -
Automatic Display of NEW Data in ALV Report using Classes and Methods
Hi,
I have developed a ALV Report for displaying data from a set of DB tables using ABAP OO, Classes and Methods. The requirement is to have the report output to be automatically updated with the new entries from the DB table at a regular frequency of tiem may be every two minutes.
Could anyone please tell me how can this be acheived.
Thanks and regards,
Raghavendra Goutham P.Yes its possible.
Take a look at this thread
Auto refresh of ALV Grid, without user interaction
Or Rich's blog
/people/rich.heilman2/blog/2005/10/18/a-look-at-clguitimer-in-46c
Regards,
Ravi
Note : Please mark all the helpful answers -
Can we hide some data in alv report list,if so how to hide that data.
in my report for single object type i will have 3 to 4 remarks which comes in the next line, so along with that remarks i must have the same object type but it should be in a invisible mode.
You can do that by simply sorting the alv display by <b>object type</b>, all the data after that will be group according to its object type and the object type will only be printed once.
You can make a varian inthe ALV and call it on your code, or insert the code with this (if you use function module for creating ALV):
information for sort and subtotals
types: begin of slis_sortinfo_alv,
spos(2) type n,
spos like alvdynp-sortpos,
fieldname type slis_fieldname,
tabname type slis_fieldname,
up(1) type c,
down(1) type c,
group(2) type c,
subtot(1) type c,
up like alvdynp-sortup,
down like alvdynp-sortdown,
group like alvdynp-grouplevel,
subtot like alvdynp-subtotals,
comp(1) type c,
expa(1) type c,
obligatory(1) type c,
end of slis_sortinfo_alv.
DATA: l_v_sort TYPE slis_sortinfo_alv.
REFRESH: ta_fieldcat, ta_sort.
v_layout-zebra = 'X'.
v_layout-colwidth_optimize = 'X'.
l_v_sort-fieldname = 'OBJECTTYPE'.
l_v_sort-spos = 1.
l_v_sort-up = 'X'.
l_v_sort-subtot = 'X'.
APPEND l_v_sort TO ta_sort.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
is_layout = v_layout
it_fieldcat = ta_fieldcat[]
<b>it_sort = ta_sort[]</b>
it_events = ta_events[]
is_sel_hide = wa_selcrit
i_save = 'A'
is_variant = spec_layout
TABLES
t_outtab = ft_output
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
EXIT.
ENDIF.
Regards,
-don- -
Save Data in ALV Report .
Hello,
Given below is my code
*& Report ZALV_TEST_SA *
REPORT ZALV_TEST_SA NO STANDARD PAGE HEADING.
*----------------------TYPE POOL OF ALV--------------------------------*
TYPE-POOLS: SLIS.
*----------------------DATABASE TABLES---------------------------------*
TABLES: ZFLIGHTM_SA, ZFLIGHT_AVAIL_SA.
*-------------DATA DECLARATION-----------------------------------------*
DATA: BEGIN OF ITAB OCCURS 0,
ZFLIGHT_ID TYPE ZFLIGHT_ID,
ZCITY_FROM TYPE ZCITY_FROM,
ZCITY_TO TYPE ZCITY_TO,
ZDEP_DATE TYPE DATS,
ZTIME TYPE TIMS,
ZPRICE TYPE ZPRICE,
ZNUM_OF_PSNGRS(3) TYPE N,
ZAVAIL_SEATS(3) TYPE N,
END OF ITAB.
DATA: BEGIN OF ITABM OCCURS 0,
MANDT TYPE MANDT,
ZFLIGHT_ID TYPE ZFLIGHT_ID,
ZCITY_FROM TYPE ZCITY_FROM,
ZCITY_TO TYPE ZCITY_TO,
ZTIME TYPE TIMS,
ZPRICE TYPE ZPRICE,
END OF ITABM.
DATA: BEGIN OF ITAB_AVAIL OCCURS 0,
MANDT TYPE MANDT,
ZFLIGHT_ID TYPE ZFLIGHT_ID,
ZDEP_DATE TYPE DATS,
ZNUM_OF_PSNGRS(3) TYPE N,
ZAVAIL_SEATS(3) TYPE N,
END OF ITAB_AVAIL.
DATA: WA_ITAB LIKE LINE OF ITAB,
WA_ITABM LIKE LINE OF ITABM,
WA_ITAB_AVAIL LIKE LINE OF ITAB_AVAIL.
DATA: L_REPID LIKE SY-REPID,
L_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
L_LAYOUT TYPE SLIS_LAYOUT_ALV,
L_EVENTS TYPE SLIS_T_EVENT.
DATA: WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
*----------------SELECTION SCREEN SELECT-OPTIONS-----------------------*
SELECT-OPTIONS S_CITY FOR ZFLIGHTM_SA-ZCITY_FROM NO INTERVALS.
SELECT-OPTIONS D_CITY FOR ZFLIGHTM_SA-ZCITY_TO NO INTERVALS.
SELECT-OPTIONS D_DATE FOR ZFLIGHT_AVAIL_SA-ZDEP_DATE NO INTERVALS.
*----------------------SELECTION OF DATA-------------------------------*
PERFORM SELECT_DATA.
*----------------SETTING DATA IN TABLE FOR FIELD CATALOG---------------*
PERFORM CALL_FIELDCAT_MERGE.
*----------CALLING FUNCTION FOR DISPLAYING REPORT----------------------*
PERFORM DISPLAY_TABLE.
*----------------------AT SELECTION SCREEN EVENT-----------------------*
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'STORE'.
PERFORM SAVE_DATA.
WHEN 'PREVIOUS'.
LEAVE TO SCREEN 0.
WHEN OTHERS.
ENDCASE.
*------------------------------FORMS-----------------------------------*
*& Form SELECT_DATA
* text
* --> p1 text
* <-- p2 text
FORM SELECT_DATA .
SELECT A~ZFLIGHT_ID ZCITY_FROM
ZCITY_TO ZDEP_DATE
ZTIME ZPRICE
ZNUM_OF_PSNGRS ZAVAIL_SEATS
FROM ZFLIGHTM_SA AS A INNER JOIN ZFLIGHT_AVAIL_SA AS B
ON A~ZFLIGHT_ID = B~ZFLIGHT_ID
INTO CORRESPONDING FIELDS OF TABLE ITAB
WHERE A~ZCITY_FROM IN S_CITY
AND A~ZCITY_TO IN D_CITY
AND B~ZDEP_DATE IN D_DATE.
L_REPID = SY-REPID.
ENDFORM. " SELECT_DATA
*& Form CALL_FIELDCAT_MERGE
* text
* --> p1 text
* <-- p2 text
FORM CALL_FIELDCAT_MERGE .
* CLEAR WA_FIELDCAT.
* WA_FIELDCAT-TABNAME = ITAB.
* WA_FIELDCAT-FIELDNAME = 'ZFLIGHT_ID'.
* WA_FIELDCAT-KEY = 'X'. "sets key field
* APPEND WA_FIELDCAT TO L_FIELDCAT.
* WA_FIELDCAT-TABNAME = ITAB.
* WA_FIELDCAT-FIELDNAME = 'ZPRICE'.
* WA_FIELDCAT-KEY = 'X'. "sets key field
* APPEND WA_FIELDCAT TO L_FIELDCAT.
* WA_FIELDCAT-TABNAME = ITAB.
* WA_FIELDCAT-FIELDNAME = 'ZAVAIL_SEATS'.
* WA_FIELDCAT-KEY = 'X'. "sets key field
* APPEND WA_FIELDCAT TO L_FIELDCAT.
*--------------CALLING FUNCTION FOR FIELD CATALOG----------------------*
CLEAR L_FIELDCAT.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = L_REPID
I_INTERNAL_TABNAME = 'ITAB'
* I_STRUCTURE_NAME = 'WA_ITAB'
* I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = 'ZALV_TEST_SA'
I_BYPASSING_BUFFER = 'X'
* I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = L_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.
*--------------EDITING FIELDS IN FIELD CATALOG ------------------------*
LOOP AT L_FIELDCAT INTO WA_FIELDCAT.
CASE WA_FIELDCAT-FIELDNAME.
WHEN 'ZFLIGHT_ID'.
WA_FIELDCAT-COL_POS = '1'.
* WA_FIELDCAT-text_fieldname = 'Flight ID'.
WA_FIELDCAT-KEY = '3'.
WA_FIELDCAT-JUST = 'L'.
WA_FIELDCAT-NO_ZERO = 'X'.
WA_FIELDCAT-EMPHASIZE = 'X'.
WA_FIELDCAT-SELTEXT_L = 'Flight ID'. "40 char long field name
WA_FIELDCAT-SELTEXT_M = 'Flight ID'. "20 char long field name
WA_FIELDCAT-SELTEXT_S = 'Flight ID'. "10 char long field name
WHEN 'ZCITY_FROM' .
WA_FIELDCAT-NO_OUT = 'X'.
WHEN 'ZCITY_TO' .
WA_FIELDCAT-NO_OUT = 'X'.
WHEN 'ZDEP_DATE' .
WA_FIELDCAT-NO_OUT = 'X'.
WHEN 'ZTIME' .
WA_FIELDCAT-NO_OUT = 'X'.
WHEN 'ZPRICE' .
WA_FIELDCAT-COL_POS = '2'.
* WA_FIELDCAT-text_fieldname = 'Flight ID'.
WA_FIELDCAT-KEY = '4'.
WA_FIELDCAT-JUST = 'L'.
WA_FIELDCAT-NO_ZERO = 'X'.
* WA_FIELDCAT-EMPHASIze = 'X'.
WA_FIELDCAT-SELTEXT_L = 'Price'. "40 char long field name
WA_FIELDCAT-SELTEXT_M = 'Price'. "20 char long field name
WA_FIELDCAT-SELTEXT_S = 'Price'. "10 char long field name
WA_FIELDCAT-EDIT = 'X'.
WHEN 'ZNUM_OF_PSNGRS' .
WA_FIELDCAT-NO_OUT = 'X'.
WHEN 'ZAVAIL_SEATS' .
WA_FIELDCAT-COL_POS = '3'.
* WA_FIELDCAT-text_fieldname = 'Flight ID'.
WA_FIELDCAT-KEY = '4'.
WA_FIELDCAT-JUST = 'L'.
WA_FIELDCAT-NO_ZERO = 'X'.
* WA_FIELDCAT-EMPHASIze = 'X'.
WA_FIELDCAT-SELTEXT_L = 'Available Seats'.
"40 char long field
WA_FIELDCAT-SELTEXT_M = 'Available Seats'.
"20 char long field
WA_FIELDCAT-SELTEXT_S = 'Seats'. "10 char long field name
WA_FIELDCAT-EDIT = 'X'.
WHEN OTHERS.
WA_FIELDCAT-NO_OUT = 'X'.
ENDCASE.
MODIFY L_FIELDCAT FROM WA_FIELDCAT.
ENDLOOP.
ENDFORM. " CALL_FIELDCAT_MERGE
*& Form USER_COMMAND_ALV_SA
* text
* --> p1 text
* <-- p2 text
FORM USER_COMMAND_ALV_SA USING I_UCOMM LIKE SY-UCOMM
IS_SELFIELD TYPE SLIS_SELFIELD.
*****form frm_usercommand using r_ucomm like sy-ucomm
*****rs_selfield type slis_selfield.
****CASE I_UCOMM.
CASE sy-ucomm.
WHEN 'STORE'.
PERFORM SAVE_DATA ON COMMIT.
WHEN 'PREVIOUS'.
LEAVE TO SCREEN 0.
WHEN OTHERS.
ENDCASE.
ENDFORM. "USER_COMMAND_ALV_SA
*& Form DISPLAY_TABLE
* text
* --> p1 text
* <-- p2 text
FORM DISPLAY_TABLE .
* L_FIELDCAT-input = 'X'.
* L_FIELDCAT-edit = 'X'.
* L_LAYOUT-Edit = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = L_REPID " report id
I_CALLBACK_PF_STATUS_SET = 'ZALV_TEST_SA' " to set pf-status
I_CALLBACK_USER_COMMAND = 'USER_COMMAND_ALV_SA' " to handle
" 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 =
* IS_LAYOUT = L_LAYOUT
IT_FIELDCAT = L_FIELDCAT " for field catalog
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
IT_EVENTS = L_EVENTS "internal table with
" user 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 = ITAB "internal table with
" records
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_TABLE
*-------------------------SET PF-STATUS--------------------------------*
*& Form ZALV_TEST_SA
* text
* --> p1 text
* <-- p2 text
FORM ZALV_TEST_SA USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'ZALV_TEST_SA' .
ENDFORM. "ZALV_TEST_SA
*& Form SAVE_DATA
* text
* --> p1 text
* <-- p2 text
FORM SAVE_DATA.
LOOP AT ITAB INTO WA_ITAB.
****HIDE:WA_ITAB-ZFLIGHT_ID, WA_ITAB-ZCITY_FROM,
****WA_ITAB-ZCITY_TO, WA_ITAB-ZTIME,
****WA_ITAB-ZDEP_DATE, WA_ITAB-ZNUM_OF_PSNGRS,
****WA_ITAB-ZAVAIL_SEATS.
CLEAR: WA_ITABM,WA_ITAB_AVAIL.
WA_ITABM-ZFLIGHT_ID = WA_ITAB-ZFLIGHT_ID.
WA_ITABM-ZCITY_FROM = WA_ITAB-ZCITY_FROM.
WA_ITABM-ZCITY_TO = WA_ITAB-ZCITY_TO.
WA_ITABM-ZTIME = WA_ITAB-ZTIME.
WA_ITABM-ZPRICE = WA_ITAB-ZPRICE.
WA_ITAB_AVAIL-ZDEP_DATE = WA_ITAB-ZDEP_DATE.
WA_ITAB_AVAIL-ZNUM_OF_PSNGRS = WA_ITAB-ZNUM_OF_PSNGRS.
WA_ITAB_AVAIL-ZAVAIL_SEATS = WA_ITAB-ZAVAIL_SEATS.
APPEND WA_ITABM TO ITABM.
APPEND WA_ITAB_AVAIL TO ITAB_AVAIL.
ENDLOOP.
MODIFY ZFLIGHTM_SA FROM TABLE ITABM.
MODIFY ZFLIGHT_AVAIL_SA FROM TABLE ITAB_AVAIL.
COMMIT WORK.
ENDFORM. " SAVE_DATA
I want to edit a field--the price and save the changes. I have assigned a button STORE for this. But my data is not getting saved.
I searched the forum and wrote the code accordingly. I even referred the stored programs. Still I am not getting the output. Please help.
Regards,
Smruthi.
Edited by: Smruthi Acharya on Feb 10, 2009 3:31 PM
Edited by: Julius Bussche on Feb 10, 2009 12:16 PM
Please use code tagsHi,
You must have taken some function code for that STORE button (say you have taken it as MODIFY )
Use this code, it will modify the code in internal table from alv.
I have tried it, n its working:-
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = v_rep_id " report id
i_callback_pf_status_set = 'PF' " for PF-STATUS
i_callback_user_command = 'USER_COMMAND' " for 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 =
is_layout = wa_layout " for layout
it_fieldcat = it_field " field catalog
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
it_sort = it_sort " sort info
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* i_save = 'A'
* is_variant = wa_variant " variant name
* 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
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_final " internal table
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.
*& Form USER_COMMAND
* SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
* AND EXECUTE THE APPROPIATE CODE
* -->LV_OKCODE used to capture the function code
* of the user-defined push-buttons
* -->L_SELFIELD text
FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.
* assign the function code to variable v_okcode
lv_okcode = sy-ucomm.
* handle the code execution based on the function code encountered
CASE lv_okcode.
* when the function code is MODIFY (STORE button) then save data
WHEN 'MODIFY'.
* to reflect the data changed into internal table
DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
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.
" at this point your data in internal table is changed
* refresh the ALV Grid output from internal table
l_selfield-refresh = c_check.
ENDFORM. "USER_COMMAND
Hope this helps you.
Regards,
Tarun -
Data of alv report in excel file in background processing using open datas
Hi Experts,
I have developed report for purchase register . if i execute this report in background process i am not able to get the downloaded file in excel and output is also not coming properly, columns are going to overlap.
i used open dataset read dataset and close dataset but still problem is not solved. so if anyone have code with this and also which will have concatenate statement in the code send it.
Regards,
RahulHi Rahul,
Ur code shud be like below:
DATA : l_filename2 TYPE string,
v_extn.
SPLIT p_filename AT '.xls' INTO l_filename2 v_extn.
CONCATENATE l_filename2 'downloaded' INTO l_filename2 SEPARATED BY '_'.
CONCATENATE l_filename2 'txt' INTO l_filename2 SEPARATED BY '.'.
OPEN DATASET l_filename2 IN TEXT MODE FOR OUTPUT ENCODING DEFAULT.
IF sy-subrc <> 0.
MESSAGE e499(sy) WITH text-e02.
ENDIF.
LOOP AT it_order_number INTO wa_order_number.
TRANSFER wa_order_number TO l_filename2.
ENDLOOP.
CLOSE DATASET l_filename2.
Now, go to tcode AL11 and check it in the Application server itself.
Hope this helps,
Regards,
Arnab. -
Hi frnds,
Ouput for alv
matnr desc uom alternative Uom
10 scrb kg nos
10 scrb kg EA
But i want to display ths order (delete the duplicates of second line item Except alternative UOM)
matnr desc uom alternative Uom
10 scrb kg nos
xx xxxx xx EA
Pls any one help me.
Thanks in advance.Hi Kumar,
Populate the Internal table for sorting as mentioned below and pass it to export structure IT_SORT of FM 'REUSE_ALV_GRID_DISPLAY' and then Just Declare ITAB and WA for grouping ( DATA :it_gr TYPE slis_t_sp_group_alv, wa_gr LIKE LINE OF it_gr ) and pass it to exporting structure IT_SPECIAL GROUP of FM 'REUSE_ALV_GRID_DISPLAY' as shown below.
This will display the output as you required but Without XX.
wa_sort-fieldname = 'MATNR'.
wa_sort-tabname = 'ITAB_NAME'.
wa_sort-up = ' '.
wa_sort-down = ' '.
wa_sort-group = ' '.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
wa_sort-fieldname = 'DESC'.
wa_sort-tabname = 'ITAB_NAME'.
wa_sort-up = ' '.
wa_sort-down = ' '.
wa_sort-group = ''.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
wa_sort-fieldname = 'UOM'.
wa_sort-tabname = 'ITAB_NAME'.
wa_sort-up = ' '.
wa_sort-down = ' '.
wa_sort-group = ''.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repid
is_layout = g_layout
it_fieldcat = it_fieldcat
it_special_groups = it_gr
it_sort = it_sort
TABLES
t_outtab = ITAB_NAME
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. -
Hi experts...
I want single row in alv report.
I have use loop for fatch data into internal table using loop when i am passing data in alv report then the data comes according loop. i want onlu one data in alv row.
how can i do such, plz help me.decleare two internal table.
read table itab into wa index 1.
append wa to itab2.
pass itab2 only one record display. -
Hi Gurus,
is der any way to download data from ALV report to excel sheet depending on layout set dyanmically.
I mean to say that if I choose a layout then data has to transfer to excel sheet according to layout fields automaticaly.I think this can be done by oops ALV , are u using reusealv F.M to call output in ALV ?
Try the below kind of ALV
IN PBO -
>
SET PF-STATUS 'PROJREP'.
SET TITLEBAR text-046.
DATA: g_container TYPE scrfname VALUE 'ALV',
g_grid1 TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container. (Name of the container )
CREATE OBJECT g_grid1
EXPORTING i_parent = g_custom_container.
PERFORM create_field_catalog_ce
CALL METHOD g_grid1->set_frontend_fieldcatalog
EXPORTING
it_fieldcatalog = t_fcat_ce.
ALL METHOD g_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'ST_DISPLAY'
CHANGING
it_outtab = t_display_io
it_fieldcatalog = t_fcat_ce.
->Create Object to receive events and link them to handler methods.
When the ALV Control raises the event for the specified instance
the corresponding method is automatically called.
CREATE OBJECT g_event_receiver.
SET HANDLER g_event_receiver->handle_double_click FOR g_grid1.
ENDIF.
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = g_grid1.
IN PAI -->
CALL METHOD cl_gui_cfw=>dispatch. -
Devolped an ALV report for daily cash receipts for selected date range
hi,
how to devlop an ALV report for daily cash receipts for selected date range.for this report what are the tables and fields we have to use.what is the selectionscreen&what is logic.give me sample report.hi,
how to devlop an ALV report for daily cash receipts for selected date range.for this report what are the tables and fields we have to use.what is the selectionscreen&what is logic.give me sample report. -
Devloped an ALV report for daily cash receipts for selected date range
hi,
how to devlop an ALV report for daily cash receipts for selected date range.for this report what are the tables and fields we have to use.what is the selectionscreen&what is logic.give me sample report.Hi,
You can develop simple reports using Report Painter.
You may be also interested in:
Check report SAPMF05A for credit memo
See the following Std reports on Payment Advices execute the Tcodes:
S_ALR_87009888
S_ALR_87009889
S_ALR_87009890
S_ALR_87009891
S_ALR_87009892
S_ALR_87009893
S_ALR_87009978
S_ALR_87009979
S_ALR_87009980
S_ALR_87009981
S_ALR_87009982
S_ALR_87009983
S_ALR_87010056
S_ALR_87010057
S_ALR_87010058
S_ALR_87010059
S_ALR_87010060
S_ALR_87010061
S_ALR_87010066
S_ALR_87010067
S_ALR_87012106
S_ALR_87012107
S_ALR_87012108
S_ALR_87012109
S_ALR_87012110
S_ALR_87012111
S_ALR_87012116
S_ALR_87012117
S_ALR_87012200
S_ALR_87012201
S_ALR_87012202
S_ALR_870122
S_ALR_87012204
S_ALR_87012205
S_ALR_87012350
S_ALR_87012351
S_ALR_87012352
S_ALR_87012353
S_ALR_87012354
S_ALR_87012355
sample ALV report:
tables:
marav. "Table MARA and table MAKT
Data to be displayed in ALV
Using the following syntax, REUSE_ALV_FIELDCATALOG_MERGE can auto-
matically determine the fieldstructure from this source program
Data:
begin of imat occurs 100,
matnr like marav-matnr, "Material number
maktx like marav-maktx, "Material short text
matkl like marav-matkl, "Material group (so you can test to make
" intermediate sums)
ntgew like marav-ntgew, "Net weight, numeric field (so you can test to
"make sums)
gewei like marav-gewei, "weight unit (just to be complete)
end of imat.
Other data needed
field to store report name
data i_repid like sy-repid.
field to check table length
data i_lines like sy-tabix.
Data for ALV display
TYPE-POOLS: SLIS.
data int_fcat type SLIS_T_FIELDCAT_ALV.
select-options:
s_matnr for marav-matnr matchcode object MAT1.
start-of-selection.
read data into table imat
select * from marav
into corresponding fields of table imat
where
matnr in s_matnr.
end-of-selection.
Now, we start with ALV
To use ALV, we need a DDIC-structure or a thing called Fieldcatalogue.
The fieldcatalouge can be generated by FUNCTION
'REUSE_ALV_FIELDCATALOG_MERGE' from an internal table from any
report source, including this report.
The only problem one might have is that the report and table names
need to be in capital letters. (I had it )
Store report name
i_repid = sy-repid.
Create Fieldcatalogue from internal table
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = sy-repid
I_INTERNAL_TABNAME = 'IMAT' "capital letters!
I_INCLNAME = sy-repid
CHANGING
CT_FIELDCAT = int_fcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = i_repid
I_STRUCTURE_NAME = 'marav'
I_DEFAULT = 'X'
I_SAVE = 'A'
TABLES
T_OUTTAB = imat.
IF SY-SUBRC <> 0.
WRITE: 'SY-SUBRC: ', SY-SUBRC .
ENDIF.
Hope this will help.
Regards,
Naveen.
Maybe you are looking for
-
Mediator - convert XSD datetime to SQL date value
Fusion 11g, JDev 11.1.1, W server 2008 Hi there, using JDev we've defined a DB adapter (towards an ORACLE schema), which basically serves two operations: INSERT and SELECT. On the DB table we've got a DATE_TIME while on on the other side we've define
-
How to configure work flow for Material Master creation or change?
-
Blink feed no longer working...
Blink feed just quit working. Just says no content. When I go into settings Facebook is no longer offered. I tried just setting to gallery, that doesn't come up either. I've tried resetting everything I can think of and I can't seem to make anyth
-
I have install a perl application... when i run it i got an errro internal server error... when i look at the error_log i got this error ERROR LOG ======================= syntax error at /data/app/oracle/product/9IASAPP/perl/lib/5.6.1/warnings.pm lin
-
Error with Crystal 2008 Exporting MS Excel using ReportExportFormat.MSExcel
Hi </br> </br> I am using the sample code that comes with the Eclipse plug-in. I have modified it slightly to also write to different formats and then display in the viewer. I am able to write to all formats except to the MSExcel (MSExcel data only w