Internal table modifications
hello gurus,
I got output of a report as bellow.
sl no date name state contry
1 10.10.2009 mtm
1 10.10.2009 A1
1 10.10.2009 abc
1 10.10.2009 b1
1 10.10.2009 c1
but my required output is.
sl no date name state contry
1 10.10.2009 A1 mtm ABC
1 10.10.2009 B1
1 10.10.2009 C1
can any body tell me how to change the format.
my internal table data contains as displayed output only.
so i need to do operations at internal table level to get the required output.
thanks,
padmaja.
Edited by: padmaja vaddi on Mar 9, 2009 5:09 AM
Hi Padmaja,
Please see the code below:
itab1[ ] = itab[ ].
sort itab1 comparing date name.
delete adjacent duplicates from itab1.-->itab1 will contain 3 records and itab will contain 5 records
loop at itab1 into wa_itab1.
clear: wa_itab2, wa_itab.
loop at itab into wa_itab where date = wa_itab1-date
name = ' '.
if wa_itab-state is not initial.
wa_itab2-state = wa_itab-state.
endif.
if wa_itab-country is not initial.
wa_itab2-country = wa_itab-country.
endif.
endloop.
wa_itab2-name = wa_itab1-name.
wa_itab2-date = wa_itab1-date.
wa_itab2-sl_no = wa_itab1-sl_no.
append wa_itab2 to itab2.
endloop.
And in the internal table itab2 , u will have the required output.
Keerthi.
Similar Messages
-
Internal table modification in ABAP object event
Hi Gurus
I have an internal table displayed using ALV - OOPS concept. THe internal table has 15 rows in my test program but it can go up depending on user inpout.
I am able to display it . on the screen . One of the fields is editable . It is required that it take input from user and on pressing enter , the value entered in that cell should be subtracted from a total amout displayed in the cell next to it.
I have used the following code . There are no errors , but nothing happens when I edit it. The screen remains as it is.
Any help will be very useful
DATA : ITAB type ITABT occurs 0.
DATA : itab_w like line of itab.
CLASS LCL_EVENTS_D0100 IMPLEMENTATION.
METHOD handle_data_changed.
DATA: ls_good TYPE lvc_s_modi.
DATA : L_PLANETYPE TYPE ITABT-SEL_QUANT.
LOOP AT er_data_changed->mt_good_cells INTO ls_good.
CASE ls_good-fieldname.
check if column PLANETYPE of this row was changed
WHEN 'SEL_QUANT'.
CALL METHOD pr_data_changed->get_cell_value
EXPORTING
i_row_id = ls_good-row_id
i_fieldname = ls_good-fieldname
IMPORTING
e_value = l_planetype.
ENDCASE.
LOOP AT ITAB INTO ITAB_W .
read table itab into itab_w WITH KEY FINDEX = LS_GOOD-ROW_ID .
itab_w-f_balquant = itab_w-f_balquant - l_planetype.
modify itab FROM itab_w .
endloop.
ENDLOOP.
ENDMETHOD.
ENDCLASS.Hi,
Hi,
AND also use
* Module Pai INPUT *
* PAI module *
module pai input.
save_ok = ok_code.
clear ok_code.
call method grid1->check_changed_data
importing
e_valid = v_valid.
" After this system will automatically update your changed data into
" internal table t_zthlog
case save_ok.
when 'EXIT'.
perform f_exit_program.
when 'CANC'.
perform f_exit_program.
when 'BACK'.
perform f_exit_program.
when 'SAVE'.
perform f_save_data.
endcase.
endmodule. " Pai INPUT
aRs -
Modify database table from internal table
Hi All,
I need to update database table from internal table which is having around 30000 records.
I am using MODIFY tabname FROM TABLE int_tabname...
Using this statement, I can modify the databse records very well. But user has some additional requirement.
He wants that the table should be modified from the internal table and after modification we should have the erroneous records to be displayed if any.
e.g. if 1500 records out of 30000 are erroneous then only 28500 records should be updated and 1500 records should be displayed as erroneous records so that the user can correct them and use them again for executing the program.
Is there any FM which imports the database table name and internal table, modifies the database and exports an internal tanle with erroneous records?
Any help will be appriciated,
Regards,
NehaHi
modifying datbase table useing internal table
<b>advises</b> before updating this datbase table plz lock that table to avoid incosistency
write the logic for modifying
Modify the database table as per new dunning procedure
MODIFY fkkvkp FROM TABLE lt_fkkvkp .
and finally unlock the table
<b>example</b>
*To lock table for further operations
constants: lc_tabname TYPE rstable-tabname VALUE 'FKKVKP' . "FKKVKP
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
tabname = lc_tabname
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc EQ 0.
To fetch all the contract accounts for customers of the segment
Households/SME.
PERFORM fetch_contract_accounts using lc_tabname .
ENDIF. " IF sy-subrc EQ 0.
*wrote the logic
Modify the database table as per new dunning procedure from internal table
MODIFY fkkvkp FROM TABLE lt_fkkvkp .
*unlock the tbale
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
TABNAME = uc_tabname .
<b>Reward if usefull</b> -
Regarding Internal Table Field Validation [Modification]
Hi All,
I have a small issue with formatting of a field.
The Field is POTX1 - it would get the value as 'New MT-EPPE0097-COMP02',
Means i have one internal table field as i_error-POTX1 in that some times we get value as 'New MT-EPPE0097-COMP02'.
Whenever i get 'New' literal in that internal table field i have to remove that literal from that internal table field. And Left Justify the remaining part of the field.
Ex: 'New MT-EPPE0097-COMP02'
should become 'MT-EPPE0097-COMP02'.
For this first i have to find wether 'New' Literal exists in the Internal table field or not then i have to remove it.
Can anybody tell me how can i solve this issue.
Thanks in advance.
Thanks & Regards,
Rayeezuddin.Hi,
Take a look :
loop at i_error.
if i_error-potx1(3) = 'New'
w_potx1 = i_error-potx1.
i_error-potx1 = w_potx1+3(37).
MODIFY i_error.
endif.
ENDLOOP.
Regards,
Erwan.
Message was edited by: Erwan LE BRUN -
Internal table manual modification
I understand this is probably going to be the stupidest question ever posted here. But I wanted to know how to manually add values to an internal table without doing a select statement.
TYPES: BEGIN OF ty_ext,
param(32) type c,
row type i,
field(30) type c,
value(255) type c,
type(4) type c,
length(6) type n,
END OF ty_ext,
DATA: it_ext TYPE TABLE OF ty_ext.
I just want to fill it_ext with data without doing select, I have the data stored in variables.
Thanks,
RisadTYPES: BEGIN OF ty_ext,
param(32) type c,
row type i,
field(30) type c,
value(255) type c,
type(4) type c,
length(6) type n,
END OF ty_ext,
DATA: it_ext TYPE TABLE OF ty_ext,
wa_ext type ty_ext.
wa_ext-param = '123'.
append wa_ext to it_text. -
Reg Modification of a field in internal table.
Hi
i have requirement like this. I have a header and an items in a report. In header, i need to display the no. of . items(count). In my report i am displaying the records before moving to internal table(Direct write). Also i want to download that report into a CSV file.
Regards
Ravihi,
Check out this sample code
report ztest.
data: begin of itab occurs 0,
fld1(10) type c,
fld2(10) type c,
fld3(10) type c,
end of itab.
data: begin of iout occurs 0,
rec(1000) type c,
end of iout.
parameters: p_file type localfile default 'C:\test.csv'.
data: file type string.
start-of-selection.
* Build the ITAB
itab-fld1 = 'A'.
itab-fld2 = 'B'.
itab-fld3 = 'C'.
append itab.
itab-fld1 = 'D'.
itab-fld2 = 'E'.
itab-fld3 = 'F'.
append itab.
itab-fld1 = 'G'.
itab-fld2 = 'H'.
itab-fld3 = 'I'.
append itab.
* Build the output internal table from ITAB
* Concatenate all fields into IOUT-REC
loop at itab.
concatenate itab-fld1 itab-fld2 itab-fld3 into iout-rec
separated by ','.
condense iout-rec no-gaps.
append iout.
endloop.
* Now Download
file = p_file.
call function 'GUI_DOWNLOAD'
exporting
filename = file
tables
data_tab = iout
exceptions
others = 22. -
I am new to the bdc .
i have gone to SHDB and created a new recording for the some T-code .
After that i have created a prog (transfer from recording ) .
i got some values in the file in my presenation server.
i got default code generated .
I have to declare the internal table of some time .
may i know of which type should i declare my internal table ??
My code ****************************************************************
report ZRAJESH_BDC
no standard page heading line-size 255.
include bdcrecx1.
start-of-selection.
perform open_group.
*******loop
perform bdc_dynpro using 'SAPMF02K' '0101'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-D0110'.
perform bdc_field using 'RF02K-LIFNR'
'12345'.
perform bdc_field using 'RF02K-D0110'
'X'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-TELF2'.
perform bdc_field using 'BDC_OKCODE'
'=UPDA'.
perform bdc_field using 'LFA1-ANRED'
'Mr.'.
perform bdc_field using 'LFA1-NAME1'
'RAJESH'.
perform bdc_field using 'LFA1-SORTL'
'Q'.
perform bdc_field using 'LFA1-LAND1'
'US'.
perform bdc_field using 'LFA1-SPRAS'
'EN'.
perform bdc_field using 'LFA1-TELF2'
'9033558227'.
perform bdc_transaction using 'XK02'.
perform close_group.
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> NODATA.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.Hi,
I have one simple BDC Program .
Just you have to do recording by using SHDB Transaction Code.
and Copy that program and do some modification by following my Program and upload data to that perticular transaction.
before that u have to prepare data in Text file by using TAB Space .
Below is the Code(I have used MM01 transaction)
******************************************************************************************8
report ZBDCTEST no standard page heading line-size 255.
***DECLARING TABLES.
TABLES : MARA.
**DECLARING INTERNAL TABLE.
DATA : BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR,
MEINS LIKE MARA-MEINS,
MATKL LIKE MARA-MATKL,
Maktx like makt-maktx,
SPART LIKE MARA-SPART,
END OF ITAB.
DATA BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
CODEPAGE = 'IBM'
FILENAME = 'C:\TEST.TXT'
FILETYPE = 'DAT'
HEADLEN = ' '
LINE_EXIT = ' '
TRUNCLEN = ' '
USER_FORM = ' '
USER_PROG = ' '
DAT_D_FORMAT = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = ITAB
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*include bdcrecx1.
*start-of-selection.
*perform open_group.
LOOP AT ITAB.
REFRESH BDCDATA.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1_REF-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'=AUSW'.
perform bdc_field using 'RMMG1-MATNR'
ITAB-MATNR.
perform bdc_field using 'RMMG1-MBRSH'
'M'.
perform bdc_field using 'RMMG1-MTART'
'FOOD'.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(02)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(02)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP02'.
perform bdc_field using 'MAKT-MAKTX'
'T1003'.
perform bdc_field using 'BDC_CURSOR'
'MARA-MATKL'.
perform bdc_field using 'MARA-MEINS'
'BOX'.
perform bdc_field using 'MARA-MATKL'
ITAB-MATKL.
perform bdc_field using 'MARA-SPART'
ITAB-SPART.
perform bdc_field using 'MARA-MTPOS_MARA'
'NORM'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
'T1003'.
*perform bdc_transaction using 'MM01'.
*perform close_group.
CALL TRANSACTION 'MM01' USING BDCDATA MODE 'A'. "A= all screens ,N= no screens
ENDLOOP.
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> SPACE.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.
if you want further help let me know
Regards,
Jak -
How to get selected records from an ALV Grid in some other internal table
I am using a standard SAP program (RFKKMA02) in a Z program. Now i want to select some rows in ALV and after doing some modification, i want to store those records in some other internal table. I am not using OO concept.
Thanks in advance.u create first internal table of structur of fields that u want to copy and then move taht values to internal table
-
ALV GRID Report is not showing all records which is in internal table
hi all,
have one doubt. please clarify me. ALV Report is working fine since long tiem. But suddenly this report is showing few records only for the given input. Example: it_main table have 50 records, but output is showing only 10 records only. (we have not made any modifications in this report).
temporarily i have given excel output file from it_main table. excel file is showing all records.
here it_main have all the records. but output is showing few records only. it is not showing any error. i have tested with REUSE_ALV_LIST_DISPLAY function also. but it also showing same results(few records only.)
please give me some idea.
FORM display_alv_report.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = sy-repid
is_layout = wa_layout
it_fieldcat = it_fcat
it_events = it_events
i_save = 'A'
is_variant = wa_variant
TABLES
t_outtab = it_main
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE text-204 " 'Error in Display the list'
TYPE 'I'.
LEAVE TO LIST-PROCESSING.
ENDIF.
ENDFORM. . "DISPLAY_ALV_REPORT
Best Regards,
Srinivashi
Please study this program and give me suggestions.
ALV Declaration
DATA : it_events TYPE slis_t_event, "ALV event
it_fcat TYPE slis_t_fieldcat_alv, "Field catalog
it_list_top_of_page TYPE slis_t_listheader,
c_tabname TYPE slis_tabname VALUE 'IT_MAIN'.
DATA : wa_layout TYPE slis_layout_alv,
wa_event TYPE slis_alv_event,
wa_fcat TYPE slis_fieldcat_alv,
wa_variant TYPE disvariant.
START-OF-SELECTION.
PERFORM material_pass.
PERFORM data_retrieval.
END-OF-SELECTION.
PERFORM sub_display_report.
FORM sub_display_report .
DATA status(1).
IF r1 = 'X'.
PERFORM build_fieldcatalog USING :
'1' 'ERDAT' 'S.O DATE' '' '10' 'X',
'2' 'VBELN' 'SALE ORDER' '' '10' 'X',
'3' 'POSNR' 'SALE ITEM' '' '6' '',
'4' 'BSTKD' 'CUSTOMER PO' '' '35' '',
'5' 'BEZEI' 'REASON FOR REJECTION' '' '40' '',
'6' 'PLNUM' 'PLANNED ORDER' '' '10' '',
'7' 'AUFNR' 'PROD.ORDER.' '' '12' '',
'8' 'MATNR' 'MATERIAL NUMBER' '' '18' '',
'9' 'MAKTX' 'MATERIAL DESCRIPTION' '' '40' '',
'10' 'WERKS' 'PLANT' '' '4' '',
'11' 'KWMENG' 'SALE ORDER QTY' '' '15' '',
'12' 'VRKME' 'UNIT' '' '4' '',
'13' 'GAMNG' 'PROD.ORDER QTY' '' '13' '',
'14' 'IGMNG' 'CONFIRMED ORDER QTY' '' '13' '',
'15' 'GMEIN' 'UNIT' '' '4' '',
'16' 'MENGE' 'G.R QUANTITY' '' '13' '',
'17' 'SOBAL' 'S.O BALANCE' '' '13' '',
'18' 'PRDBAL' 'PROD.BALANCE' '' '13' '',
'19' 'GSM' 'GSM' '' '4' '',
'20' 'SIZE1' 'SIZE1' '' '10' '',
'21' 'SIZE2' 'SIZE2' '' '10' ''.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = pathname
filetype = ftype
append = 'X'
write_field_separator = 'X'
TABLES
data_tab = it_mains
EXCEPTIONS
file_write_error = 1.
IF sy-subrc = 0.
status = 'S'.
ELSE.
status = 'E'.
ENDIF.
ELSEIF r2 = 'X' OR r3 = 'X'.
PERFORM build_fieldcatalog USING :
'1' 'ERDAT' 'S.O DATE' '' '10' 'X',
'2' 'VBELN' 'SALE ORDER' '' '10' 'X',
'3' 'POSNR' 'SALE ITEM' '' '6' '',
'4' 'BSTKD' 'CUSTOMER PO' '' '35' '',
'5' 'BEZEI' 'REASON FOR REJECTION' '' '40' '',
'6' 'PLNUM' 'PLANNED ORDER' '' '10' '',
'7' 'AUFNR' 'PROD.ORDER.' '' '12' '',
'8' 'MATNR' 'MATERIAL NUMBER' '' '18' '',
'9' 'MAKTX' 'MATERIAL DESCRIPTION' '' '40' '',
'10' 'WERKS' 'PLANT' '' '4' '',
'11' 'KWMENG' 'SALE ORDER QTY' '' '15' '',
'12' 'VRKME' 'UNIT' '' '4' '',
'13' 'GAMNG' 'PROD.ORDER QTY' '' '13' '',
'14' 'IGMNG' 'CONFIRMED ORDER QTY' '' '13' '',
'15' 'GMEIN' 'UNIT' '' '4' '',
'16' 'MENGE' 'G.R QUANTITY' '' '13' '',
'17' 'SOBAL' 'S.O BALANCE' '' '13' '',
'18' 'PRDBAL' 'PROD.BALANCE' '' '13' '',
'19' 'GSM' 'GSM' '' '4' '',
'20' 'SIZE1' 'SIZE1' '' '10' '',
'21' 'CUT1' 'CUT1' '' '11' '',
'22' 'SIZE2' 'SIZE2' '' '10' '',
'23' 'CUT2' 'CUT2' '' '11' '',
'24' 'SIZE3' 'SIZE3' '' '10' '',
'25' 'CUT3' 'CUT3' '' '11' '',
'26' 'SIZE4' 'SIZE4' '' '10' '',
'27' 'CUT4' 'CUT4' '' '11' '',
'28' 'SIZE5' 'SIZE5' '' '10' '',
'29' 'CUT5' 'CUT5' '' '11' '',
'30' 'SIZE6' 'SIZE6' '' '10' '',
'31' 'CUT6' 'CUT6' '' '11' ''.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = pathname
filetype = ftype
append = 'X'
write_field_separator = 'X'
TABLES
data_tab = it_mainall
EXCEPTIONS
file_write_error = 1.
IF sy-subrc = 0.
status = 'S'.
ELSE.
status = 'E'.
ENDIF.
ENDIF.
PERFORM build_layout.
PERFORM build_events.
PERFORM sub_comment_build USING it_list_top_of_page.
PERFORM sub_set_variant.
PERFORM display_alv_report.
IF status = 'S'.
MESSAGE 'Excel Output file Downloaded to Given Path' TYPE 'I'.
ELSE.
MESSAGE 'Download Not Possible' TYPE 'I'.
ENDIF.
ENDFORM. " SUB_DISPLAY_REPORT
FORM BUILD_FIELDCATALOG
FORM build_fieldcatalog USING p_col_pos
p_fieldname
p_text
p_datatype
p_outputlen
p_col_freez.
wa_fcat-row_pos = '1'.
wa_fcat-col_pos = p_col_pos.
wa_fcat-fieldname = p_fieldname.
wa_fcat-tabname = c_tabname.
wa_fcat-reptext_ddic = p_text.
wa_fcat-datatype = p_datatype.
wa_fcat-ddic_outputlen = p_outputlen.
wa_fcat-key = p_col_freez.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
FORM build_layout.
CLEAR: wa_layout.
wa_layout-window_titlebar = 'LIST OF GSM WISE OPEN SALE ORDERS'.
wa_layout-colwidth_optimize = 'X'.
wa_layout-totals_text = 'CUMULATIVE'.
ENDFORM. "BUILD_LAYOUT
*& Form BUILD_EVENTS
FORM build_events.
CLEAR wa_event.
REFRESH it_events.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_events
EXCEPTIONS
list_type_wrong = 1
OTHERS = 2.
IF sy-subrc = 0.
READ TABLE it_events INTO wa_event
WITH KEY name = 'TOP_OF_PAGE'.
IF sy-subrc EQ 0.
wa_event-form = 'TOP_OF_PAGE'.
APPEND wa_event TO it_events.
CLEAR wa_event.
ENDIF.
ENDIF.
ENDFORM. "BUILD_EVENTS
-->P_IT_LIST_TOP_OF_PAGE text
FORM sub_comment_build USING it_top_of_page TYPE slis_t_listheader.
DATA ls_line TYPE slis_listheader.
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = str1.
APPEND ls_line TO it_top_of_page.
CLEAR ls_line.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header[].
ENDFORM. " SUB_COMMENT_BUILD
*& Form SUB_SET_VARIANT
text
--> p1 text
<-- p2 text
FORM sub_set_variant .
CLEAR wa_variant.
wa_variant-report = sy-repid.
wa_variant-username = sy-uname.
wa_variant-variant = c_variant.
wa_variant-variant = p_layout.
ENDFORM. " SUB_SET_VARIANT
*& Form DISPLAY_ALV_REPORT
*Display Report Using ALV GRID
FORM display_alv_report.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = sy-repid
i_callback_pf_status_set = c_pf_status
i_callback_user_command = c_user_command
is_layout = wa_layout
it_fieldcat = it_fcat
it_sort = it_sort[]
it_events = it_events
i_save = 'A'
is_variant = wa_variant
TABLES
t_outtab = it_main
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE text-204 " 'Error in Display the list'
TYPE 'I'.
LEAVE TO LIST-PROCESSING.
ENDIF.
ENDFORM. . "DISPLAY_ALV_REPORT
*ALV Report Header
FORM top_of_page.
DATA : t_header TYPE slis_t_listheader WITH HEADER LINE,
wa_header TYPE slis_listheader,
t_line LIKE wa_header-info,
ld_lines TYPE i,
ld_linesc(10) TYPE c.
wa_header-typ = 'H'.
T_HEADER-INFO = 'LIST OF GSM WISE OPEN SALE ORDERS'.
wa_header-info = str1.
APPEND wa_header TO t_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header[].
ENDFORM. "TOP_OF_PAGE
here it_main internal table having all data. but output is showing few records only.
pl. give some idea.
Thanks & Regards
Srinivas. -
Customer exit variable - internal table in BEX
Hi,
i am running a report and using variables in it.
The report runs over a info cube. There are few challenges in it.
One of the variable is posting date, and when user enters posting date i need to negate it with current system date.
If the negated value is greater than 28 then i need to exclude documnet type 'YG' and display the query, else i need to include the dcumnet type 'YG' and document type ' '. The above logic can be well implemented via a customer exit variable(for posting date) using an internal table. We have internal tables like C_T_DATA which is used in data source enhancement, which help us to implement our own desired logic.
Do we have such kind of internal tables, based on which the report output (result set) is derived?
i know that we have l_t_range and e_t_range, but dont know their usage, some one can explain in detail about them?
Thanks in advance.Hi Selva & Lakshmin,
The code given by Selva is almost correct . If my understanding is clear , you also wanted to include document type ' ' when the negated value is less than 28 .
Modification in Selvas Code :
Variable 'V_DOCTYP' must be of type Multiple Single Values.
DATA : V_DATE LIKE SY-DATUM.
DATA : V_DAYS TYPE I.
if i_step = 2.
when 'V_DOCTYP'.
READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'ZV_PDATE''.
IF SY-SUBRC = 0.
V_DATE = loc_var_range-low.
ENDIF.
V_DAYS = SY-DATUM - V_DATE.
IF V_DAYS > 28.
l_s_range-low = 'YG'
l_s_range-sign = 'E'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
ELSE.
l_s_range-low = 'YG'
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
clear l_s_range.
l_s_range-low = ' '.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
ENDIF.
ENDIF.
Hope the above reply was helpful.
Kind Regards,
Ashutosh Singh -
How to Refresh "Internal table values" in User EXIT.
Dear All,
My requirement is to place some checks in exit ZXQQMU20 in different tabs from the TCODE IW21 . IW22 etc.
Now after placeing the checks towards the different tabs while doing "NOCO" from IW21 the conditions are fullfilled but
when i go ahead to modify the created "NOCO " from the TCODE IW22 by deleting the created values and saving in IW22 , the conditions written in the exit are still satisfied eventhough i have deleted the values in IW22.
The reason for this is that the tables which are there in the exit ZXQQMU20 T_VIQMFE , T_VIQMUR , T_VIQMMA
still contains the old values which were there at the time of creation of "NOCO" in IW21 .
How to refresh my " internal tables values" used in such that even at the time of modification of the NOCO through IW22 my table values should pick the current screen values and not the values which were there at the time of creation.
Please help.
The code i have written in the exit is as below:-
********************* Changed vide ******START
*****IW21 IW22 also added in filter criteria of notification *************
******The purpose of this modification is that in the execution of IW21 or IW22 or IW24 or IW25 we have to give a check that if the
******notification type is M2 than inside the Transaction screen , if the Breakdown duration comes less than 15 min than there are
******no issues but if the breakdown duration is more than 15 min than the mandatory fields needs to be entered in the analysis tab.
** The user has to fill up either following mandatory fields in Analysis Data tab.
** A. Object Parts & Damages sub tab
** Code Group - Object Parts (OTGRP, VIQMFE)
** AND
** Code Group - Problem / Damage (FEGRP, VIQMFE)
** Or
** Notification Item Short Text (FETXT, VIQMFE)
** B. Cause sub tab
** Code Group # Causes (URGRP, VIQMUR)
** Or
** Cause Text (URTXT, VIQMUR)
** C. Action Taken sub tab
** Code Group # Activities (MNGRP, VIQMMA)
** Or
** Activity Text (MATXT, VIQMMA)
** Then, allow user to complete notification (NOCO).
CLEAR : L_VAR , L_COMP_TIME.
IF ( SY-TCODE EQ 'IW21' OR SY-TCODE EQ 'IW22' OR SY-TCODE EQ 'IW24' OR
SY-TCODE EQ 'IW25' ).
IF ( E_VIQMEL-IWERK = '061' ) OR ( E_VIQMEL-IWERK = '062' ).
IF E_VIQMEL-QMART = 'M2'.
L_VAR = E_VIQMEL-AUSZT.
L_COMP_TIME = L_VAR / 60.
IF L_COMP_TIME < 15.
EXIT.
ELSEIF L_COMP_TIME > 15..
* IF ( T_VIQMFE-OTGRP IS INITIAL AND T_VIQMFE-FEGRP IS INITIAL ) OR ( T_VIQMFE-FETXT IS INITIAL ) .
* MESSAGE 'Please fill the mandatory analysis data in Object Parts' TYPE 'E'.
* ENDIF.
IF T_VIQMFE-OTGRP EQ '' OR T_VIQMFE-FEGRP EQ ''.
IF T_VIQMFE-FETXT EQ ''.
MESSAGE 'Please fill the mandatory analysis data in Object Parts' TYPE 'E'.
ENDIF.
ENDIF.
CLEAR L_TAG.
IF T_VIQMUR[] IS INITIAL.
MESSAGE 'Please fill the mandatory analysis data in Cause tab' TYPE 'E'.
ELSE.
LOOP AT T_VIQMUR.
IF T_VIQMUR-URGRP IS INITIAL .
IF T_VIQMUR-URTXT IS INITIAL.
L_TAG = 'X'.
ENDIF.
ENDIF.
ENDLOOP.
IF L_TAG = 'X'.
MESSAGE 'Please fill the mandatory analysis data in Cause tab' TYPE 'E'.
ENDIF.
ENDIF.
CLEAR L_TAG.
IF T_VIQMMA[] IS INITIAL.
MESSAGE 'Please fill the mandatory analysis data in Action' TYPE 'E'.
ELSE.
LOOP AT T_VIQMMA.
IF T_VIQMMA-MNGRP IS INITIAL .
IF T_VIQMMA-MATXT IS INITIAL.
L_TAG = 'X'.
ENDIF.
ENDIF.
ENDLOOP.
IF L_TAG = 'X'.
MESSAGE 'Please fill the mandatory analysis data in Action' TYPE 'E'.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
<Added code tags>
Thank you so much in advance..
-Sudhish
Please use the code tags when you're posting any code snippet
Edited by: Suhas Saha on Jul 13, 2011 12:39 PMHi, I was thinking just like XVBAP and YVBAP values in the USEREXIT_SAVE_DOCUMENT.
Plz check u have x /y versions or tables like _old/ _new suffixes and then move the value accordingly.
otherwise there may be inconsistency.
Edited by: Prasenjit S. Bist on Jul 13, 2011 3:03 PM -
How to Convert internal table data into text output and send mail in ABAP
Hi All,
Good Morning.
Taking a glance at a code that converts internal table data to an Excel file in ABAP. also checked how to send this excel to mailing list as attachment.
But thought of doing it without excel.
I mean, I have an internal table which contains fields of all types (character,integer,date,time). Since it is only around 4 to 5 rows in it (output),why to convert it to excel. not required!!. Instead I want to send this output to User's mails as Normal mail body with No attachments.
Could anybody please suggest me a way as to how to send internal table data as a mail ( not as an excel or PDF etc).
as of now my findings are, it is quite complex to convert internal table data to email (Text) format. but i believe if there is some way of doing it.
Best Regards
Dileep VThere's something I have used in the past where we send out information about failed precalculation settings (which are stored in internal table gt_fail)
notice we use gt_text as "mail body"
TRY.
* -------- create persistent send request ------------------------
gv_send_request = cl_bcs=>create_persistent( ).
* -------- create and set document -------------------------------
* create text to be sent
wa_line = text-001.
APPEND wa_line TO gt_text.
CLEAR wa_line.
APPEND wa_line TO gt_text.
LOOP AT gt_fail ASSIGNING <fs_fail>.
MOVE <fs_fail>-retry_count TO gv_count.
CONCATENATE text-002
<fs_fail>-setting_id
text-003
gv_count
INTO wa_line SEPARATED BY space.
APPEND wa_line TO gt_text.
CLEAR wa_line.
ENDLOOP.
APPEND wa_line TO gt_text.
wa_line = text-007.
APPEND wa_line TO gt_text.
* create actual document
gv_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = gt_text
i_length = '12'
i_subject = 'Failed Precalculation Settings!' ).
* add document to send request
CALL METHOD gv_send_request->set_document( gv_document ).
* --------- set sender -------------------------------------------
gv_sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD gv_send_request->set_sender
EXPORTING
i_sender = gv_sender.
* --------- add recipient (e-mail address) -----------------------
LOOP AT s_email INTO wa_email.
MOVE wa_email-low TO gv_email.
gv_recipient = cl_cam_address_bcs=>create_internet_address(
gv_email ).
CALL METHOD gv_send_request->add_recipient
EXPORTING
i_recipient = gv_recipient
i_express = 'X'.
ENDLOOP.
* ---------- set to send immediately -----------------------------
CALL METHOD gv_send_request->set_send_immediately( 'X' ).
* ---------- send document ---------------------------------------
CALL METHOD gv_send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = gv_sent_to_all ).
IF gv_sent_to_all = 'X'.
WRITE text-004.
ENDIF.
COMMIT WORK.
* exception handling
CATCH cx_bcs INTO gv_bcs_exception.
WRITE: text-005.
WRITE: text-006, gv_bcs_exception->error_type.
EXIT.
ENDTRY.
with the following declarations
* TABLES *
TABLES:
adr6,
rsr_prec_sett.
* INTERNAL TABLES & WORK AREAS *
DATA:
gt_fail TYPE SORTED TABLE OF rsr_prec_sett
WITH UNIQUE KEY setting_id run_date,
gt_text TYPE bcsy_text,
wa_fail LIKE LINE OF gt_fail,
wa_line(90) TYPE c.
FIELD-SYMBOLS:
<fs_fail> LIKE LINE OF gt_fail.
* VARIABLES *
DATA:
gv_count(4) TYPE n,
gv_send_request TYPE REF TO cl_bcs,
gv_document TYPE REF TO cl_document_bcs,
gv_sender TYPE REF TO cl_sapuser_bcs,
gv_recipient TYPE REF TO if_recipient_bcs,
gv_email TYPE adr6-smtp_addr,
gv_bcs_exception TYPE REF TO cx_bcs,
gv_sent_to_all TYPE os_boolean.
* SELECTION-SCREEN *
SELECT-OPTIONS:
s_email FOR adr6-smtp_addr NO INTERVALS MODIF ID sel.
DATA:
wa_email LIKE LINE OF s_email. -
OO ALV displaying without Values despite Internal table contains
My below OO ALV displaying without Values despite Internal table contains the values ...
Help please ...
REPORT zsd_concession1 NO STANDARD PAGE HEADING
LINE-SIZE 285
LINE-COUNT 64
MESSAGE-ID zz.
Program Description ******************************
This report is to Calculate consession against Quotations
complying standards for enhanced Performance, Readability &
Maintenance.
Change Log *********************************
Remedy # / Who When Why / What
Transport #
CLASS lcl_event_handler DEFINITION DEFERRED.
*& Data Definitions .
DATA: BEGIN OF vbap_wa,
vbeln TYPE vbak-vbeln, "Quotation#
erdat TYPE vbak-erdat, "Quot date
knumv TYPE vbak-knumv, "Cond Rec#
posnr TYPE vbap-posnr, "Line Item
matnr TYPE vbap-matnr, "Mat#
zansicat TYPE zmarall-zansicat, "AnsiCat#
zansigrd TYPE zmarall-zansigrd, "Grade
zcurrvaltnarea TYPE zco002-zcurrvaltnarea,"Val Area
zcurrcstusd TYPE zco002-zcurrcstusd, "Cost$
zzbrndnm TYPE mara-zzbrndnm, "Brand
zqedscgrp TYPE zglbprc-zqedscgrp, "QE Disc Grp
mstav TYPE mara-mstav, "Status
kwmeng TYPE vbap-kwmeng, "Qty
lprc TYPE konv-kbetr, "List Price ZBP1
sprc TYPE konv-kbetr, "Std Pric ZNAA,ZNAX
netpr TYPE vbap-netpr, "Quot price
mrgn TYPE konv-kbetr, "margin%
END OF vbap_wa,
BEGIN OF konv_wa,
knumv TYPE konv-knumv, "Cond#
kposn TYPE konv-kposn, "Cond Item#
kappl TYPE konv-kappl, "Applic
kschl TYPE konv-kschl, "Cond Typ
kbetr TYPE konv-kbetr, "Price ZBP1,ZNAA,ZNAX
END OF konv_wa,
BEGIN OF vbpa_wa,
vbeln TYPE vbpa-vbeln, "Quot#
posnr TYPE vbpa-posnr, "Item#
parvw TYPE vbpa-parvw, "Prt Fn
kunnr TYPE vbpa-kunnr, "Cust#
END OF vbpa_wa,
BEGIN OF result_wa,
posnr TYPE vbap-posnr, "Line Item
matnr TYPE vbap-matnr, "Mat#
zansicat TYPE zmarall-zansicat, "AnsiCat#
zansigrd TYPE zmarall-zansigrd, "Grade
zcurrvaltnarea TYPE zco002-zcurrvaltnarea,"Val Area
zcurrcstusd TYPE zco002-zcurrcstusd, "Cost$
zzbrndnm TYPE mara-zzbrndnm, "Brand
zqedscgrp TYPE zglbprc-zqedscgrp, "QE Disc Grp
mstav TYPE mara-mstav, "Status
kwmeng TYPE vbap-kwmeng, "Qty
lprc TYPE konv-kbetr, "List Price ZBP1
sprc TYPE konv-kbetr, "Std Pric ZNAA,ZNAX
netpr TYPE vbap-netpr, "Quot price
mrgn TYPE konv-kbetr, "margin%
END OF result_wa.
DATA: ikonv LIKE STANDARD TABLE OF konv_wa,
ivbap LIKE STANDARD TABLE OF vbap_wa,
ivbpa LIKE STANDARD TABLE OF vbpa_wa,
iresult LIKE STANDARD TABLE OF result_wa.
*Work storage
DATA: BEGIN OF ws,
vbeln TYPE vbak-vbeln,
ok_code TYPE sy-ucomm,
alv_save TYPE c, "ALV save
alv_variant TYPE disvariant, "ALV Variant
alv_sort TYPE lvc_t_sort, "Sort table
END OF ws.
*Data declarations for ALV Main list
DATA : ty_lay1 TYPE lvc_s_layo,
it_fieldcat TYPE lvc_t_fcat ,
ty_fieldcat TYPE lvc_s_fcat ,
l_smenu TYPE REF TO cl_ctmenu,
c_alv1 TYPE REF TO cl_gui_alv_grid,
c_cont1 TYPE REF TO cl_gui_custom_container,
e_dclick TYPE REF TO lcl_event_handler.
*Data declarations for ALV Interactive list
DATA : ty_lay2 TYPE lvc_s_layo,
it_fcat TYPE lvc_t_fcat ,
ty_fcat TYPE lvc_s_fcat ,
c_alv2 TYPE REF TO cl_gui_alv_grid,
c_cont2 TYPE REF TO cl_gui_custom_container.
*Field-Symbols
FIELD-SYMBOLS:
<konv> LIKE konv_wa,
<vbap> LIKE vbap_wa.
*Constants
CONSTANTS:
c_end_row TYPE i VALUE 65000.
*CLASS lcl_event_receiver DEFINITION
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS:
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row.
ENDCLASS. "lcl_event_handler DEFINITION
*CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_handler IMPLEMENTATION.
METHOD handle_double_click.
DATA: sec_wa LIKE LINE OF iresult.
*Reading the selected data into a variable
READ TABLE iresult INDEX e_row-index INTO sec_wa.
*Select the field details of the selected table
SELECT * FROM dd03l INTO CORRESPONDING FIELDS OF TABLE it_dd03l
WHERE tabname EQ ls_dd02l-tabname.
*Calling the ALV containing the field values
CALL SCREEN 101.
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_event_handler IMPLEMENTATION
*& SELECTION-SCREEN.
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
SELECT-OPTIONS:
s_vbeln FOR ws-vbeln DEFAULT '2002354788' OBLIGATORY.
SELECTION-SCREEN END OF BLOCK a.
INITIALIZATION.
PERFORM setup_screen_defaults.
START-OF-SELECTION.
PERFORM gather_report_data.
END-OF-SELECTION.
PERFORM create_output.
*& Form initialization
FORM setup_screen_defaults.
CLEAR: ws, konv_wa, vbap_wa, vbpa_wa.
REFRESH: ivbpa, ikonv, ivbap, iresult.
ENDFORM. " setup_screen_defaults
*& Form gather_report_data
FORM gather_report_data.
SELECT vbeln posnr parvw kunnr
INTO TABLE ivbpa
FROM vbpa
WHERE vbeln IN s_vbeln
AND ( parvw = 'SP' OR "SoldTO
parvw = 'WE' OR "ShipTo
parvw = 'ZT' ). "Top Parent
SELECT vkvbeln vkerdat vkknumv vpposnr vp~matnr
z1zansicat z1zansigrd z2~zcurrvaltnarea
z2zcurrcstusd m1zzbrndnm zg~zqedscgrp
m1mstav vpkwmeng vp~netpr
INTO CORRESPONDING FIELDS OF TABLE ivbap
FROM vbak AS vk
INNER JOIN vbap AS vp
ON vpvbeln = vkvbeln
INNER JOIN zmarall AS z1
ON z1matnr = vpmatnr
INNER JOIN zco002 AS z2
ON z2matnr = vpmatnr
INNER JOIN zglbprc AS zg
ON zgmatnr = vpmatnr
INNER JOIN mara AS m1
ON m1matnr = vpmatnr
WHERE vk~vbeln IN s_vbeln
AND vk~auart = 'AG'."AG = Quot
SORT ivbap BY posnr matnr.
SELECT kvknumv kvkposn kvkappl kvkschl kv~kbetr
INTO TABLE ikonv
FROM konv AS kv
FOR ALL ENTRIES IN ivbap
WHERE kv~knumv = ivbap-knumv
AND kv~kposn = ivbap-posnr
AND kv~kappl EQ 'V'
AND ( kv~kschl EQ 'ZBP1'
OR kv~kschl EQ 'ZNAX'
OR kv~kschl EQ 'ZNAA' ).
SORT ikonv BY knumv kposn.
LOOP AT ivbap ASSIGNING <vbap>.
CLEAR konv_wa.
READ TABLE ikonv INTO konv_wa WITH KEY
knumv = <vbap>-knumv
kposn = <vbap>-posnr
kschl = 'ZBP1'
BINARY SEARCH.
IF sy-subrc EQ 0.
<vbap>-lprc = konv_wa-kbetr.
ENDIF.
READ TABLE ikonv INTO konv_wa WITH KEY
knumv = <vbap>-knumv
kposn = <vbap>-posnr
kschl = 'ZNAX'
BINARY SEARCH.
IF sy-subrc EQ 0.
<vbap>-sprc = konv_wa-kbetr.
ENDIF.
READ TABLE ikonv INTO konv_wa WITH KEY
knumv = <vbap>-knumv
kposn = <vbap>-posnr
kschl = 'ZNAA'
BINARY SEARCH.
IF sy-subrc EQ 0.
<vbap>-sprc = konv_wa-kbetr.
ENDIF.
ENDLOOP.
SORT ivbap BY posnr matnr.
LOOP AT ivbap INTO vbap_wa.
MOVE-CORRESPONDING vbap_wa TO result_wa.
APPEND result_wa TO iresult.
CLEAR: vbap_wa, result_wa.
ENDLOOP.
ENDFORM. " gather_report_data
*& Form create_output
FORM create_output.
CALL SCREEN 100.
FREE: iresult.
ENDFORM. " create_output
*& Module PBO_0100 OUTPUT
text
MODULE pbo_0100 OUTPUT.
SET PF-STATUS '0100'.
SET TITLEBAR '0100'.
IF c_cont1 IS INITIAL.
*Creating object of container
CREATE OBJECT c_cont1
EXPORTING
container_name = 'CCONT1'.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Creating object of alv
CREATE OBJECT c_alv1
EXPORTING
i_parent = c_cont1.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Alv layout
PERFORM alv_100_layout.
PERFORM save_alv_layout.
*Alv field catalogue
PERFORM alv_100_fieldcat.
*Displaying the ALV grid
CALL METHOD c_alv1->set_table_for_first_display
EXPORTING
is_layout = ty_lay1
i_save = ws-alv_save
is_variant = ws-alv_variant
CHANGING
it_outtab = iresult[]
it_sort = ws-alv_sort
it_fieldcatalog = it_fieldcat[].
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Create object of the event class
*and setting handler for double click
CREATE OBJECT e_dclick.
SET HANDLER e_dclick->handle_double_click FOR c_alv1.
ENDIF.
ENDMODULE. " PBO_0100 OUTPUT
*& Module PAI_0100 INPUT
text
MODULE pai_0100 INPUT.
ws-ok_code = sy-ucomm.
CASE ws-ok_code.
WHEN 'BACK'.
CALL SELECTION-SCREEN 1000.
CLEAR ws-ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
CLEAR ws-ok_code.
EXIT.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
CLEAR ws-ok_code.
EXIT.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " PAI_0100 INPUT
*& Form alv_100_layout
text
--> p1 text
<-- p2 text
FORM alv_100_layout.
ty_lay1-numc_total = 'X'. " Numc total line
ty_lay1-cwidth_opt = 'X'. " Optimal column width
ty_lay1-detailinit = 'X'. " Show values that are initial in
ty_lay1-sel_mode = 'A'. " Column selection mode
ty_lay1-no_merging = 'X'. " No merging while sorting columns
ty_lay1-keyhot = 'X'.
ty_lay1-grid_title = 'SD Concessions'.
ty_lay1-zebra = 'X'.
ty_lay1-no_toolbar = ' '.
ENDFORM. " alv_100_layout
*& Form alv_100_fieldcat
text
--> p1 text
<-- p2 text
FORM alv_100_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 1.
ty_fieldcat-fieldname = 'posnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Item#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 2.
ty_fieldcat-fieldname = 'matnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Mat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 3.
ty_fieldcat-fieldname = 'zansicat'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'AnsiCat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 4.
ty_fieldcat-fieldname = 'zansigrd'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Grade'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 5.
ty_fieldcat-fieldname = 'zcurrvaltnarea'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Val Area'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 6.
ty_fieldcat-fieldname = 'zcurrcstusd'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Cost $'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 7.
ty_fieldcat-fieldname = 'zzbrndnm'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Brand'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 8.
ty_fieldcat-fieldname = 'zqedscgrp'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'QE'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 9.
ty_fieldcat-fieldname = 'mstav'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Status'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 9.
ty_fieldcat-fieldname = 'kwmeng'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Qty'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 10.
ty_fieldcat-fieldname = 'lprc'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'List Price'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 11.
ty_fieldcat-fieldname = 'sprc'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Discount'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 12.
ty_fieldcat-fieldname = 'netpr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Quot Price'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 13.
ty_fieldcat-fieldname = 'mrgn'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Margin%'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
ENDFORM. " alv_100_fieldcat
*& Module PBO_0101 OUTPUT
text
MODULE pbo_0101 OUTPUT.
*Check if the Custom container exists.
IF c_cont2 IS INITIAL.
*Creating container object
CREATE OBJECT c_cont2
EXPORTING
container_name = 'CCONT2'.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*creating ALV grid for interactive list
CREATE OBJECT c_alv2
EXPORTING
i_parent = c_cont2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*ALV layout
PERFORM alv_101_layout.
*ALV fieldcatalogue
PERFORM alv_101_fieldcat.
*Sorting the output by field position
SORT iresult BY posnr.
*ALV for display field details
CALL METHOD c_alv2->set_table_for_first_display
EXPORTING
is_layout = ty_lay2
CHANGING
it_outtab = iresult[]
it_fieldcatalog = it_fieldcat.
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.
ENDMODULE. " PBO_0101 OUTPUT
*& Module PAI_0101 INPUT
text
MODULE pai_0101 INPUT.
ENDMODULE. " PAI_0101 INPUT
*& Form alv_101_layout
text
--> p1 text
<-- p2 text
FORM alv_101_layout.
ty_lay2-grid_title = 'Line Details'.
ty_lay2-zebra = 'X'.
ty_lay2-no_toolbar = 'X'.
ENDFORM. " alv_101_layout
*& Form alv_101_fieldcat
text
--> p1 text
<-- p2 text
FORM alv_101_fieldcat.
REFRESH it_fieldcat.
REFRESH it_fcat.
CLEAR ty_fcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 1.
ty_fieldcat-fieldname = 'posnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Item#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 2.
ty_fieldcat-fieldname = 'matnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Mat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 3.
ty_fieldcat-fieldname = 'zansicat'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'AnsiCat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 4.
ty_fieldcat-fieldname = 'zansigrd'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Grade'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 5.
ty_fieldcat-fieldname = 'zcurrvaltnarea'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Val Area'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
ENDFORM. " alv_101_fieldcat
*& Form save_alv_layout
text
--> p1 text
<-- p2 text
form save_alv_layout.
ws-alv_save = 'A'.
ws-alv_variant-report = sy-repid.
endform. " save_alv_layoutHello
Creating fieldcatalogs manually is one of the major error sources in ALV programming.
There is hardly any reason why NOT to use the standard-fm LVC_FIELDCATALOG_MERGE in order to create a proper fieldcatalog.
If you need some modification of the standard fieldcatalog (e.g. renaming of columns, etc.) just do your post-processing after calling the fm.
Regards
Uwe -
Standard Report RM07MLBB output in internal Table
Hi Experts ,
i want Standard Report output which is in basic List to internal table .
standard report RM07MLBB . i don't want to use enhancement nor Export /import
is there any other way .
regards
Deepak.hi JACk ,
It was a perfect solution of using Include and using internal table of that report
i have done certain modification in calling Program such as
include rm07mlbb.
at selection-screen output.
perform hide_fields. " in order to hide screen of include rm07mlbb .
loop at screen.
if screen-name = 'LIFNR-LOW' or
screen-name = 'LIFNR-HIGH' or
screen-name = 'MATNR-LOW' or
screen-name = 'MATNR-HIGH' or
screen-name = 'WERKS-LOW' or
screen-name = 'WERKS-HIGH' or
screen-name = 'BUKRS-LOW' or
screen-name = 'BUKRS-HIGH' or
screen-name = '%_LIFNR_%_APP_%-TEXT' or
screen-name = '%_LIFNR_%_APP_%-OPTI_PUSH' or
screen-name = '%_LIFNR_%_APP_%-TO_TEXT' or
screen-name = '%_LIFNR_%_APP_%-VALU_PUSH' or
screen-name = '%_MATNR_%_APP_%-TEXT' or
screen-name = '%_MATNR_%_APP_%-OPTI_PUSH' or
screen-name = '%_MATNR_%_APP_%-TO_TEXT' or
screen-name = '%_MATNR_%_APP_%-VALU_PUSH' or
screen-name = '%_WERKS_%_APP_%-TEXT' or
screen-name = '%_WERKS_%_APP_%-OPTI_PUSH' or
screen-name = '%_WERKS_%_APP_%-TO_TEXT' or
screen-name = '%_WERKS_%_APP_%-VALU_PUSH' or
screen-name = '%_BUKRS_%_APP_%-TEXT' or
screen-name = '%_BUKRS_%_APP_%-OPTI_PUSH' or
screen-name = '%_BUKRS_%_APP_%-TO_TEXT' or
screen-name = '%_BUKRS_%_APP_%-VALU_PUSH' or
screen-name = '%B002006_BLOCK_1000' or
screen-name = '%B001000_BLOCK_1000' or
screen-name = '%_ALV_DEF_%_APP_%-TEXT' or
screen-name = 'ALV_DEF' or
screen-name = 'NULLS' or
screen-name = '%_NULLS_%_APP_%-TEXT' .
screen-invisible = 1.
screen-active = 0.
modify screen.
endif.
endloop.
if not p_werks is initial .
werks-low = p_werks.
append werks.
endif.
if not p_bukrs is initial .
bukrs-low = p_bukrs.
append bukrs.
endif.
delete adjacent duplicates from werks comparing low.
delete adjacent duplicates from bukrs comparing low.
endform " hide_fields
Regards
Deepak. -
Problem in filling the final internal table
Hi,
I am working on a code in which i have to fill up the final internal table which will store the values coming form different internal tables.Here's the code which i am trying to do but it is not giving the execat functionality.In this code ITOUTPUT is the final itab which is storing the values of all other internal tables.
Here's the code:-
loop at itab1.
select single maktx into v_item from makt where matnr = itab1-matnr.
ITOUTPUT-banfn = ITab1-banfn.
ITOUTPUT-badat = ITab1-badat.
ITOUTPUT-meins = ITab1-meins.
ITOUTPUT-menge = ITab1-menge.
ITOUTPUT-lfdat = ITab1-lfdat.
IF ITAB1-MEINS = 'KG'.
V_TOTREQ = V_TOTREQ + ITAB1-MENGE.
ELSEIF ITAB1-MEINS = 'TO'.
V_TOTREQ = V_TOTREQ + ( ITAB1-MENGE * 1000 ).
ELSEIF ITAB1-MEINS = 'G'.
V_TOTREQ = V_TOTREQ + ( ITAB1-MENGE / 1000 ).
ENDIF.
v_tpo = 0.
v_por = 0.
LOOP AT ITPO WHERE BANFN = ITAB1-BANFN AND bnfpo = ITAB1-bnfpo.
if v_por <> '0'.
write : / ' '.
endif.
ITOUTPUT-ebeln = ITPO-ebeln.
ITOUTPUT-aedat = ITPO-aedat.
ITOUTPUT-lifnr = ITPO-lifnr.
ITOUTPUT-menge = ITPO-menge.
ITOUTPUT-EINDT = ITPO-EINDT.
IF ITAB1-MEINS = 'KG'.
V_TOTPO = V_TOTPO + ITPO-MENGE.
ELSEIF ITPO-MEINS = 'TO'.
V_TOTPO = V_TOTPO + ( ITPO-MENGE * 1000 ).
ELSEIF ITPO-MEINS = 'G'.
V_TOTPO = V_TOTPO + ( ITPO-MENGE / 1000 ).
ENDIF.
v_tpo = v_tpo + itpo-menge.
v_tgr = 0.
v_por = 1.
v_grr = 0.
loop at itmrn where ebeln = itpo-ebeln and ebelp = itpo-ebelp.
if v_grr <> '0'.
write : / ' '.
endif.
select single budat from mkpf into v_grdate where MBLNR = itmrn-MBLNR.
write: 143 Itmrn-menge,v_grdate .
itoutput-PMENGE = itmrn-menge.
v_tgr = v_tgr + itmrn-menge.
v_grr = 1.
endloop.
p_po = itpo-menge - v_tgr.
write: 173 p_po.
ENDLOOP.
p_req = itab1-menge - v_tpo.
write : 195 p_req.
endloop.
loop at itoutput.
write:/ itoutput-banfn,12 itoutput-badat,24 v_item,50 itoutput-meins,53 itoutput-menge,itoutput-lfdat,
89 ITPO-ebeln,100 ITPO-aedat,111 ITPO-lifnr,(10) itpo-menge, ITPO-eindt.
MODIFY itoutput.
endloop.Hi,
Ok,i ha d checked my code by using your logic and giving the run time error ......
i had debugged my code (orignal onementioned in above thread with little modification) in which i am able to see that finaloutput (intrenal table) is getting filled properly and the problem arises when the cursor comes to the write statement ... it is repeating some of the values when output is displayed where as before displaying output this iternal table is having the correct data. i am using the following code :-
append itoutput.
ENDLOOP.
p_req = itab1-menge - v_tpo.
write : 195 p_req.
append itoutput. ,<--- added this
clear itoutput. <--- added this
endloop.
loop at itoutput.
write:/ itoutput-banfn,12 itoutput-badat,24 v_item,50 itoutput-meins,53 itoutput-menge,itoutput-lfdat,
89 ITPO-ebeln,100 ITPO-aedat,111 ITPO-lifnr,(10) itpo-menge, ITPO-eindt.
MODIFY itoutput. <------ not removed
endloop.
Maybe you are looking for
-
My Apple ID is coming up on my girlfriends iphone i think
Basically last week I brought my other half some more storage for her iphone. So I used my debit card information on her iphone so she wouldn't know I did this. So followed all the information put my card details in. Sorted extra storage for her (no
-
I am trying to sync my brand new ipad with my imac (itunes) and i keep getting a message to update itunes on my ipad. how do i update software on my ipad? my ipad device is not displaying in itunes on my imac to be able to sync. Can anyone advise?
-
Get audiobook from ipad to iphone
I purchased an audiobook on my ipad with the intention of listening on my iPhone. I sync my ipad with my laptop and my iphone with my desktop currently. I was able to get the book from my ipad to my laptop, but am stuck there. I'm extremely frustrate
-
I am unable to update my 4S to OS7.
I am unable to update my 4S to OS7. It continually tells me that the update failed because i lost my internet connection. I did NOT lose it though. I also do not have a computer that can access iTunes. Help!
-
Any help with this issue would be greatly appreciated, as I will NOT pay for the movie again as it was already purchased.