Rows missing in ALV output compared to internal table (was "ALV issue")
Hi guys,
I am getting an ALV for 70 rows whereas the internal table I am passing has 120 rows.
Any idea why I could be facing this issue.Has anyone ever faced something similar?
Thanks,
Chirantan
Moderator message: please use more descriptive subject lines for your posts.
Edited by: Thomas Zloch on May 9, 2011 9:51 AM
BY default, maximum number of coulmns displayed in ALV is 90.
You can increase it by setting the parameter NO_OUT as initial for the remaining fields in their field catalog.
Please check below sample code:
"Build Field catalog using structure of QALS
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_structure_name = 'QALS'
CHANGING
ct_fieldcat = g_t_fcat " Internal table contains more than 90 fields
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
"Only first 90 fields will be displayed in output. So, set NO_OUT as initial for remaining fields.
LOOP AT g_t_fcat INTO g_r_fcat WHERE no_out = 'X'.
g_r_fcat-no_out = ''. " Set NO_OUT as initial
MODIFY g_t_fcat FROM g_r_fcat INDEX sy-tabix TRANSPORTING no_out.
ENDLOOP.
Similar Messages
-
Unable to Capture ALV output in an Internal Table, after CALL TRANSACTION
Dear all,
My requirement is to run multiple materials in T-code CK86_99 but as we know CK86_99 is only adequate to one material at a time.
So, I want to capture the Output of the T-code in my Internal table with respect to all the Material Numbers I use in the Select-Options of my Z Program.
Below is the Code I developed so far, but the Class
cl_salv_bs_runtime_info=>get_data_ref(
IMPORTING r_data = lf_ref ).
is not capturing the Ouput...
Please have a look and enlighten me how it could be solved.
TABLES : mara.
DATA : BEGIN OF wa_mara,
matnr TYPE mara-matnr,
END OF wa_mara.
DATA: it_bdcdata TYPE TABLE OF bdcdata,
wa_it_bdcdata LIKE LINE OF it_bdcdata,
it_mara LIKE TABLE OF wa_mara.
* BELNR(10).
FIELD-SYMBOLS:<fs_tab> TYPE ANY TABLE,
<fs_line> TYPE any.
DATA:lf_ref TYPE REF TO data,
lf_ref1 TYPE REF TO data.
SELECT-OPTIONS so_matnr FOR mara-matnr.
PARAMETERS p_werks LIKE t001w-werks.
*BELNR = 'Z92'. " Give Document Number here
SELECT matnr FROM mara INTO TABLE it_mara WHERE matnr IN so_matnr.
DATA opt TYPE ctu_params.
LOOP AT it_mara INTO wa_mara.
CLEAR wa_it_bdcdata.
wa_it_bdcdata-program = 'SAPMKKB0'.
wa_it_bdcdata-dynpro = '0300'.
wa_it_bdcdata-dynbegin = 'X'.
APPEND wa_it_bdcdata TO it_bdcdata.
CLEAR wa_it_bdcdata.
wa_it_bdcdata-fnam = 'BDC_CURSOR'.
wa_it_bdcdata-fval = 'KKB0-MATNR'.
APPEND wa_it_bdcdata TO it_bdcdata.
CLEAR wa_it_bdcdata.
wa_it_bdcdata-fnam = 'KKB0-MATNR'.
wa_it_bdcdata-fval = wa_mara-matnr.
APPEND wa_it_bdcdata TO it_bdcdata.
CLEAR wa_it_bdcdata.
wa_it_bdcdata-fnam = 'BDC_CURSOR'.
wa_it_bdcdata-fval = 'KKB0-WERKS'.
APPEND wa_it_bdcdata TO it_bdcdata.
CLEAR wa_it_bdcdata.
wa_it_bdcdata-fnam = 'KKB0-WERKS'.
wa_it_bdcdata-fval = p_werks.
APPEND wa_it_bdcdata TO it_bdcdata.
CLEAR wa_it_bdcdata.
wa_it_bdcdata-fnam = 'BDC_OKCODE'.
wa_it_bdcdata-fval = 'OSNY'."'ONLI'."=CRET'.
APPEND wa_it_bdcdata TO it_bdcdata.
* CLEAR wa_it_bdcdata.
* wa_it_bdcdata-program = 'SAPLKKRSOO'.
* wa_it_bdcdata-dynpro = '0100'.
* wa_it_bdcdata-dynbegin = 'X'.
* APPEND wa_it_bdcdata TO it_bdcdata.
* CLEAR wa_it_bdcdata.
* wa_it_bdcdata-fnam = 'BDC_OKCODE'.
* wa_it_bdcdata-fval = 'BACK'."=CRET'.
* APPEND wa_it_bdcdata TO it_bdcdata.
* CLEAR wa_it_bdcdata.
* wa_it_bdcdata-program = 'SAPMKKB0'.
* wa_it_bdcdata-dynpro = '0300'.
* wa_it_bdcdata-dynbegin = 'X'.
* APPEND wa_it_bdcdata TO it_bdcdata.
* CLEAR wa_it_bdcdata.
* wa_it_bdcdata-fnam = 'BDC_OKCODE'.
* wa_it_bdcdata-fval = 'EXIT'."=CRET'.
* APPEND wa_it_bdcdata TO it_bdcdata.
opt-dismode = 'N'.
cl_salv_bs_runtime_info=>set(
EXPORTING display = abap_false
metadata = abap_true
data = abap_true ).
CALL TRANSACTION 'CK86_99' USING it_bdcdata OPTIONS FROM opt.
TRY.
cl_salv_bs_runtime_info=>get_data_ref(
IMPORTING r_data = lf_ref ).
ASSIGN lf_ref->* TO <fs_tab>.
CATCH cx_salv_bs_sc_runtime_info.
MESSAGE 'Unable to retrieve ALV data' TYPE 'E'.
ENDTRY.
cl_salv_bs_runtime_info=>clear_all( ).
IF <fs_tab> IS ASSIGNED.
CREATE DATA lf_ref1 LIKE LINE OF <fs_tab>.
ASSIGN lf_ref1->* TO <fs_line>.
ENDIF.
*LOOP AT <FS_TAB> ASSIGNING <FS_LINE>.
*ENDLOOP.Hi Abhay,
If you go to Transaction code SE93, enter the tcode "CK86_99" and click display, you may see the default value for transaction is "KKBB" and the screen field for P_SCREEN = 0300, P_TCODE = ck86_99.
You may need to copy the transaction code "KKBB" and go to SE93 again, enter the tcode for "KKBB" then click display, now you may see the program name is "RKKB1000".
Hope this answer your question.
Thanks
Hock Lin -
How to get total in ALV report in same Internal table?
Data : Begin of it_data,
kunnr type kunnr,
name1 type name1,
amt1 type btrt01, " CURR 15,2
end of it_data.
loop at it_data into wa_data
endloop.
Hello friends,
I am developing one ALV report with 20 rows.
I have filled one internal table with some fileds like amount.
I want to get total of all amount1 in AMT1 field.
So, How to get total of amount in same internal table in ALV report ?
It is ok if i get duplicate rows in internal table.
Points 'll be awarded soon.
Regards,
NVMHi Ronny,
the alv output will display the sum at the last row.
for this functionality u have do this logic.
data: lw_fcat type slis_fieldcat_alv.
data: lt_fcat type slis_t_fieldcat_alv/
wa_fcat-fieldname = 'AMT1'.
wa_fcat-tabname = 'ITAB'.
wa_fcat-do_sum = 'X'.
append wa_fcat to lt_fcat.
and then pass it to reuse_alv_grid_display function,
regards,
Santosh Thorat -
SUBMIT and RETUTN with ALV output into a interanl table.
Hello Friends,
I have one z program which returns ALV output.
I have to create a one new Z program and in that I want to call this program and want the final output into an internal table into my Zreport.
I used SUBMIT statement with RETURN but not working.
can anybody tell me what I missed?
or
How can we do this.
Thanks in advance.
SuhasHi Suhas,
In Zreport1.
Just open the first report program and assign internal table to some memory id like...
EXPORT it_tab1 to MEMORY ID 'ZNITS'.
In Zreport2.
Now create an internal table with the same structure of it_tab1 and write the following in your program...
SUBMIT Zreport1 WITH SELECTION-TABLE it_input
AND RETURN.
Note: it_input is of type rsparams and contains all selection parameters for *Zreport1*
* Import internal table content from memory id
IMPORT it_tab1 TO it_tab2 FROM MEMORY ID 'ZNITS'.
FREE MEMORY ID 'ZNITS'.
Thanks
Nitesh -
'ALSM_EXCEL_TO_INTERNAL_TABLE' internal table to ALV
Hi,
I have a problem regarding 'ALSM_EXCEL_TO_INTERNAL_TABLE' internal table to ALV.
I have this code.
DATA:
t_itab like ALSMEX_TABLINE occurs 0 with header line,
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_fname
i_begin_col = 1
i_begin_row = 1
i_end_col = 4
i_end_row = 6
TABLES
intern = t_itab
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc = 0.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_STRUCTURE_NAME = 'ALSMEX_TABLINE'
TABLES
T_OUTTAB = t_itab.
I got an output of
ROW COLUMN c
1 1 TestData
1 2 TestData
2 1 TestData
2 2 TestDataHi Christian Gajo ,
Check the below code.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = P_FILE
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '5'
i_end_row = '10'
tables
intern = IEXCEL
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-SGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
END-OF-SELECTION.
SORT IEXCEL BY ROW COL.
LOOP AT IEXCEL.
CASE IEXCEL-COL.
WHEN 1.
WA_CUST_GLACC-PARVW = IEXCEL-VALUE.
WHEN 2.
WA_CUST_GLACC-KUNNR = IEXCEL-VALUE.
WHEN 3.
WA_CUST_GLACC-MATNR = IEXCEL-VALUE.
WHEN 4.
WA_CUST_GLACC-SAKNR = IEXCEL-VALUE.
WHEN 5.
WA_CUST_GLACC-TXT50 = IEXCEL-VALUE.
ENDCASE.
AT END OF ROW.
WA_CUST_GLACC-MANDT = SY-MANDT.
APPEND WA_CUST_GLACC TO GT_CUST_GLACC.
CLEAR WA_CUST_GLACC.
ENDAT.
CLEAR IEXCEL.
ENDLOOP.
Edited by: mukesh kumar on Nov 7, 2008 7:53 AM -
Can we get the data from two internal tables in ALV.
hi friends i would like to display the data using two internal tables using alv grid.please guide me.
Hi,
ALV would be having a specific layout say :
MATNR
MAKTX
QTY
Now, if you have two internal tables, then do they have a different structure. If they have different structures, then what kind of ALV layout you expect. The ALV output should be as per the structure of 1st or 2nd internal table.
If both internal table have same layout, then populate the data from 2nd internal table into 1st internal table and pass the 1st internal table ( it will have data of both internal tables) to ALV.
Best regards,
Prashant -
How can i compare 2 internal table's data which have same structure ?
hi friends,
i want to know how to compare 2 internal table's data which have same structureDATA: BEGIN OF LINE,
COL1 TYPE I,
COL2 TYPE I,
END OF LINE.
DATA: ITAB LIKE TABLE OF LINE,
JTAB LIKE TABLE OF LINE.
DO 3 TIMES.
LINE-COL1 = SY-INDEX.
LINE-COL2 = SY-INDEX ** 2.
APPEND LINE TO ITAB.
ENDDO.
MOVE ITAB TO JTAB.
LINE-COL1 = 10. LINE-COL2 = 20.
APPEND LINE TO ITAB.
IF ITAB GT JTAB.
WRITE / 'ITAB GT JTAB'.
ENDIF.
APPEND LINE TO JTAB.
IF ITAB EQ JTAB.
WRITE / 'ITAB EQ JTAB'.
ENDIF.
LINE-COL1 = 30. LINE-COL2 = 80.
APPEND LINE TO ITAB.
IF JTAB LE ITAB.
WRITE / 'JTAB LE ITAB'.
ENDIF.
LINE-COL1 = 50. LINE-COL2 = 60.
APPEND LINE TO JTAB.
IF ITAB NE JTAB.
WRITE / 'ITAB NE JTAB'.
ENDIF.
IF ITAB LT JTAB.
WRITE / 'ITAB LT JTAB'.
ENDIF.
The output is:
ITAB GT JTAB
ITAB EQ JTAB
JTAB LE ITAB
ITAB NE JTAB
ITAB LT JTAB
This example creates two standard tables, ITAB and JTAB. ITAB is filled with 3 lines and copied to JTAB. Then, another line is appended to ITAB and the first logical expression tests whether ITAB is greater than JTAB. After appending the same line to JTAB, the second logical expression tests whether both tables are equal. Then, another line is appended to ITAB and the third logical expressions tests whether JTAB is less than or equal to ITAB. Next, another line is appended to JTAB. Its contents are unequal to the contents of the last line of ITAB. The next logical expressions test whether ITAB is not equal to JTAB. The first table field whose contents are different in ITAB and JTAB is COL1 in the last line of the table: 30 in ITAB and 50 in JTAB. Therefore, in the last logical expression, ITAB is less than JTAB.
regards,
srinivas
<b>*reward for useful answers*</b> -
How to caputre report output into an internal table?
Hi,
Is there a way to capture report output into one internal table?
Regards,
AmruthHi Amruth,
Use SUBMIT.. EXPORTING LIST TO MEMORY.
It saves the output of a report into memory. Use the function modules LIST_FROM_MEMORY. WRITE_LIST & DISPLAY_LIST to retrieve the data.
All these function modules belongs to function group 'SLST'.
However the submit does not display hte output list of the called report, but saves it in ABAP memory & leaves the called report immediately. Since the calling program can read the list from memory & process it furthe, you need to use the addition ..AND RETURN.
Regards,
Chandru -
To compare two internal tables and delete records
Hi friends,
I have to compare two internal tables and should delete the records which is not present in both the tables. Reply me as soon as possible.
Thanks.Hi Nagarajan,
1. I don't think there is any direct (one-shot statement)
way to achieve this.
one has to do by writing some logic.
2. Loop at ITAB1.
Read table ITAB2 with key Field1 = ITAB1-Field1.
If sy-subrc <> 0.
delete ITAB1.
endif.
Endloop.
Do the same again with ITAB2.
Loop at ITAB2.
Read table ITAB1 with key Field1 = ITAB2-Field1.
If sy-subrc <> 0.
delete ITAB2.
endif.
Endloop.
3. If any better way is found, i will let u know.
Hope it helps.
Regards,
Amit M. -
Display ALV GRID Using Dynamic Internal Table
Hi all,
I try to display ALV Grid using Dynamic Internal Table, but when i activate my program, i get an error message "DYN_TABLE" is not type-compatible with formal parameter "IT_OUTTAB". ( DYN_TABLE is my Dynamic Itab).
Anybody can help me how to passing Dynamic Itab into ALV Grid ?? Of ALV Grid only accept static Itab ??
Thanks,Hi Vijay,
It's doesn't work, and make new error "Formal parameter "IT_OUTTAB[]" does not exist. However, the parameter "IT_OUTTAB" has a similar name."
Because the method is:
CALL METHOD <ref. var. to CL_GUI_ALV_GRID>->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE = <any type (ANY)>
I_STRUCTURE_NAME = <string of type DD02L-TABNAME>
IS_VARIANT = <structure of type DISVARIANT>
I_SAVE = <var. of type CHAR01>
I_DEFAULT = <var. of type CHAR01>
IS_LAYOUT = <structure of type LVC_S_LAYO>
IS_PRINT = <structure of type LVC_S_PRNT>
IT_SPECIAL_GROUPS = <internal table of type LVC_T_SGRP>
IT_TOOLBAR_EXCLUDING = <internal table of type UI_FUNCTIONS>
IT_HYPERLINK = <internal table of type LVC_T_HYPE>
IT_ALV_GRAPHICS = <internal table of type DTC_T_TC>
CHANGING
IT_OUTTAB = <internal table>
IT_FIELDCATALOG = <internal table of type LVC_T_FCAT>
IT_SORT = <internal table of type LVC_T_SORT>
IT_FILTER = <internal table of type LVC_T_FILT>
Thanks, -
Dynamic internal table for ALV output
Hi,
I am looking for a simple & efficient sample code for an ALV report output with dynamic columns. Can someone please help!
Thanks,
JSHere is a small example. This is pretty old code, and it uses the FM approach.
report zrich_0001.
type-pools: slis.
field-symbols: <dyn_table> type standard table,
<dyn_wa>.
data: it_alvfc type slis_t_fieldcat_alv,
wa_alvfc type slis_fieldcat_alv,
it_fldcat type lvc_t_fcat,
wa_fldcat type lvc_s_fcat.
selection-screen begin of block b1 with frame title text-001.
parameters: p_flds(5) type c.
selection-screen end of block b1.
start-of-selection.
* build the dynamic internal table
perform build_dyn_itab.
* write 5 records to the alv grid
do 5 times.
perform build_report.
enddo.
* call the alv grid.
perform call_alv.
* Build_dyn_itab
form build_dyn_itab.
* Create the dynamic internal table
data: new_table type ref to data,
new_line type ref to data.
* Create fields .
do p_flds times.
clear wa_fldcat.
wa_fldcat-fieldname = sy-index.
wa_fldcat-datatype = 'CHAR'.
wa_fldcat-intlen = 5.
append wa_fldcat to it_fldcat .
enddo.
* Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fldcat
importing
ep_table = new_table.
assign new_table->* to <dyn_table>.
* Create dynamic work area and assign to FS
create data new_line like line of <dyn_table>.
assign new_line->* to <dyn_wa>.
endform.
Have to split this code into two postings to keep formatting.
Regards,
Rich Heilman
Edited by: Rich Heilman on Jun 23, 2009 11:59 AM -
ALV reprot With four internal tables
Hi all,
Could any one please tell what is function module we have to use for displaying four internal tables in a single ALV REPORT.
Thanks & regards
VardhanThis is the code for displaying ALV using containers.. u need to create 4 containers in one screen and need to display data...
I would suggest you to get all the data into one internal table and display.. for more clarity u can give diff colors for diff table data using field catalog..
*& Report ZTRPSD110 *
* TITLE: Statement of Export Report for Tata Tetley *
* PURPOSE:Statement of Export Report for Tata Tetley *
* A. Start-of-selection: *
* 1. In get_billing_data using the selection screen parameters get the *
* billing data from billing header(VBAK) and Item (VBAP) *
* 2. Get the SHIP-TO partner data from VBPA using Customer number as *
* one condition and store in it_vbpa_sh
* 9. Popultae the ALV display table
* B. End-of-selection:
* Call screen 9000 and display data in ALV
REPORT ztrps110 MESSAGE-ID zttl LINE-SIZE 130.
TABLES: vbrk.
* CONSTANTS
CONSTANTS :
c_x(1) TYPE c VALUE 'X',
c_zxto TYPE vbak-auart VALUE 'ZXTO',
c_e TYPE spras VALUE 'E',
c_000000 TYPE posnr VALUE '000000',
c_ship_to TYPE parvw VALUE 'WE'. "Ship To Party
* Table Types
TYPES: BEGIN OF ty_vbrk_vbrp,
vbeln TYPE vbrk-vbeln, "Billing doc
posnr TYPE vbrp-posnr, "Billing item
aubel TYPE vbrp-aubel, "Sales order
waerk TYPE vbrk-waerk, "Doc currency
mvgr1 TYPE vbrp-mvgr1, "Material group 1
mvgr3 TYPE vbrp-mvgr3, "Material group 3
mvgr4 TYPE vbrp-mvgr4, "Material group 4
matnr TYPE vbrp-matnr, "Material no
ntgew TYPE vbrp-ntgew, "Net wt
gewei TYPE vbrp-gewei, "Wt unit
kzwi1 TYPE vbrp-kzwi1, "Subtotal 1
kursk TYPE vbrp-kursk, "Exchange rate
END OF ty_vbrk_vbrp.
TYPES: BEGIN OF ty_data,
land1 TYPE vbpa-land1,
landx TYPE t005t-landx,
mvgr3 TYPE vbrp-mvgr3,
mvgr4 TYPE vbrp-mvgr4,
bezei3 TYPE tvm3t-bezei,
bezei4 TYPE tvm4t-bezei,
ntgew_tea_bag TYPE vbrp-ntgew,
ntgew_pkt_tea TYPE vbrp-ntgew,
ntgew_bulk_tea TYPE vbrp-ntgew,
kzwi1_tea_bag TYPE vbrp-kzwi1, "Subtotal 1 Tea Bag
kzwi1_pkt_tea TYPE vbrp-kzwi1, "Subtotal 1 Pkt Tea
kzwi1_bulk_tea TYPE vbrp-kzwi1, "Subtotal 1 Bulk Tea
ntgew_tot TYPE vbrp-ntgew,
kzwi1_tot TYPE vbrp-kzwi1,
line_color(4) TYPE c, "For line color
END OF ty_data.
TYPES: BEGIN OF ty_vbpa,
vbeln TYPE vbpa-vbeln,
land1 TYPE vbpa-land1,
END OF ty_vbpa.
TYPES: BEGIN OF ty_t005t,
land1 TYPE t005t-land1,
landx TYPE t005t-landx,
END OF ty_t005t.
TYPES: BEGIN OF ty_tvm3t,
mvgr3 TYPE tvm3-mvgr3,
bezei TYPE tvm3t-bezei,
END OF ty_tvm3t.
TYPES: BEGIN OF ty_tvm4t,
mvgr4 TYPE tvm4-mvgr4,
bezei TYPE tvm4t-bezei,
END OF ty_tvm4t.
DATA: it_vbrk_vbrp TYPE STANDARD TABLE OF ty_vbrk_vbrp,
wa_vbrk_vbrp TYPE ty_vbrk_vbrp,
it_vbpa TYPE STANDARD TABLE OF ty_vbpa,
wa_vbpa TYPE ty_vbpa,
it_data TYPE STANDARD TABLE OF ty_data,
wa_data TYPE ty_data,
it_t005t TYPE STANDARD TABLE OF ty_t005t,
wa_t005t TYPE ty_t005t,
it_tvm3t TYPE STANDARD TABLE OF ty_tvm3t,
wa_tvm3t TYPE ty_tvm3t,
it_tvm4t TYPE STANDARD TABLE OF ty_tvm4t,
wa_tvm4t TYPE ty_tvm4t.
* Global data for grand total
DATA:
w_tot_ntgew_tea_bag TYPE vbrp-ntgew,
w_tot_ntgew_pkt_tea TYPE vbrp-ntgew,
w_tot_ntgew_bulk_tea TYPE vbrp-ntgew,
w_tot_ntgew_tot TYPE vbrp-ntgew,
w_tot_kzwi1_tea_bag TYPE vbrp-kzwi1,
w_tot_kzwi1_pkt_tea TYPE vbrp-kzwi1,
w_tot_kzwi1_bulk_tea TYPE vbrp-kzwi1,
w_tot_kzwi1_tot TYPE vbrp-kzwi1.
* Global data definitions for ALV
DATA :
* ALV Grid container
w_alv_container TYPE REF TO cl_gui_custom_container,
* ALV Grid
w_alv_grid TYPE REF TO cl_gui_alv_grid,
w_layo TYPE lvc_s_layo, "For layout
wt_fieldcat TYPE lvc_t_fcat, "For field catalog
okcode TYPE okcode, "OK Code
w_to(2) TYPE c,
w_title TYPE string.
*-------------- START OF SELECTION SCREEN ----------------------------*
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
* Billing Date
SELECT-OPTIONS: s_fkdat FOR vbrk-fkdat MEMORY ID vf OBLIGATORY NO-EXTENSION.
SELECTION-SCREEN:SKIP 1.
SELECTION-SCREEN: END OF BLOCK b1.
*-------------- END OF SELECTION SCREEN ------------------------------*
*------------- EVENT START-OF-SELECTION -------------------------------*
START-OF-SELECTION.
* Get billing data from Delivery header(VBRK) and item (VBRP)
PERFORM get_billing_data.
* Get ship-to country
PERFORM get_ship_to_data.
* Get material group description 3
PERFORM get_material_group_3.
* Get material group description 4
PERFORM get_material_group_4.
* Form the ALV Grid title
PERFORM form_title.
* Process data
PERFORM process_data.
* Populate text descriptions
PERFORM populate_description.
*------------- EVENT END-OF-SELECTION -------------------------------*
END-OF-SELECTION.
* Set the text to when date high is there
IF NOT s_fkdat-high IS INITIAL.
w_to = 'to'(c16).
ENDIF.
* Call the scren 9000 for ALV Display
CALL SCREEN 9000.
*& Form get_billing_data
* Get billing data from Delivery header(VBRK) and item (VBRP)
* & store in internal table it_vbrk_vbrp
FORM get_billing_data .
REFRESH: it_vbrk_vbrp.
* Select Billing data by joining VBRK & VBRP and store in it_vbrk_vbrp
SELECT a~vbeln
b~posnr
b~aubel
a~waerk
b~mvgr1
b~mvgr3
b~mvgr4
b~matnr
b~ntgew
b~gewei
b~kzwi1
b~kursk
FROM vbrk AS a INNER JOIN vbrp AS b
ON a~vbeln = b~vbeln
INTO TABLE it_vbrk_vbrp
WHERE a~fkdat IN s_fkdat
* Consider only non-deleted document
AND fksto = space
* Billing doc type should be ZXTB
AND fkart = 'ZXTB'
AND pstyv = c_zxto.
IF sy-subrc <> 0.
MESSAGE i999(zttl) WITH 'No data is there'(m06).
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " get_billing_data
*& Form get_ship_to_data
* Get Ship-To party data
FORM get_ship_to_data .
DATA: l_it_vbpa TYPE STANDARD TABLE OF ty_vbpa.
REFRESH: it_vbpa, it_t005t.
IF NOT it_vbrk_vbrp[] IS INITIAL.
SELECT vbeln
land1
FROM vbpa
INTO TABLE it_vbpa
FOR ALL ENTRIES IN it_vbrk_vbrp
WHERE vbeln = it_vbrk_vbrp-aubel
AND posnr = c_000000
AND parvw = c_ship_to.
IF sy-subrc <> 0.
MESSAGE i999(zttl) WITH 'Exporter country not maintained'(m02).
LEAVE LIST-PROCESSING.
ELSE.
SORT it_vbpa BY vbeln.
* Create an unique and sorted driver table
l_it_vbpa[] = it_vbpa[].
SORT l_it_vbpa BY land1.
DELETE ADJACENT DUPLICATES FROM l_it_vbpa COMPARING land1.
IF NOT l_it_vbpa[] IS INITIAL.
* Get the country description from T005t table
SELECT land1
landx
FROM t005t
INTO TABLE it_t005t
FOR ALL ENTRIES IN l_it_vbpa
WHERE spras = c_e
AND land1 = l_it_vbpa-land1.
IF sy-subrc = 0.
SORT it_t005t BY land1.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " get_ship_to_data
*& Form get_material_group_3
* Get material group 3
FORM get_material_group_3 .
DATA: l_it_vbrk_vbrp TYPE STANDARD TABLE OF ty_vbrk_vbrp.
REFRESH: it_tvm3t.
* Create an unique and sorted driver table
l_it_vbrk_vbrp[] = it_vbrk_vbrp[].
SORT l_it_vbrk_vbrp BY mvgr3.
DELETE ADJACENT DUPLICATES FROM l_it_vbrk_vbrp COMPARING mvgr3.
IF NOT l_it_vbrk_vbrp[] IS INITIAL.
SELECT mvgr3
bezei
FROM tvm3t
INTO TABLE it_tvm3t
FOR ALL ENTRIES IN l_it_vbrk_vbrp
WHERE mvgr3 = l_it_vbrk_vbrp-mvgr3.
IF sy-subrc = 0.
SORT it_tvm3t BY mvgr3.
ENDIF.
ENDIF.
ENDFORM. " get_material_group_3
*& Form get_material_group_4
* Get material group 4
FORM get_material_group_4 .
DATA: l_it_vbrk_vbrp TYPE STANDARD TABLE OF ty_vbrk_vbrp.
REFRESH: it_tvm4t.
* Create an unique and sorted driver table
l_it_vbrk_vbrp[] = it_vbrk_vbrp[].
SORT l_it_vbrk_vbrp BY mvgr4.
DELETE ADJACENT DUPLICATES FROM l_it_vbrk_vbrp COMPARING mvgr4.
IF NOT l_it_vbrk_vbrp[] IS INITIAL.
SELECT mvgr4
bezei
FROM tvm4t
INTO TABLE it_tvm4t
FOR ALL ENTRIES IN l_it_vbrk_vbrp
WHERE mvgr4 = l_it_vbrk_vbrp-mvgr4.
IF sy-subrc = 0.
SORT it_tvm4t BY mvgr4.
ENDIF.
ENDIF.
ENDFORM. " get_material_group_4
*& Form process_data
* Process the data and do summation and populate final display table
FORM process_data .
LOOP AT it_vbrk_vbrp INTO wa_vbrk_vbrp.
CLEAR: wa_data, wa_vbpa.
READ TABLE it_vbpa INTO wa_vbpa WITH KEY
vbeln = wa_vbrk_vbrp-aubel
BINARY SEARCH.
IF sy-subrc = 0.
wa_data-land1 = wa_vbpa-land1.
ENDIF.
wa_data-mvgr3 = wa_vbrk_vbrp-mvgr3.
wa_data-mvgr4 = wa_vbrk_vbrp-mvgr4.
* Do an unit conversion of the quamtity
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
input = wa_vbrk_vbrp-ntgew
* NO_TYPE_CHECK = 'X'
* ROUND_SIGN = ' '
unit_in = wa_vbrk_vbrp-gewei
unit_out = 'TO' "Metric tonn
IMPORTING
output = wa_vbrk_vbrp-ntgew
EXCEPTIONS
conversion_not_found = 1
division_by_zero = 2
input_invalid = 3
output_invalid = 4
overflow = 5
type_invalid = 6
units_missing = 7
unit_in_not_found = 8
unit_out_not_found = 9
OTHERS = 10.
IF sy-subrc <> 0.
wa_vbrk_vbrp-ntgew = wa_vbrk_vbrp-ntgew.
ENDIF.
* Convert the currency from Customer currency to local
* currency by multiplying with kursk
wa_vbrk_vbrp-kzwi1 = wa_vbrk_vbrp-kzwi1 * wa_vbrk_vbrp-kursk.
* Convert the amount to Lacks by dividing with 100000
wa_vbrk_vbrp-kzwi1 = wa_vbrk_vbrp-kzwi1 / 100000. "DV1K905028
* When MVGR1 is between A to F use the amount as TEA_BAG
IF wa_vbrk_vbrp-mvgr1 BETWEEN 'A' AND 'F'.
wa_data-ntgew_tea_bag = wa_vbrk_vbrp-ntgew.
wa_data-kzwi1_tea_bag = wa_vbrk_vbrp-kzwi1.
ENDIF.
* When MVGR1 is between G to L use the amount as TEA_BAG
IF wa_vbrk_vbrp-mvgr1 BETWEEN 'G' AND 'L'.
wa_data-ntgew_pkt_tea = wa_vbrk_vbrp-ntgew.
wa_data-kzwi1_pkt_tea = wa_vbrk_vbrp-kzwi1.
ENDIF.
* When MVGR1 is between G to L use the amount as TEA_BAG
IF wa_vbrk_vbrp-mvgr1 = 'M'.
wa_data-ntgew_bulk_tea = wa_vbrk_vbrp-ntgew.
wa_data-kzwi1_bulk_tea = wa_vbrk_vbrp-kzwi1.
ENDIF.
COLLECT wa_data INTO it_data.
ENDLOOP.
ENDFORM. " process_data
*& Form populate_description
* Populate the description fields
FORM populate_description .
LOOP AT it_data INTO wa_data.
CLEAR: wa_t005t.
READ TABLE it_t005t INTO wa_t005t WITH KEY land1 = wa_data-land1
BINARY SEARCH.
IF sy-subrc = 0.
wa_data-landx = wa_t005t-landx.
ENDIF.
* Read description of Material group 3
CLEAR wa_tvm3t.
READ TABLE it_tvm3t INTO wa_tvm3t WITH KEY
mvgr3 = wa_data-mvgr3
BINARY SEARCH.
IF sy-subrc = 0.
wa_data-bezei3 = wa_tvm3t-bezei.
ENDIF.
* Read description of Material group 4
CLEAR wa_tvm4t.
READ TABLE it_tvm4t INTO wa_tvm4t WITH KEY
mvgr4 = wa_data-mvgr4
BINARY SEARCH.
IF sy-subrc = 0.
wa_data-bezei4 = wa_tvm4t-bezei.
ENDIF.
* Get the grand totals
wa_data-ntgew_tot = wa_data-ntgew_tea_bag
+ wa_data-ntgew_pkt_tea
+ wa_data-ntgew_bulk_tea.
wa_data-kzwi1_tot = wa_data-kzwi1_tea_bag
+ wa_data-kzwi1_pkt_tea
+ wa_data-kzwi1_bulk_tea.
MODIFY it_data FROM wa_data TRANSPORTING landx
bezei3
bezei4
ntgew_tot
kzwi1_tot.
* Summattion of grand totals
w_tot_ntgew_tea_bag = w_tot_ntgew_tea_bag + wa_data-ntgew_tea_bag.
w_tot_ntgew_pkt_tea = w_tot_ntgew_pkt_tea + wa_data-ntgew_pkt_tea.
w_tot_ntgew_bulk_tea = w_tot_ntgew_bulk_tea + wa_data-ntgew_bulk_tea.
w_tot_ntgew_tot = w_tot_ntgew_tot + wa_data-ntgew_tot.
w_tot_kzwi1_tea_bag = w_tot_kzwi1_tea_bag + wa_data-kzwi1_tea_bag.
w_tot_kzwi1_pkt_tea = w_tot_kzwi1_pkt_tea + wa_data-kzwi1_pkt_tea.
w_tot_kzwi1_bulk_tea = w_tot_kzwi1_bulk_tea + wa_data-kzwi1_bulk_tea.
w_tot_kzwi1_tot = w_tot_kzwi1_tot + wa_data-kzwi1_tot.
ENDLOOP.
* Append a grand Total row at the end
CLEAR wa_data.
wa_data-landx = 'Grand Total:'.
wa_data-ntgew_tea_bag = w_tot_ntgew_tea_bag.
wa_data-ntgew_pkt_tea = w_tot_ntgew_pkt_tea.
wa_data-ntgew_bulk_tea = w_tot_ntgew_bulk_tea.
wa_data-ntgew_tot = w_tot_ntgew_tot.
wa_data-kzwi1_tea_bag = w_tot_kzwi1_tea_bag.
wa_data-kzwi1_pkt_tea = w_tot_kzwi1_pkt_tea.
wa_data-kzwi1_bulk_tea = w_tot_kzwi1_bulk_tea.
wa_data-kzwi1_tot = w_tot_kzwi1_tot.
wa_data-line_color = 'C310'.
APPEND wa_data TO it_data.
ENDFORM. " populate_description
*& Module STATUS_9000 OUTPUT
* Initialise PF-STATUS and title
MODULE status_9000 OUTPUT.
SET PF-STATUS 'MAIN9000'.
SET TITLEBAR 'TITLE_9000'.
ENDMODULE. " STATUS_9000 OUTPUT
*& Module initialize_9000 OUTPUT
* text
MODULE initialize_9000 OUTPUT.
* Call the ALV grid to display data
PERFORM display_alv_grid.
ENDMODULE. " initialize_9000 OUTPUT
*& Module USER_COMMAND_9000 INPUT
* Module to handle User Command
MODULE user_command_9000 INPUT.
CASE okcode.
WHEN 'BACK'.
SET SCREEN 0.
CLEAR okcode.
LEAVE SCREEN.
WHEN 'CANCEL'.
SET SCREEN 0.
CLEAR okcode.
LEAVE SCREEN.
WHEN 'EXIT'.
CLEAR okcode.
LEAVE PROGRAM.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
*& Form display_alv_grid
* Display the data in ALV Grid
FORM display_alv_grid .
IF w_alv_container IS INITIAL.
* Create the alv container object
CREATE OBJECT w_alv_container
EXPORTING
container_name = 'ALV_GRID'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE e999(zttl) WITH 'Problem in ALV display'(t04).
ENDIF.
* Create the ALV grid object. The parent is the ALV container
CREATE OBJECT w_alv_grid
EXPORTING
i_parent = w_alv_container
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE e999(zttl) WITH 'Problem in ALV display'(t04).
ENDIF.
* This subrotine creates the field catalog and
* store in internal table lt_fieldcat
PERFORM prepare_fieldcat CHANGING wt_fieldcat.
* Layout design
w_layo-no_toolbar = ''.
* Not to allow totaling feature
w_layo-no_totline = c_x.
* Report title
* w_layo-grid_title = text-004.
w_layo-grid_title = w_title.
w_layo-zebra = c_x. "Alternating line color (striped)
w_layo-cwidth_opt = c_x. "Optimize column width
w_layo-sel_mode = 'A'. "Selection Mode
* Name of the color field
w_layo-info_fname = 'LINE_COLOR'."For row color
* Call the method to display the data in ALV grid
CALL METHOD w_alv_grid->set_table_for_first_display
EXPORTING
i_save = 'A'
is_layout = w_layo
CHANGING
it_outtab = it_data[]
it_fieldcatalog = wt_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE e999(zttl) WITH text-t04.
ENDIF.
ELSE.
* If the container & grid object is alreadt there reuse them
CALL METHOD w_alv_grid->refresh_table_display
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e999(zttl) WITH text-t04.
ENDIF.
ENDIF.
IF okcode = 'CANCEL'.
EXIT.
ENDIF.
ENDFORM. " display_alv_grid
*& Form prepare_fieldcat
-
Subtotals in dynamic internal table using alv grid
hi experts i have created one dynamic table. The requirement is to display the subtotals in the output using reuse_alv_grid.
Dynamic itab (field-symbols) and ALV event BEFORE_LINE_OUTPUT
the above is the thread related and could any one please provide the sample code for this task.
can any one post the solution for that.
rewards points will be awarded.
khazi* ASSINING STRUCTURE FOR FILD CATLOGS
DATA: DYN_TABLE TYPE REF TO DATA,
DYN_LINE TYPE REF TO DATA,
LS_FIELDCAT TYPE LVC_S_FCAT,
LT_FIELDCAT TYPE LVC_T_FCAT.
LOOP AT LT_DMTAB INTO LS_DMTAB.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = LS_DMTAB-SDATE .
LS_FIELDCAT-DATATYPE = 'DEC'.
LS_FIELDCAT-INTTYPE = 'P'.
LS_FIELDCAT-INTLEN = '16' .
LS_FIELDCAT-DECIMALS = '03'.
LS_FIELDCAT-JUST = 'C'.
APPEND LS_FIELDCAT TO LT_FIELDCAT.
ENDLOOP.
*& For grouping the table rows for Under Line
LS_FIELDCAT-FIELDNAME = 'ULFIELD' .
LS_FIELDCAT-DATATYPE = 'INT'.
LS_FIELDCAT-INTTYPE = 'P'.
LS_FIELDCAT-INTLEN = '2' .
LS_FIELDCAT-DECIMALS = ''.
APPEND LS_FIELDCAT TO LT_FIELDCAT.
"* Create dynamic internal table and assign to Field-Symbol
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = LT_FIELDCAT
IMPORTING
EP_TABLE = DYN_TABLE.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ASSIGN DYN_TABLE->* TO <LT_AREA_F>.
"* Create dynamic work area and assign to Field Symbol
CREATE DATA DYN_LINE LIKE LINE OF <LT_AREA_F>.
ASSIGN DYN_LINE->* TO <LS_AREA_F>.
You check in Field cat level you will get Check Sub total field will exist
Thanks and regards
Jogu -
Problem while comparing two internal tables
I have to modify work start date which are initial in the data base table for the records in the flat file.
my code is:
REPORT ZAUFK_WORKSTARTDATE_UPDATE .
Tables Declaration
TABLES: AUFK.
Type pools Declaration
TYPE-POOLS : SLIS.
Internal Table Declaration
DATA: I_AUFK LIKE AUFK OCCURS 0 WITH HEADER LINE,
IT_AUFK LIKE AUFK OCCURS 0 WITH HEADER LINE,
ITAB1 LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF I_AUFK1 OCCURS 0,
AUFNR(12),
AUART(4),
END OF I_AUFK1.
Data Declaration
DATA I_FIELDCAT TYPE SLIS_FIELDCAT_ALV OCCURS 0.
DATA WA_FCAT LIKE LINE OF I_FIELDCAT.
DATA: B1 TYPE I VALUE 1,
C1 TYPE I VALUE 1,
B2 TYPE I VALUE 256,
C2 TYPE I VALUE 65536.
Selection Screen Declaration
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_FILE LIKE RLGRAP-FILENAME.
SELECT-OPTIONS: S_AUFNR FOR AUFK-AUFNR,
S_AUART FOR AUFK-AUART.
PARAMETERS: P_USER7 LIKE AUFK-USER7 DEFAULT '20070101' OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
PARAMETERS: R1 RADIOBUTTON GROUP G1 DEFAULT 'X' USER-COMMAND UCOMM1, " Upload using File Path
R2 RADIOBUTTON GROUP G1. " Uplaod using particular IO's
SELECTION-SCREEN END OF BLOCK B2.
To get F4 Help for File path on selection screen.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
IMPORTING
FILE_NAME = P_FILE.
To disbale the filepath when r2 radiobutton is selected
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
Check if R1 is checked
IF R1 = 'X'.
IF SCREEN-NAME = 'S_AUFNR-LOW' OR
SCREEN-NAME = 'S_AUFNR-HIGH' OR
SCREEN-NAME = 'S_AUART-LOW' OR
SCREEN-NAME = 'S_AUART-HIGH'.
Make the Internal order number and order type field disable from the selection screen
SCREEN-INPUT = '0'.
MODIFY SCREEN.
ENDIF.
ELSEIF R2 = 'X' AND SCREEN-NAME = 'P_FILE'.
Make the file path field disappear from the selection screen
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
Start of executable code
START-OF-SELECTION.
To get the relavent IO data from the order master data table
SELECT *
FROM AUFK
INTO TABLE I_AUFK
WHERE AUFNR IN S_AUFNR
AND AUART IN S_AUART
AND ( AUART = '5200' OR AUART = '5500'
OR AUART = '5700' OR AUART = '8500'
OR AUART = '8700' ).
Table must be updated using flat file
IF R1 = 'X'.
To Upload Excel sheet data into an internal table
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_FILE
I_BEGIN_COL = B1
I_BEGIN_ROW = C1
I_END_COL = B2
I_END_ROW = C2
TABLES
INTERN = ITAB1
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 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.
To organize the data in the internal table(excel data) as per our requirement
PERFORM ORGANIZE_UPLOADED_DATA.
<b> LOOP AT I_AUFK1.
Comparing the excel data and the database table data
READ TABLE I_AUFK WITH KEY AUFNR = I_AUFK1-AUFNR.
IF SY-SUBRC EQ 0.
Check if the the work start date is initial(blank)
IF I_AUFK-USER7 IS INITIAL.
If work start is initial move the value in p_user7 to the work start date field in i_aufk
MOVE P_USER7 TO I_AUFK-USER7.
MODIFY I_AUFK.
Moving the data which is changed into it_aufk internal table(this table is for displaying the updated records)
MOVE-CORRESPONDING I_AUFK TO IT_AUFK.
APPEND IT_AUFK.
ENDIF.
ENDIF.
ENDLOOP.
endif.</b>
WA_FCAT-FIELDNAME = 'AUFNR'.
WA_FCAT-TABNAME = 'I_AUFK'.
WA_FCAT-SELTEXT_M = 'Internal Order Number'.
WA_FCAT-OUTPUTLEN = 12.
APPEND WA_FCAT TO i_fieldcat.
WA_FCAT-FIELDNAME = 'AUART'.
WA_FCAT-TABNAME = 'I_AUFK'.
WA_FCAT-SELTEXT_M = 'Order Type'.
WA_FCAT-OUTPUTLEN = 4.
APPEND WA_FCAT TO I_FIELDCAT.
WA_FCAT-FIELDNAME = 'KTEXT'.
WA_FCAT-TABNAME = 'I_AUFK'.
WA_FCAT-SELTEXT_M = 'Description'.
WA_FCAT-OUTPUTLEN = 40.
APPEND WA_FCAT TO I_FIELDCAT.
WA_FCAT-FIELDNAME = 'USER7'.
WA_FCAT-TABNAME = 'I_AUFK'.
WA_FCAT-SELTEXT_M = 'Work Start Date'.
WA_FCAT-OUTPUTLEN = 10.
APPEND WA_FCAT TO I_FIELDCAT.
Updating the AUFK(Internal Order Data Table) using i_aufk
*MODIFY AUFK FROM TABLE I_AUFK.
Check if the database table is modified
*IF SY-SUBRC = 0.
Display the modified data
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_GRID_TITLE = 'List of updated Records'
IT_FIELDCAT = I_FIELDCAT[]
TABLES
T_OUTTAB = IT_AUFK[]
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.
ENDIF.
*& Form ORGANIZE_UPLOADED_DATA
text
FORM ORGANIZE_UPLOADED_DATA .
SORT ITAB1 BY ROW COL.
LOOP AT ITAB1.
CASE ITAB1-COL.
WHEN 1.
I_AUFK1-AUFNR = ITAB1-VALUE.
WHEN 2.
I_AUFK1-AUART = ITAB1-VALUE.
ENDCASE.
AT END OF ROW.
APPEND I_AUFK1.
ENDAT.
ENDLOOP.
LOOP AT I_AUFK1.
CONCATENATE '000000' I_AUFK1-AUFNR INTO I_AUFK1-AUFNR.
MODIFY I_AUFK1.
ENDLOOP.
ENDFORM. " ORGANIZE_UPLOADED_DATA
The bold are is were i'm facing problem. Please help me .its urgent.Hi try using the below code...
LOOP AT I_AUFK1.
Comparing the excel data and the database table data
READ TABLE I_AUFK WITH KEY AUFNR = I_AUFK1-AUFNR.
IF SY-SUBRC EQ 0.
Check if the the work start date is initial(blank)
IF I_AUFK-USER7 IS INITIAL.
If work start is initial move the value in p_user7 to the work start date field in i_aufk
MOVE P_USER7 TO I_AUFK-USER7.
[<u>b]MODIFY I_AUFK from i_aufk transporting user7.</b></u>
Moving the data which is changed into it_aufk internal table(this table is for displaying the updated records)
MOVE-CORRESPONDING I_AUFK TO IT_AUFK.
APPEND IT_AUFK.
ENDIF.
ENDIF.
ENDLOOP.
endif.
if you can't still solve some more questions
what is teh sy-subrc of teh read ..
what does the header line contain after teh read
and what happens after modify.. does the contents change? -
Coloring an ALV Cell with DYNAMIC INTERNAL TABLES
Hello Gurus,
I need your help regarding coloring of a cell in my ALV Grid report with DYNAMIC tables.
I have used the call method in calling my ALV. (CALL METHOD gr_alvgrid->set_table_for_first_display).
Now my problem is, I can not bring out the cellcolor succesfully, I always ended up to dump (GETWA_NOT_ASSIGNED = You attempted to access an unassigned field symbol
(data segment 32807).
What I have done:
I've created 2 internal tables:
*1st table
*After appended all of my columns to gt_fieldcat
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fieldcat
IMPORTING
ep_table = gp_both.
ASSIGN gp_both->* TO <i_xtab1>.
*2nd table
Appended these column for CellColor
CLEAR wa_gtfldcat.
wa_gtfldcat-fieldname = 'CELLCOLOR'.
wa_gtfldcat-ref_table = 'CALENDAR_TYPE'.
wa_gtfldcat-ref_field = 'COLTAB'.
APPEND wa_gtfldcat TO gt_fieldcat.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fieldcat
IMPORTING
ep_table = gp_alvgrid.
ASSIGN gp_alvgrid->* TO <i_xtab2>.
*Work Areas for tab1 and tab2
CREATE DATA dref1 LIKE LINE OF <i_xtab1>.
ASSIGN dref1->* TO <wa_xtab1>.
CREATE DATA dref2 LIKE LINE OF <i_xtab2>.
ASSIGN dref2->* TO <wa_xtab2>.
*Move contents of table1 to table2 and modify cellcolor column
LOOP AT <i_xtab1> ASSIGNING <wa_xtab1>.
*-----Cell color assignment
DESCRIBE TABLE gt_fieldcat.
DO sy-tfill TIMES.
READ TABLE gt_fieldcat INTO wa_gtfldcat INDEX sy-index.
ASSIGN COMPONENT wa_gtfldcat-fieldname
OF STRUCTURE <wa_xtab1> TO <fs4>.
IF sy-subrc NE 0. EXIT .ENDIF.
ASSIGN COMPONENT wa_gtfldcat-fieldname
OF STRUCTURE <wa_xtab2> TO <fs3>.
IF sy-subrc NE 0. EXIT .ENDIF.
<fs3> = <fs4>.
ENDDO.
ASSIGN COMPONENT 'CELLCOLOR' OF STRUCTURE <wa_xtab2> TO <fs3>.
IF sy-subrc = 0.
PERFORM modify_cell_color USING 'ZZMATNR' <fs3>.
ENDIF.
APPEND <wa_xtab1> TO <i_xtab2>.
ENDLOOP.
*Call ALV
gs_layout-ctab_fname = 'COLORCELL'
CALL METHOD gr_alvgrid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
CHANGING
it_outtab = <i_xtab2d>[]
it_fieldcatalog = gt_fieldcat
it_sort = lt_sort
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
*--->Exception handling
ENDIF.
FORM modify_cell_color USING p_fieldname TYPE lvc_fname
pt_cellcolor TYPE table.
DATA l_cellcolor TYPE lvc_s_scol.
CLEAR l_cellcolor.
l_cellcolor-fname = p_fieldname.
l_cellcolor-color-col = 6. " Red.
l_cellcolor-color-int = 0.
l_cellcolor-color-inv = 0.
INSERT l_cellcolor INTO TABLE pt_cellcolor.
ENDFORM. " MODIFY_CELL_COLORHi,
The internal tabl which you are using to display the output should have one column in the end.
The cell in this column will contain an internal table of type 'lvc_s_scol'.
The contents of this internal table will be the field names of all other columns of your main internal table in the field FNAME and the required color in the field COLOR.
Please note that the field COLOR will have a hex value for different colors.
In the stucture is_layout whihc you pass to the method 'set_table_for_first_display'
the name of this last column should be given to the field 'ctab_fname'.
This will help you to give the colors to each cell.
for example
I have my data table as follows:-
ITAB1
MATNR MAKTX COLOR_TAB
1 ABC FNAME COLOR NOKEYCOL
MATNR 8000
MAKTX 8000
2 XYZ MATNR 10000
MAKTX 10000
So my internal table ITAB1 had 3 columns MATNR MAKTX and COLOR_TAB.
And COLOR_TAB will contain an internal table with 3 columns FNAME COLOR and NOKEYCOL.
The value to importing parameter IS_LAYOUT-CTAB_FNAME will be COLOR_TAB.
This will help you to assign various colors to the cell of the internal table ITAB.
When you have to change any color, then you will have to just change the entries in cell COLOR_TAB for the particular row and cell.
Regards,
Ankur Parab
Maybe you are looking for
-
In iOS 7.0.2, Appstore updates can not see updated apps
Hi. i am using iPhone 4S with iOS 7.0.2. I am updating some apps when updates comes but when i look notification center , some times i can see updated apps in notification center and the problem is Appstore updates can not see in all items .And some
-
Need suggestion whether to use ATM or MPLS in DSL implementation
Presently i am working in ISP, and we are providing internet access via simple dialup, ISDN and IVS. and now we want to implement DSL i ve talk with few peoples regarding whether to use ATM or MPLS in DSL implementation but because they are solution
-
Hi all I need to download the full SRM Catalog structure together with all details from SRM to logcal XML file. I've checked all around here on SDN but have not comed up with a clear solution... One of these were : http://forums.sdn.sap.com/thread.js
-
Single Sign-On for OS X 10.8 Server/AD
Hi All - I know that in OS 10.7 Server it was possible to bind my Mac Mini running Lion Server to an AD Domain Controller, set up Open Directory and then Kerberize the Open Directory Master in order to give Mac clients single sign-on access to resour
-
This is a problem cause that means I can't properly update either! I haven't been able to properly sync my iphone for a few different iOS versions. Every time my iPhone gives me an error. saying something like "couldn't finish your iPhone failed to b