ALV Grid Collect Statment for SUM the data.
Hellow Experts,
i am new to ABAP i have on programme which output is coming like ,
Prod.ID ... .... ... Qnty in Date1 .. Qnty in Date2... Qnty in Date3........Qnty in Date31.
0001 12.1 0.00 10.1
0001 12.1 0.00 10.1
I need the summestion of qnty against that date , and prodId should not repate my Output should be like this,
Prod.ID ... .... ... Qnty in Date1 .. Qnty in Date2... Qnty in Date3........Qnty in Date31.
0001 24.2 0.00 20.2
0002 12.1 0.00 10.1
I wrote collect statment but its not working , plz help me for this, and one more thing that i am passing the data to gt_data.
My code is here,
TABLES: AFRU,AUFK,VBAK,KNA1,VBAP,VBKD.
DATA: BEGIN OF i_alv OCCURS 0,
ARBID TYPE AFRU-ARBID,
BUDAT TYPE AFRU-BUDAT,
WERKS TYPE AFRU-WERKS,
LMNGA TYPE AFRU-LMNGA,
AUFNR TYPE AFRU-AUFNR,
KDAUF TYPE AUFK-KDAUF,
KDPOS TYPE AUFK-KDPOS,
VBELN TYPE VBAK-VBELN,
KUNNR TYPE VBAK-KUNNR,
NAME1 TYPE KNA1-NAME1,
MATNR TYPE VBAP-MATNR,
KDKG1 TYPE VBKD-KDKG1,
end of i_alv.
TYPES: BEGIN OF ty_data,
lmnga TYPE AFRU-LMNGA,
BUDAT TYPE AFRU-BUDAT,
ARBID TYPE AFRU-ARBID,
aufnr TYPE AFRU-AUFNR,
kdauf TYPE AUFK-KDAUF,
name1 TYPE KNA1-NAME1,
matnr TYPE VBAP-MATNR,
kdkg1 TYPE VBKD-KDKG1,
END OF ty_data,
tt_data TYPE STANDARD TABLE OF ty_data,
BEGIN OF ty_dyn1, "#EC NEEDED
ARBID TYPE AFRU-ARBID,
aufnr TYPE AFRU-AUFNR,
kdauf TYPE AUFK-KDAUF,
name1 TYPE KNA1-NAME1,
matnr TYPE VBAP-MATNR,
kdkg1 TYPE VBKD-KDKG1,
END OF ty_dyn1,
BEGIN OF ty_dyn2, "#EC NEEDED
date TYPE AFRU-LMNGA,
END OF ty_dyn2,
BEGIN OF ty_cols,
date TYPE BUDAT,
END OF ty_cols,
tt_cols TYPE SORTED TABLE OF ty_cols WITH UNIQUE KEY date.
DATA: gt_data TYPE tt_data,
gt_data2 type tt_data,
gt_cols TYPE tt_cols,
gs_col TYPE ty_cols.
DATA: go_sdescr TYPE REF TO cl_abap_structdescr,
go_sdescr_new TYPE REF TO cl_abap_structdescr,
go_tdescr TYPE REF TO cl_abap_tabledescr,
gdo_handle TYPE REF TO data,
gs_component TYPE abap_compdescr,
gs_comp TYPE abap_componentdescr,
gt_components TYPE abap_component_tab,
gr_data TYPE REF TO cl_salv_table,
gr_funct TYPE REF TO cl_salv_functions,
gr_columns TYPE REF TO cl_salv_columns_table,
gr_column TYPE REF TO cl_salv_column_table,
g_col TYPE lvc_fname,
g_txt TYPE scrtext_l.
FIELD-SYMBOLS: <t_data> TYPE ANY TABLE,
<s_data> TYPE any,
<c> TYPE any,
<d> TYPE ty_data.
DATA: pono TYPE ztecerti-pono,
jobno TYPE ztecerti-jobno,
sdk TYPE string,
insert TYPE c,
ok_code LIKE sy-ucomm.
CALL SCREEN 100.
START-OF-SELECTION.
* Populate test data
FORM get_data.
SELECT A~ARBID
A~BUDAT
A~WERKS
A~LMNGA
A~AUFNR
B~KDAUF
B~KDPOS
C~VBELN
C~KUNNR
D~NAME1
E~MATNR
F~KDKG1
INTO CORRESPONDING FIELDS OF TABLE gt_data
FROM AFRU AS A INNER JOIN AUFK AS B ON A~AUFNR EQ B~AUFNR
INNER JOIN VBAK AS C ON B~KDAUF = C~VBELN
INNER JOIN KNA1 AS D ON C~KUNNR = D~KUNNR
INNER JOIN VBAP AS E ON B~KDAUF = E~VBELN
INNER JOIN VBKD AS F ON B~KDAUF = F~VBELN
WHERE A~ARBID = '10000181' AND A~BUDAT BETWEEN PONO AND jobno
GROUP BY A~ARBID A~LMNGA A~BUDAT A~WERKS A~AUFNR B~KDAUF F~KDKG1 E~MATNR D~NAME1 C~KUNNR C~VBELN B~KDPOS
ORDER BY B~KDPOS.
*collect gt_data into gt_data2.
*gt_data
*LOOP AT gt_data ASSIGNING <d>.
ENDFORM.
Thanking you i realy need it badly
Answer is fully given here: Re: alv grid Cross Tab Issue....
m.
Similar Messages
-
We collected data using NI in the Labview environment and created tdms document. Is there a reader for reading the data in Matlab environment?
A search will often turn up results.
Reading TDM/TDMS Files with The MathWorks, Inc. MATLAB® Software -
ALV Grid editable - How to raise the data_changed event from outside object
Hi,
i'd like to like to raise the data_changed event from outside the ALV-Grid object in order to display errors to the user.
For example a new row was inserted within the program. The user has only to complete the missing informations. Before saving the transactions the program has to execute some semantic checks. The errors of this check process should be shown to the user by creating an instance of the cl_alv_changed_data_portocol object.
Thanks.
RegardsYou don't need to raise the data_changed event to perform the edits or to issue messages using cl_alv_changed_data_protocol.
The following assumes you have an ALV grid object g_alv based on the CL_GUI_ALV_GRID class.
You can mark the inserted records upon insertion as selected using the set_selected_rows method, and then retrieve these rows later using get_selected_rows and perform necessary edits.
Save the row number of each inserted row into a table of the appropriate type (see the method definition for this):
DATA: t_index_rows TYPE lvc_t_row.
DATA: s_row_no TYPE lvc_s_roid.
DATA: t_row_no TYPE lvc_t_roid.
Load entries into t_row_no after each insert. Capture the row number and save in the table t_row_no.
e.g.
PERFORM insert_row USING s_row_no-row_id.
APPEND s_row_no TO t_row_no.
FORM insert_row would have whatever code you are using to insert the row. Save the row id into s_row_no-row_id (which is an INT4).
When done with all inserts do the following
IF t_row_no[] IS NOT INITIAL.
CALL METHOD g_alv->set_selected_rows
EXPORTING
it_index_rows = t_index_rows
it_row_no = t_row_no
is_keep_other_selections = 'X'.
ENDIF.
Then, if SAVE is pressed without the data_changed event having been raised (such as if the user just pressed SAVE without changing anything), use method get_selected_rows to retrieve the rows that were inserted and perform the necessary edits.
DATA: l_t_rows TYPE lvc_t_row. " ALV control: Table rows
CALL METHOD g_alv->get_selected_rows
IMPORTING
et_index_rows = l_t_rows.
Loop through l_t_rows and use the row as an index into the grid, perform the necessary edits, just as you would if the data_changed event had been raised.
If any edits fail, then send messages to the user, abort the save, and re-display the grid.
Remember to refresh the t_row_no and t_index_rows tables if you load a new data set.
You can also use a similar technique with the data_changed event to mark each changed row as selected by saving the row ids, and then you only have to update the changed rows on SAVE, which can minimize database I/O.
Good luck.
Brian -
Gui_download for transferring the data from internal table to excel sheet.
hi all,
i am using gui_download for transferring the data from internal table to excel sheet.
I have a internal table with 3 columns col1,col2,col3 and I am getting the file at the specified path,but my problem is that,in the excel sheet(path specified) all the 3 columns values are printed in one column.Please help me.
Thanks in advance.Hi Venkata,
plz use FM 'SAP_CONVERT_TO_XLS_FORMAT' :
call function 'SAP_CONVERT_TO_XLS_FORMAT'
exporting
* I_FIELD_SEPERATOR =
* I_LINE_HEADER =
i_filename = p_file
* I_APPL_KEEP = ' '
tables
i_tab_sap_data = t_mbew
* CHANGING
* I_TAB_CONVERTED_DATA =
* EXCEPTIONS
* CONVERSION_FAILED = 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.
Hope this helps,
Erwan -
Lock NOT set for: Archiving the data from a data target
Dear Expert,
I try to archive one of my info cube, when i start to write the Archive file the Free Space in the Archive folder not enough and it make the process error.
Then i try to changes the Archive folder to another path with enough free space. But when i start to write the archive file with new variant this error message came up :
==============================================================
An archiving run locks InfoProvider ZICCPS810 (archivation object BWCZICCP~0)
Lock NOT set for: Archiving the data from a data target
InfoProvider ZICCPS810 could not be locked for an archiving session
Job cancelled after system exception ERROR_MESSAGE
==============================================================
Please Help Me.
Wawan SHi Wawan,
If the earlier archive session resulted in error, please try to invalidate the earlier session in archive management and try running archive job again.
Hope this helps,
Naveen -
Query taking long time for EXTRACTING the data more than 24 hours
Hi ,
Query taking long time for EXTRACTING the data more than 24 hours please find the query and explain plan details below even indexes avilable on table's goe's to FULL TABLE SCAN. please suggest me.......
SQL> explain plan for select a.account_id,round(a.account_balance,2) account_balance,
2 nvl(ah.invoice_id,ah.adjustment_id) transaction_id,
to_char(ah.effective_start_date,'DD-MON-YYYY') transaction_date,
to_char(nvl(i.payment_due_date,
to_date('30-12-9999','dd-mm-yyyy')),'DD-MON-YYYY')
due_date, ah.current_balance-ah.previous_balance amount,
decode(ah.invoice_id,null,'A','I') transaction_type
3 4 5 6 7 8 from account a,account_history ah,invoice i_+
where a.account_id=ah.account_id
and a.account_type_id=1000002
and round(a.account_balance,2) > 0
and (ah.invoice_id is not null or ah.adjustment_id is not null)
and ah.CURRENT_BALANCE > ah.previous_balance
and ah.invoice_id=i.invoice_id(+)
AND a.account_balance > 0
order by a.account_id,ah.effective_start_date desc; 9 10 11 12 13 14 15 16
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)|
| 0 | SELECT STATEMENT | | 544K| 30M| | 693K (20)|
| 1 | SORT ORDER BY | | 544K| 30M| 75M| 693K (20)|
|* 2 | HASH JOIN | | 544K| 30M| | 689K (20)|
|* 3 | TABLE ACCESS FULL | ACCOUNT | 20080 | 294K| | 6220 (18)|
|* 4 | HASH JOIN OUTER | | 131M| 5532M| 5155M| 678K (20)|
|* 5 | TABLE ACCESS FULL| ACCOUNT_HISTORY | 131M| 3646M| | 197K (25)|
| 6 | TABLE ACCESS FULL| INVOICE | 262M| 3758M| | 306K (18)|
Predicate Information (identified by operation id):
2 - access("A"."ACCOUNT_ID"="AH"."ACCOUNT_ID")
3 - filter("A"."ACCOUNT_TYPE_ID"=1000002 AND "A"."ACCOUNT_BALANCE">0 AND
ROUND("A"."ACCOUNT_BALANCE",2)>0)
4 - access("AH"."INVOICE_ID"="I"."INVOICE_ID"(+))
5 - filter("AH"."CURRENT_BALANCE">"AH"."PREVIOUS_BALANCE" AND ("AH"."INVOICE_ID"
IS NOT NULL OR "AH"."ADJUSTMENT_ID" IS NOT NULL))
22 rows selected.
Index Details:+_
SQL> select INDEX_OWNER,INDEX_NAME,COLUMN_NAME,TABLE_NAME from dba_ind_columns where
2 table_name in ('INVOICE','ACCOUNT','ACCOUNT_HISTORY') order by 4;
INDEX_OWNER INDEX_NAME COLUMN_NAME TABLE_NAME
OPS$SVM_SRV4 P_ACCOUNT ACCOUNT_ID ACCOUNT
OPS$SVM_SRV4 U_ACCOUNT_NAME ACCOUNT_NAME ACCOUNT
OPS$SVM_SRV4 U_ACCOUNT CUSTOMER_NODE_ID ACCOUNT
OPS$SVM_SRV4 U_ACCOUNT ACCOUNT_TYPE_ID ACCOUNT
OPS$SVM_SRV4 I_ACCOUNT_ACCOUNT_TYPE ACCOUNT_TYPE_ID ACCOUNT
OPS$SVM_SRV4 I_ACCOUNT_INVOICE INVOICE_ID ACCOUNT
OPS$SVM_SRV4 I_ACCOUNT_PREVIOUS_INVOICE PREVIOUS_INVOICE_ID ACCOUNT
OPS$SVM_SRV4 U_ACCOUNT_NAME_ID ACCOUNT_NAME ACCOUNT
OPS$SVM_SRV4 U_ACCOUNT_NAME_ID ACCOUNT_ID ACCOUNT
OPS$SVM_SRV4 I_LAST_MODIFIED_ACCOUNT LAST_MODIFIED ACCOUNT
OPS$SVM_SRV4 I_ACCOUNT_INVOICE_ACCOUNT INVOICE_ACCOUNT_ID ACCOUNT
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ACCOUNT ACCOUNT_ID ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ACCOUNT SEQNR ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_INVOICE INVOICE_ID ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ADINV INVOICE_ID ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_CIA CURRENT_BALANCE ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_CIA INVOICE_ID ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_CIA ADJUSTMENT_ID ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_CIA ACCOUNT_ID ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_LMOD LAST_MODIFIED ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ADINV ADJUSTMENT_ID ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_PAYMENT PAYMENT_ID ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ADJUSTMENT ADJUSTMENT_ID ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_APPLIED_DT APPLIED_DATE ACCOUNT_HISTORY
OPS$SVM_SRV4 P_INVOICE INVOICE_ID INVOICE
OPS$SVM_SRV4 U_INVOICE CUSTOMER_INVOICE_STR INVOICE
OPS$SVM_SRV4 I_LAST_MODIFIED_INVOICE LAST_MODIFIED INVOICE
OPS$SVM_SRV4 U_INVOICE_ACCOUNT ACCOUNT_ID INVOICE
OPS$SVM_SRV4 U_INVOICE_ACCOUNT BILL_RUN_ID INVOICE
OPS$SVM_SRV4 I_INVOICE_BILL_RUN BILL_RUN_ID INVOICE
OPS$SVM_SRV4 I_INVOICE_INVOICE_TYPE INVOICE_TYPE_ID INVOICE
OPS$SVM_SRV4 I_INVOICE_CUSTOMER_NODE CUSTOMER_NODE_ID INVOICE
32 rows selected.
Regards,
Bathula
Oracle-DBAI have some suggestions. But first, you realize that you have some redundant indexes, right? You have an index on account(account_name) and also account(account_name, account_id), and also account_history(invoice_id) and account_history(invoice_id, adjustment_id). No matter, I will suggest some new composite indexes.
Also, you do not need two lines for these conditions:
and round(a.account_balance, 2) > 0
AND a.account_balance > 0
You can just use: and a.account_balance >= 0.005
So the formatted query isselect a.account_id,
round(a.account_balance, 2) account_balance,
nvl(ah.invoice_id, ah.adjustment_id) transaction_id,
to_char(ah.effective_start_date, 'DD-MON-YYYY') transaction_date,
to_char(nvl(i.payment_due_date, to_date('30-12-9999', 'dd-mm-yyyy')),
'DD-MON-YYYY') due_date,
ah.current_balance - ah.previous_balance amount,
decode(ah.invoice_id, null, 'A', 'I') transaction_type
from account a, account_history ah, invoice i
where a.account_id = ah.account_id
and a.account_type_id = 1000002
and (ah.invoice_id is not null or ah.adjustment_id is not null)
and ah.CURRENT_BALANCE > ah.previous_balance
and ah.invoice_id = i.invoice_id(+)
AND a.account_balance >= .005
order by a.account_id, ah.effective_start_date desc;You will probably want to select:
1. From ACCOUNT first (your smaller table), for which you supply a literal on account_type_id. That should limit the accounts retrieved from ACCOUNT_HISTORY
2. From ACCOUNT_HISTORY. We want to limit the records as much as possible on this table because of the outer join.
3. INVOICE we want to access last because it seems to be least restricted, it is the biggest, and it has the outer join condition so it will manufacture rows to match as many rows as come back from account_history.
Try the query above after creating the following composite indexes. The order of the columns is important:create index account_composite_i on account(account_type_id, account_balance, account_id);
create index acct_history_comp_i on account_history(account_id, invoice_id, adjustment_id, current_balance, previous_balance, effective_start_date);
create index invoice_composite_i on invoice(invoice_id, payment_due_date);All the columns used in the where clause will be indexed, in a logical order suited to the needs of the query. Plus each selected column is indexed as well so that we should not need to touch the tables at all to satisfy the query.
Try the query after creating these indexes.
A final suggestion is to try larger sort and hash area sizes and a manual workarea policy.alter session set workarea_size_policy = manual;
alter session set sort_area_size = 2147483647;
alter session set hash_area_size = 2147483647; -
Which Function Module is used for converting the DATE in BDC
HI,
Which Function Module is used for converting the DATE Format in BDC for Uploading purpose please help me.data : date like sy-datum.
data : odate(10) type c.
date = sy-datum. " in format YYYYMMDD
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = date
IMPORTING
OUTPUT = odate .
write:/ odate. "in ur format '.
1.
In ur itab make a field for date as 10 characters and use this Fm to store the date .
2. Pass the date as the charcter field to the screen and now check . -
Are there any standard Idocs or Bapis for posting the data into transaction
Hi,
Are there any standard Idocs or Bapis for posting the data into transactions ME42N and IK11?
Thank You.Thank you.
Any idea of the other one? -
Does anyone know for sure the date that OS X Lion will be released?
I've heard rumours about Lion being released on the 14th/9th but I would like to know if anyone knows for SURE the date and if possible, time that OS X Lion will be released?
ThanksApple hasn't announced a specific date. Anything that you might find indicating a release date is speculation. The good thing is that, since Lion is a download, it will be available immediately after it is announced (providing Apple's servers can handle the demand).
-
Hello Sir I have an iPhone 4 and when i updated that it got updated but now for restore the data it is showing me the message The "iPhone" could not be activated because an unknown error occurred (0xE8000004). Please try again later. please help me.
Hello Amarchand Sharma,
Are you working with a Windows computer? If so, the resource below may help you troubleshoot the issue you are having restoring your iPhone.
iOS: Unknown error containing '0xE' when connecting to a Windows PC - Apple Support
http://support.apple.com/en-us/TS3221
Regards,
Judy -
Can anyone confirm the date used for pushing the data into AR interface table? Is it abse don Actual ship date or scheduled ship date? We are facing a scenario where trx date is lower than the actual ship to which logically sounds incorrect.
Appreciate any quick response around this.Hi,
Transaction date will be your autoinvoice master program submission level date (If you haven't setup any logic.
Please check the program level default date, if user enter old date ststem will pick the same.
Customer is trying to set the value of the profile OM:Set receivables transaction date as current date for non-shippable lines at the responsiblity level. System does not set the transaction date to current date in ra_interface_lines_all.
CAUSE
Customer has used the functionality in R11i. But after the upgrade to R12, the system functions differently than R11i.
SOLUTION
1.Ensure that there are no scheduled workflow background process run.
2.Set the profile "OM: Set Receivables Transaction Date as Current Date for Non-Shippable Lines" at Responsibility level only as Yes.
3.Now switch the responsibility to which the profile is set.
4.Create order for Non-Shippable Lines and progress it to invoicing.
5.Ensure that the 'workflow background process' concurrent program is run in the same responsibility and this line is considered in it.
6.Now check if the 'SHIP_DATE_ACTUAL' is populated to ra_interface_lines_all -
FM for uploading the data in infotype
Dear Friends,
I need a example how i can use the FM(HR_MAINTAIN_MASTERDATA,HR_INFOTYPE_OPERATION) for uploading the data in multiple infotypes at a time.
I have a data in internal table now how i should pass the infotype no in the FM am not aware of that kindly help meee.
And also my personnal no is internal ,how i pass in the FM.
How i pass the remaning values .....
my code ......
Loop at it_employee into wa_employee.
CALL FUNCTION 'HR_MAINTAIN_MASTERDATA'
EXPORTING
PERNR = '00000000'
MASSN = wa_employee-MASSN
ACTIO = 'INS'
TCLAS = 'A'
BEGDA = SY-DATUM
ENDDA = '99991231'
OBJPS =
SEQNR =
SPRPS =
SUBTY =
WERKS = wa_employee-WERKS
PERSG = wa_employee-PERSG
PERSK = wa_employee-PERSK
PLANS = wa_employee-PLANS
DIALOG_MODE = '1'
LUW_MODE = '1'
NO_EXISTENCE_CHECK = 'X '
NO_ENQUEUE = 'X'
IMPORTING
RETURN = t_return
RETURN1 =
HR_RETURN =
TABLES
proposed_values = it_employee.
MODIFIED_KEYS =
write : / t_return.
thanks
sandeepHi
you have to open one more gl account for intial upload.
E.g. If you have the debit balance of Gl alc 50000 in legacy system, then the entry should be:
Dr 50000alc $100
Cr initial Upload alc $100.
if you want futher explaination let me know, i will explain in detail.
Thanks & Regards,
Reva naik. -
Check box in ALV grid gets unselected for new selection
Hi all,
This is my code :
TYPE-POOLS : slis.
Variable
DATA: g_repid LIKE sy-repid,
g_title TYPE lvc_title,
g_set_pf_stat TYPE slis_formname VALUE 'SET_PF_STATUS',
g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
g_layout TYPE slis_layout_alv,
g_print_alv TYPE slis_print_alv,
g_variant LIKE disvariant,
c_char_a(1) VALUE 'A',
c_char_x(1) VALUE 'X',
itab_alv_sort TYPE slis_t_sortinfo_alv,
itab_alv_fcat TYPE slis_t_fieldcat_alv,
fm_name type rs38l_fnam," Function Module Name
* l_sfctrlparams LIKE ssfctrlop, " Form Print Parameter
* l_sfoutopt LIKE ssfcompop,
pri_params LIKE pri_params,
c_x type c .
* Internal tables Begin with IT_ *
DATA : it_fcat TYPE SLIS_T_FIELDCAT_ALV, "---ALV
it_disp type table of ZLOI.
* Work Area for Internal tables Begin with WA_ *
data : wa_fcat TYPE slis_fieldcat_alv , "---ALV
wa_layout TYPE lvc_s_layo, "---ALV
wa_it_disp like line of it_disp.
* Objects *
DATA : cref TYPE REF TO cl_gui_custom_container, "---ALV
gref TYPE REF TO cl_gui_alv_grid. "---ALV
* Start-of-selection
Start-of-selection.
perform fetch_po_det.
perform build_fcat.
perform alv_display.
*& Form FETCH_PO_DET
* text
* --> p1 text
* <-- p2 text
FORM FETCH_PO_DET .
data : it_po type table of crmd_orderadm_h,
wa_po like line of it_po,
wa_header type BBP_PDS_PO_HEADER_D.
select guid
object_id
DESCRIPTION
POSTING_DATE
CREATED_BY
from crmd_orderadm_h
into corresponding fields of table it_po
where object_type = 'BUS2201'.
loop at it_po into wa_po.
move wa_po-object_id to wa_it_disp-ZZPONO.
move wa_po-DESCRIPTION to wa_it_disp-ZZPODESC.
move wa_po-posting_date to wa_it_disp-ZZPODATE.
move wa_po-created_by to wa_it_disp-ZZPOCREATOR.
CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
EXPORTING
I_OBJECT_ID = wa_it_disp-zzpono
IMPORTING
E_HEADER = wa_header.
move wa_header-total_value to wa_it_disp-ZZPOVAL.
move wa_header-currency to wa_it_disp-ZZPOCUR.
append wa_it_disp to it_disp.
endloop.
* write : wa_it_disp-zzpono.
ENDFORM. " FETCH_PO_DET
*& Form BUILD_FCAT
* text
* --> p1 text
* <-- p2 text
FORM BUILD_FCAT .
g_repid = sy-repid.
g_title = 'LOI details'.
g_print_alv-no_print_listinfos = 'X'.
g_variant-report = sy-repid.
g_variant-variant = sy-title.
CLEAR g_layout.
g_layout-f2code = ' '.
wa_layout-zebra = 'X'.
g_layout-flexible_key = 'X'.
g_layout-colwidth_optimize = 'X'.
g_layout-detail_initial_lines = 'X'.
g_layout-box_fieldname = 'ZZCHECK'.
*g_layout-box_tabname = 'ITAB_REPORT'.
*Check box
wa_fcat-fieldname = 'ZZCHECK'.
wa_fcat-checkbox = 'X'.
wa_fcat-outputlen = '1'.
wa_fcat-col_pos = '1'.
wa_fcat-edit = '1'.
wa_fcat-seltext_m = 'No'.
append wa_fcat to it_fcat.
*Po no
clear wa_fcat.
wa_fcat-fieldname = 'ZZPONO' .
wa_fcat-tabname = 'IT_DISP'.
* wa_fcat-seltext = 'Purchase Order'.
wa_fcat-seltext_m = 'Purchase Order'.
*wa_fcat-seltext_s = 'Purchase Order.
wa_fcat-icon = 'X'.
wa_fcat-col_pos = '2'.
wa_fcat-outputlen = 10.
append wa_fcat to it_fcat.
*Desc
wa_fcat-fieldname = 'ZZPODESC' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'Description'.
wa_fcat-seltext_m = 'Description'.
*wa_fcat-seltext_s = 'Description'.
wa_fcat-col_pos = '3'.
wa_fcat-outputlen = 10.
append wa_fcat to it_fcat.
*Postign date
wa_fcat-fieldname = 'ZZPODATE' .
wa_fcat-tabname = 'IT_DISP'.
wa_fcat-seltext_l = 'Posting Date'.
wa_fcat-seltext_m = 'Posting Date'.
*wa_fcat-seltext_s = 'Posting Date'.
wa_fcat-col_pos = '4'.
wa_fcat-outputlen = 8.
append wa_fcat to it_fcat.
*value
wa_fcat-fieldname = 'ZZPOVAL' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'PO value'.
wa_fcat-seltext_m = 'PO value'.
*wa_fcat-seltext_s = 'PO value'.
wa_fcat-col_pos = '5'.
wa_fcat-outputlen = 15.
append wa_fcat to it_fcat.
*Currency
wa_fcat-fieldname = 'ZZPOCUR' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'PO Currency'.
wa_fcat-seltext_m = 'PO Currency'.
*wa_fcat-seltext_s = 'PO Currency'.
wa_fcat-col_pos = '6'.
wa_fcat-outputlen = 5.
append wa_fcat to it_fcat.
*Creator
wa_fcat-fieldname = 'ZZPOCREATOR' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'Buyer'.
wa_fcat-seltext_m = 'Buyer'.
*wa_fcat-seltext_s = 'Buyer'.
wa_fcat-col_pos = '7'.
wa_fcat-outputlen = 12.
append wa_fcat to it_fcat.
ENDFORM. " BUILD_FCAT
*& Form ALV_DISPLAY
* text
* --> p1 text
* <-- p2 text
FORM ALV_DISPLAY .
sort it_disp by ZZPONO.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = g_repid
I_CALLBACK_PF_STATUS_SET = g_set_pf_stat
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 = g_title
* I_GRID_SETTINGS =
IS_LAYOUT = g_layout
IT_FIELDCAT = it_fcat[]
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
IS_VARIANT = g_variant
* IT_EVENTS =
* IT_EVENT_EXIT =
IS_PRINT = g_print_alv
* 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_disp[]
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. " ALV_DISPLAY
*& Form user_command
* text
* -->R_UCOMM text
* -->RS_SELFIELD text
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield. "#EC CALLED
CASE R_UCOMM.
WHEN 'PRINT'.
READ TABLE IT_disp INTO WA_IT_DISP WITH KEY ZZCHECK = 'X'.
IF SY-SUBRC EQ 0.
loop at it_DISP INTO WA_IT_DISP.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TEXT_QUESTION = 'Print the LOI details?'
TEXT_BUTTON_1 = 'Yes'
TEXT_BUTTON_2 = 'No'.
* IMPORTING
* ANSWER = w_answer.
IF SY-SUBRC 0.
ENDIF.
* PERFORM CALL_SF.
endloop.
ENDIF.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE PROGRAM.
ENDCASE.
rs_selfield-refresh = 'X'.
ENDFORM. "user_command
*& Form set_pf_status
* text
* -->RT_EXTAB text
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTANDARD' EXCLUDING rt_extab.
SET TITLEBAR sy-tcode.
ENDFORM. "set_pf_status
Now in my ALV grid o/p i can see the check box but if i select one row and then try to slect another the first one gets deselected.
Can anybody tell me what is missing?Hi,
if you need just a check box for each line, try to get rid of this line from your layout.
g_layout-box_fieldname = 'ZZCHECK'.
SAP uses this field to store info about selected lines. Hence you click on the second check box, you select different line and the first line is erased. You can select more line by holding SHIFT + CTRL
Cheers -
ALV GRID WITH SUMMATORIES DEPEND OF THE SELECTION
Hi Experts.
I have a form, in which depend of the selection, I show to user a fieldcatalog with the data (query) that the user want to see in that moment ...
The problem is that the user want to see one field (amount, sum total (money) ...etc) with summatories, group by date, person...or other depend of the selection he has done in the select dynpro.
How can I do it when I show the ALV??... The user don't want to use the option to make a lot of select dispositions in the ALV..., he want to see the disposition of the data depend the selection he do in the select dynpro.
I see when I create the fieldcatalog to the ALV GRID, there is a field ... do_sum, I have marked it, in the field which I want to do a summatory but don't do anything in the ALV when display.... and don't find how indicate in the fieldcatalog the field which I wan't group by...
Other options, that I have thought it's to make a lot of dispositions in ALV, and when display de ALV try to get the disposition that I want ... but I haven't did it.
Thanks.Hi all,
it is maybe too late to answer this question but I hope it can serve someone who bumps into this problem in the future.
I managed to activate the functions with the following code:
DATA alv TYPE REF TO cl_salv_table.
DATA: lo_functions TYPE REF TO cl_salv_functions_list.
DATA: lo_funcs TYPE salv_t_ui_func.
DATA: lo_func TYPE salv_s_ui_func.
cl_salv_table=>factory(
IMPORTING r_salv_table = alv
CHANGING t_table = <fs> ).
* Default Functions
lo_functions = alv->get_functions( ).
lo_funcs = lo_functions->get_functions( ).
* loop through all functions and enable them and set them visible.
* here u can also activate separate functions if you check the name with the method from r_function (CL_SALV_FUNCTION->GET_NAME)
LOOP AT lo_funcs INTO lo_func.
lo_func-r_function->set_enable( value = 'X' ).
lo_func-r_function->set_visible( value = 'X' ).
ENDLOOP.
alv->display( ).
Cheers,
Ilina -
ALV grid with 2 labels on the output
Hi,
I am trying ALV Grid with two labels using Function modules.
in the output, it should appear like...
Header1 | Header2 | Header3 | Header4 |
T21
T22
T31
T32
First line is for Header lable and second line is for item lable under corresponding Header labels.
Pls. can any suggest me a solution for this..
Thanks
PRaUsing the Gird Functions it is not possible, you can get the with the help of ALV list function.
If you use this aproach you will loose some Functionalities, Your Report Output will Distorted.
cehck this image..
http://img100.imageshack.us/img100/3846/output6ef.th.gif
REPORT ZTEST_ALV message-id zz .
TYPE-POOLS: SLIS.
DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
L_LAYOUT type slis_layout_alv,
x_events type slis_alv_event,
it_events type SLIS_T_EVENT.
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
MALE type i,
female type i,
END OF ITAB.
SELECT VBELN
POSNR
FROM VBAP
UP TO 20 ROWS
INTO TABLE ITAB.
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-SELTEXT_L = 'VBELN'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 1.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-SELTEXT_L = 'POSNR'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 2.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'MALE'.
X_FIELDCAT-SELTEXT_L = 'MALE'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 3.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'FEMALE'.
X_FIELDCAT-SELTEXT_L = 'FEMALE'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 3.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
x_events-NAME = SLIS_EV_TOP_OF_PAGE.
x_events-FORM = 'TOP_OF_PAGE'.
APPEND x_events TO iT_EVENTS.
CLEAR x_events .
L_LAYOUT-NO_COLHEAD = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = L_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
it_events = it_events
TABLES
T_OUTTAB = ITAB
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 TOP_OF_PAGE.
*-To display the headers for main list
FORMAT COLOR COL_HEADING.
WRITE: / SY-ULINE(103).
WRITE: / SY-VLINE,
(8) ' ' ,
SY-VLINE,
(8) ' ' ,
SY-VLINE,
(19) '***'(015) centered,
sy-vline.
WRITE: / SY-VLINE,
(8) 'VBELN'(013) ,
SY-VLINE,
(8) 'POSNR'(014) ,
SY-VLINE,
(8) 'MALE'(016) ,
sy-vline,
(8) 'FMALE'(017) ,
sy-vline.
FORMAT COLOR OFF.
ENDFORM.
Maybe you are looking for
-
Westell USB 802.11g adapter with an Imac?
I just switched to a new DSL provider who sold me a wireless router and a USB adapter. They are both made by Westell. I have my laptop running wireless no problem as well as anohter machine runing ethernet fine. But I have an Imac running 10.3.2 that
-
Slow iMac Due To activitymonitord eating %cpu
Hello to all, My iMac (Intel, OSX 10.7.5) got molasses slow (dropdown menus taking 30 seconds to drop down, etc.). Nothing to do with internet, upload, download; all "internal" Mac stuff. This did not occur gradually over time, but abruptly all of a
-
Monitoring traffic but not use IP SLA
Dear everyone, I have a problem. I make a leased line between ISP (Service Provider) to Customer. And customer want to monitor traffic on this link. I can use IP SLA to do it. But now, customer don't agree to open ICMP on this link so IP SLA fall Can
-
Trying to backup my computer but getting this message "The backup disk image "/Volumes/Lisa Liberman's Time Capsul/Stuart Liberman's MacBook Pro.sparsebundle" is already in use." It is not currently backing up my other computers. How do I fix it?
-
I have been using iWeb (current version 3.0.1) to create and publish the same website for years. Just yesterday my desktop mac would not open the current domain. I use a portable drive to store all the website information. I tried the domain on my ma