Issue in display format of internal table in smartform
I m printing an internal table in smartform.when a particular field exceeds the coloumn's length.the rest of the texts come down to the next line.It can be shown in the below example.i m printing "+ text to be printed" in that particular coloumn.
Because of the size of the coloumn in table ,"ed." comes down as shown.
<b>+ text to be print
ed. </b>
its coming by default.
I want it like <b>+ text to be print
ed</b>
I dont want ed to come directly down '+'.I want it to start from where 't' of 'text'
starts in the above line.
Notice that the requirement is to print "ed" after '2' spaces.And we can not use the string length concept bcoz not of characters after which the line comes down is not fixed.May be some change of setting in smartform will do the trick.
Please suggest what i need to do to get the desired result...
Regards
Rudra
Unfortunately there is no such way.
Similar Messages
-
Issue in populating the dynamic internal table in SMARTFORMS
Hi Experts,
My requirement is I have a table in the below format.
Measuring Point
Description of Measuring Point
UOM
Date
Time
Reading
96
POWER GENERATED
kwh
20140501
101837
1.00E+04
96
POWER GENERATED
kwh
20140502
102220
1.00E+04
96
POWER GENERATED
kwh
20140503
104623
1.25E+01
96
POWER GENERATED
kwh
20140504
101111
2.00E+03
98
AUX POWER CONSUME
kwh
20140501
101837
1.00E+05
98
AUX POWER CONSUME
kwh
20140502
102220
1.00E+05
99
NET POWER EXPORTED
kwh
20140501
101837
1.00E+07
99
NET POWER EXPORTED
kwh
20140502
102220
1.00E+07
100
AVG POWER GENERATED
MW
20140501
101837
1.00E+02
100
AVG POWER GENERATED
MW
20140502
102220
1.00E+02
101
AUX POWER CONSUMED(%)
20140501
101837
1.00E+02
101
AUX POWER CONSUMED(%)
20140502
102220
1.01E+01
102
PLANT AVAILABLE HRS
hrs
20140501
101837
1.01E+01
102
PLANT AVAILABLE HRS
hrs
20140502
102220
1.01E+01
103
PLANT RUN HOURS
hrs
20140501
101837
1.01E+01
103
PLANT RUN HOURS
hrs
20140502
102220
1.01E+01
104
PLANT AVAILABLITY FACTOR
20140501
101837
1.00E+02
104
PLANT AVAILABLITY FACTOR
20140502
102220
1.00E+02
which i need to display like below based on the user Requirement for print out.
DATE
POWER GENERATED(96)
AUX POWER CONSUME(98)
NET POWER EXPORTED(99)
AVG POWER GENERATED(100)
AUX POWER CONSUMED(%)(101)
PLANT AVAILABLE HRS(102)
PLANT RUN HOURS(103)
PLANT AVAILABLITY FACTOR(104)
kwh
kwh
kwh
MW
hrs
hrs
01.05.2014
1.00E+04
1.00E+05
1.00E+07
1.00E+02
1.00E+02
1.01E+01
1.01E+01
1.00E+02
02.05.2014
1.00E+04
1.00E+05
1.00E+07
1.00E+02
1.01E+01
1.01E+01
1.01E+01
1.00E+02
03.05.2014
1.25E+01
04.05.2014
2.00E+03
Now the issue is how to assign the values of stops from the internal table to dynamically for a specific date in SMARTFORMS?
Please help me in resolving this issue.Hi,
See if this articale is good for you:
The case of "dynamic columns in smartform"
Regards. -
Issue in display format of a internal table in SMARTFORM
I m printing an internal table in smartform.when a particular field exceeds the coloumn's length.the rest of the texts come down to the next line.It can be shown in the below example.i m printing "+ text to be printed" in that particular coloumn.
Because of the size of the coloumn in table ,"ed." comes down as shown.
+ text to be print
ed.
I dont want ed to come directly down '+'.I want it to start from where 't' of 'text'
starts in the above line.
Notice that the requirement is to print "ed" after '4' spaces.
Please suggest what i need to do to get the desired result...
Regards
RudraUnfortunately there is no such way.
-
Retrieving data from Excel format to internal table(deep structure)
hi all,
can anybody help me how to Retrieving data from Excel format to internal table(deep structure)
and if u have any sample code for that please send it.
my internal table is like this
DATA: BEGIN OF ty_text,
vbeln TYPE vbeln,
posnr TYPE posnr,
seqno TYPE seqno,
textid TYPE tdid,
tdline TYPE tdline,
END OF ty_text.
DATA: BEGIN OF ty_item,
vbeln TYPE vbeln,
posnr TYPE posnr,
dispct1(16),
dispct2(16),
dispct3(16),
text LIKE table of ty_text,
END OF ty_item.hi,
check this code
TABLES:zmatnr.
TYPE-POOLS truxs.
DATA : itab LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
DATA row LIKE alsmex_tabline-row.
data : gi_final like zmatnr occurs 0 with header line.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETER : pfname LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pfname.
PERFORM search.
START-OF-SELECTION.
perform process.
form process.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = pfname
i_begin_col = 1
i_begin_row = 2
i_end_col = 12
i_end_row = 65000
TABLES
intern = itab
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.
describe table itab lines itab_count.
row = 1.
loop at itab.
if itab-row <> row.
append gi_final.
clear gi_final.
endif.
case itab-col.
when '1'.
gi_final-MATNR = itab-value.
when '2'.
gi_final-Maktx = itab-value.
endcase.
row = itab-row.
endloop.
append gi_final.
clear gi_final.
endform.
FORM search .
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
static = 'X'
CHANGING
file_name = pfname.
ENDFORM.
regards
siva -
Passing internal tables into smartforms
Hi All,
I am testing a smartform for PO. But the smartform is already designed and it has two internal tables of type EKKO and EKPO. When i run the smartform its displaying the layout correctly but with no data ,which is true as the two internal tables have no data. So i want to fill those two internal tables based on the purchase order number/ numbers. So that i can test the smartform with those purchase order numbers.
I want to create a parameter / select option in smartform so that when we enter the PO number those internal tables will be filled. How to create those options in the smartform.
If i have to create through an ABAP program then i want to know how to pass those two internal tables to smartform. (Shall i have to call the FM couple of times and then pass those two internal tables).
Thanks in AdvanceYou fill the tables in the print program and pass the tables to the SmartForm function module under the tables section. See the FM call below (CALL FUNCTION lf_fm_name) and note that I am only passing in one internal table. If you wish you may pass in more than one table.
*& Form smartform_print
* text
* --> p1 text
* <-- p2 text
FORM smartform_print .
DATA: lf_fm_name TYPE rs38l_fnam.
DATA: ls_control_param TYPE ssfctrlop.
DATA: ls_composer_param TYPE ssfcompop.
DATA: ls_recipient TYPE swotobjid.
DATA: ls_sender TYPE swotobjid.
DATA: lf_formname TYPE tdsfname.
DATA: ls_addr_key LIKE addr_key.
PERFORM set_print_param USING ls_addr_key
CHANGING ls_control_param
ls_composer_param
ls_recipient
ls_sender
retcode.
*Get the Smart Form name.
IF NOT tnapr-sform IS INITIAL.
lf_formname = tnapr-sform.
ELSE.
MESSAGE e001(/smb40/ssfcomposer).
ENDIF.
IF vbdkr-vkorg = '0035'.
IF w_regio = 'QC'.
tnapr-fonam = 'ZPCC_INVOICE_FR'.
ENDIF.
ENDIF.
* IF NOT tnapr-sform IS INITIAL.
* lf_formname = tnapr-sform.
* ELSE.
* MESSAGE e001(/smb40/ssfcomposer).
* ENDIF.
* determine smartform function module for invoice
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING formname = lf_formname
* variant = ' '
* direct_call = ' '
IMPORTING fm_name = lf_fm_name
EXCEPTIONS no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
* error handling
retcode = sy-subrc.
IF sy-subrc = 1.
MESSAGE e001(/smb40/ssfcomposer).
ENDIF.
IF sy-subrc = 2.
MESSAGE e002(/smb40/ssfcomposer).
ENDIF.
PERFORM protocol_update.
ENDIF.
CALL FUNCTION lf_fm_name
EXPORTING
archive_index = toa_dara
* ARCHIVE_INDEX_TAB =
archive_parameters = arc_params
control_parameters = ls_control_param
* MAIL_APPL_OBJ =
mail_recipient = ls_recipient
mail_sender = ls_sender
output_options = ls_composer_param
user_settings = ' '
vbdkr = vbdkr
temp_jmval = temp_jmval
temp_agval = temp_agval
w_ship = w_ship
w_ktgrd = w_ktgrd
likp = likp
w_trlrnbr = w_trlrnbr
w_sealnbr = w_sealnbr
w_booknbr = w_booknbr
w_lc = w_lc
w_shippoint = w_shippoint
billto_fedid = billto_fedid
soldto_fedid = soldto_fedid
shipto_fedid = shipto_fedid
vbco3 = vbco3
w_z4_address = w_z4_address
w_stawn = w_stawn
w_herkl = w_herkl
new_rate = new_rate
vblkp = vblkp
TABLES
vbdpr = tvbdpr
* t_containers = t_containers
* tdomvd = tkomvd
* da_xfplt = da_xfplt
* payment_split = payment_split
* komk = komk
* frt_conditions = frt_conditions
* IMPORTING
* DOCUMENT_OUTPUT_INFO =
* JOB_OUTPUT_INFO =
* JOB_OUTPUT_OPTIONS =
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5
IF sy-subrc <> 0.
retcode = sy-subrc.
PERFORM protocol_update.
* get SmartForm protocoll and store it in the NAST protocoll
PERFORM add_smfrm_prot.
ENDIF.
ENDFORM. " smartform_print
Davis -
Declaring an internal table in smartform
hi,
can anyone tell how to declare internal table in smartform.
the internal table contains fields from 2 or more data dictionary tables(eg.kna1
and adrc). after this from the print program(internal table containing data in print
program) internal table should be passed to the smartform.
thanks.hi laxya,
if u want to pass the data from internal table in print program to Smartform.. there is only way.. that is using form interface..
1. goto se11, create a structure same as the itab in the print program.ex. <b>z_itab</b>
2. create line type... se11>select radio button-DATA type><b>z_it_itab</b> >press create>then select>TABLE Type> then entrer some text--> in the line type Field in giveth Str name u have created in STEP 1. activate it.
3. got SMARTFORMS-> form inteface>tables tabe--> give some name ex <b>IT_tab type z_it_itab</b>.
then acivate it.. then in the driver progam pass this table data.
Exapmpel
CALL FUNCTION fp_v_fm_name
EXPORTING
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = fp_st_control_parameters
user_settings = space
output_options = fp_st_output_options
wa_vbdkr = fp_st_vbdkr
IMPORTING
job_output_info = l_it_ssfcrescl
job_output_options = l_it_ssfcresop
TABLES
<b> IT_tab = z_it_itab (or table in driver program)</b>
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Another way is cteate a type in Globaldifination-->types tab..
ex:
types: begin of ty_itab,
matnr type matnr,
meins type meins
vrkme type vrkme,
end of ty_itab,
ty_it_itab type standard table of ty_itab.
then GLOBAL DIFINATION>GLOBAL DATA TAB>IT)ITAB TYPE TY_IT_ITAB.
BUT In this u can't pass the data from the print Program.. if u want to populate data in to this table... u have to write the Select query in the GLOBAL DIFINATIONS-->INITILIZATIONS TAB.
Please Close this thread.. when u r problem is solved
Reward if Helpful
Regards
Naresh Reddy K
Message was edited by:
Naresh Reddy -
How to Define Internal Table in Smartform
Hello,
I have some problem on define Internal Table in Smartform
I define a Temp_IT_Gen Type LBBIL_IT_GEN in Global Definiations
but i find that it is not available for me to append data into it,
the error message is Temp_IT_Gen is not a Internal Table - the Occurs n Specification is missing
so how can i solve it?
i want to use the internal table in the hold program.
Thanks a lot in advance.Hi,
First U define the Table type in 'TYPES' tab of Global Definitions and then assing that table type to Internal table in 'Global Data' tab.
Eg:
define the Table Type like below in TYPES tab.
TYPES:BEGIN OF ty_TEMP.
INCLUDE STRUCTURE XXXXXXX.
TYPES:END OF ty_TEMP.
TYPES: g_t_temp TYPE STANDARD TABLE OF ty_TEMP .
Now, define the Internal table in Global Data tab like below:
Variable Name Type assignment Associated Type
G_T_ITEM_1 TYPE G_T_TEMP
NOTE: whatever U define in Global Definitions can be used only in SMARTFORM, if u want to use it in Program U must define in Form Interface.
Hope it helps!!
Rgds,
Pavan -
How to Import customized internal table to smartform from Print Program
Hi Gurus,
I want to Import customized internal table to smartform from print program, Can anybody tell me how it is possible.
With regards,
S.SaravananThere is no problem passing an internal table to a smarforms, smartforms have the same interface as a function module ([Defining the Form Interface|http://help.sap.com/saphelp_nw70/helpdata/en/1c/f40c5bddf311d3b574006094192fe3/frameset.htm] in [Smart Forms|http://help.sap.com/saphelp_nw70/helpdata/en/a5/de6838abce021ae10000009b38f842/frameset.htm]) so could you elaborate a little more on your requirement (is it a standard a custom forms, etc.)
Regards,
Raymond -
How to build tree/hierarchy/explorer format in internal table
Dear Friends,
I have one internal table with parent and child, again child will be acting as parent and it can have further childs ......
like that it goes on there is no constant levels it goes on....
for example.
parent child
100 101
102
103
101 201
202
102 301
103 401
402
403
this has to be displayed in hierarchy mode.
here i to as a column wich has to represent its position/level in the hierarchy like:
1
1.1
1.1.1
1.2
1.2.1
......n
1.2.2...n
1.3
2
2.1
2.2
3
etc...
let me know any ideas to get the maping of the rows to put it in tree format( like windows explorer).
Thanks,
Mahesh.GattuREPORT Z_TREE.
TYPE-POOLS: ICON.
TYPE-POOLS : FIBS,STREE.
INCLUDE <ICON>.
DATA : T_NODE TYPE SNODETEXT.
DATA : NODE_TAB LIKE T_NODE OCCURS 0 WITH HEADER LINE.
DATA : ITAB LIKE VBAP OCCURS 0 WITH HEADER LINE.
DATA : ITTX LIKE MAKT OCCURS 0 WITH HEADER LINE.
DATA : LI TYPE I VALUE 1.
CLEAR : NODE_TAB, NODE_TAB[].
SELECT * FROM VBAP INTO TABLE ITAB UP TO 50 ROWS.
SELECT * FROM MAKT INTO TABLE ITTX FOR ALL ENTRIES IN ITAB WHERE MATNR = ITAB-MATNR.
NODE_TAB-TYPE = 'T'.
NODE_TAB-NAME = ''.
NODE_TAB-TLEVEL = '01'.
NODE_TAB-NLENGTH = ''.
NODE_TAB-COLOR = '3'.
NODE_TAB-TEXT = 'ICON_DETAIL'.
NODE_TAB-TCOLOR = '1'.
NODE_TAB-KIND = 'I'.
NODE_TAB-TLENGTH = '2'.
NODE_TAB-TEXT1 = 'Details'.
NODE_TAB-TCOLOR1 = '2'.
NODE_TAB-KIND = 'I'.
NODE_TAB-TLENGTH1 = '10'.
APPEND NODE_TAB.
CLEAR NODE_TAB.
LOOP AT ITAB.
AT NEW VBELN.
NODE_TAB-TYPE = 'P'.
* node_tab-name = 'Sale Number'.
NODE_TAB-TLEVEL = '02'.
* node_tab-nlength = '12'.
NODE_TAB-TCOLOR = '4'.
NODE_TAB-TEXT = ITAB-VBELN.
NODE_TAB-TLENGTH ='10'.
APPEND NODE_TAB.
CLEAR NODE_TAB.
ENDAT.
READ TABLE ITTX WITH KEY MATNR = ITAB-MATNR.
NODE_TAB-TYPE = 'P'.
* node_tab-name = 'LI'.
NODE_TAB-TLEVEL = '03'.
* node_tab-nlength = '4'.
NODE_TAB-TEXT = 'ICON_MATERIAL'.
NODE_TAB-TCOLOR = '1'.
NODE_TAB-KIND = 'I'.
NODE_TAB-TLENGTH = '2'.
NODE_TAB-TCOLOR1 = '5'.
NODE_TAB-TEXT1 = ITAB-MATNR.
NODE_TAB-TLENGTH1 = '20'.
NODE_TAB-TCOLOR2 = '7'.
NODE_TAB-TEXT2 = ITTX-MAKTX.
LI = STRLEN( ITTX-MAKTX ).
NODE_TAB-TLENGTH2 = LI.
APPEND NODE_TAB.
CLEAR NODE_TAB.
* READ TABLE ITTX WITH KEY MATNR = ITAB-MATNR.
* NODE_TAB-TYPE = 'P'.
** node_tab-name = 'LI'.
* NODE_TAB-TLEVEL = '03'.
** node_tab-nlength = '4'.
* NODE_TAB-TCOLOR1 = '7'.
* NODE_TAB-TEXT1 = ITTX-MAKTX.
* LI = STRLEN( ITTX-MAKTX ).
* NODE_TAB-TLENGTH = LI.
* APPEND NODE_TAB.
* CLEAR NODE_TAB.
ENDLOOP.
CALL FUNCTION 'RS_TREE_CONSTRUCT'
TABLES
NODETAB = NODE_TAB.
*DATA: type_mapping TYPE stree_ctl_type_mapping_tab.
*DATA: wa_type TYPE stree_ctl_type_mapping.
*CLEAR: type_mapping[].
*wa_type-type = 'A'.
*wa_type-icon = '@BL@'.
*APPEND wa_type TO type_mapping.
CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
EXPORTING
STATUS = 'STANDARD'
USE_CONTROL = 'L'. -
Need some logic for displaying data from Internal Table
Hi Guys,
I have a Internal Table with multiple entries.
My ITAB looks like below.
PN VBELN MATNR MATKX
1 111 P-101 XXX
2 121 P-102 XYZ
2 112 P-103 ABC
3 134 P-104 DEF
3 124 P-105 EFG
Now my requirement is I need to display the out put as follows through ALV or normal display.
<Header> <Date>
<Time>
PN = 1
VBELN MATNR MATKX
111 P-101 XXX
<Footer>
Some gap (May be a line to differentiate)
<Header > <Date>
<Time>
PN = 2
VBELN MATNR MATKX
121 P-102 XYZ
112 P-102 ABC
<Footer>
Some gap (May be a line to differentiate)
<Header > <Date>
<Time>
PN = 3
VBELN MATNR MATKX
134 P-104 DEF
124 P-105 EFG
<Footer>
Thanks in Advance.
Prasad.HI,
Use:
Data: W_PNlike PN.
LOOP AT ITAB.
If Itab-PN ne W_PN.
<Header> <Date>
<Time>
PN = 1.
VBELN MATNR MATKX >>>>>>>>>>>>>>>First Line enter
ELSE.
VBELN MATNR MATKX > line Next entry
ENDIF.
W_PN = ITAB-PN.
AT-END PN.
<Footer>
ENDAT.
ENDLOOP.
Hope this resolve your issue.
Regards,
Gurpreet -
Issue with WRITE statement from Internal Table
Hi All,
I have written the below code in a infoset query, the syntax check is ok & when i run the query in debugging mode, i find the internal table being filled with the values & the write statement outputing the values as well.
But the problem is when i execute the query the output does not show all the lines, instead just displays the last record . What could be the mistake?
Is it because i have defined Y_EBELN, Y_EBELP & Y_OPENQTY as nodes in the Extras Tab of the infoset & have chosen this for display in my query? How to display the output from my internal table in my query output?
Hope my problem is clear, await clarification.
Vivek
Code
types:
Begin of itab,
wl_ebeln type eket-ebeln,
wl_ebelp type eket-ebelp,
wl_openqty type eket-menge,
End of itab.
Data: il_po type table of itab with header line.
*Display open PO for materials
SELECT EKETEBELN EKETEBELP EKETMENGE EKETWEMNG EKET~EINDT
INTO (Y_EBELN, Y_EBELP, WL_MENGE, WL_WEMNG, Y_EINDT)
FROM EKET
INNER JOIN EKPO
ON EKETEBELN = EKPOEBELN
AND EKETEBELP = EKPOEBELP
INNER JOIN MARD
ON EKPOMATNR = MARDMATNR
AND EKPOWERKS = MARDWERKS
AND EKPOLGORT = MARDLGORT
WHERE EKPO~MATNR = MARD-MATNR
AND EKPO~WERKS = MARD-WERKS
AND EKPO~LGORT = MARD-LGORT
AND EKPO~LOEKZ = SPACE
AND EKPO~ELIKZ = SPACE.
*Display only still open qty per schedule line
Y_OPENQTY = WL_MENGE - WL_WEMNG.
il_po-wl_ebeln = Y_EBELN.
il_po-wl_ebelp = Y_EBELP.
il_po-wl_openqty = Y_OPENQTY.
append il_po.
ENDSELECT.
ENDIF.
Loop at il_po.
write:/ il_po-wl_ebeln, il_po-wl_ebelp, il_po-wl_openqty.
endloop.Hi Vivek,
Try it like this.
Data: Begin of itab,
lifnr type lfa1-lifnr,
name1 type lfa1-name1,
land1 type lfa1-land1,
End of itab,
it_lfa1 like table of itab with header line,
lifnr like lfa1-lifnr,
name1 like lfa1-name1,
land1 like lfa1-land1.
select lifnr name1 land1 into (lifnr, name1, land1)
from lfa1.
it_lfa1-lifnr = lifnr.
it_lfa1-name1 = name1.
it_lfa1-land1 = land1.
append it_lfa1.
endselect.
loop at it_lfa1.
write:/ it_lfa1-lifnr, it_lfa1-name1, it_lfa1-land1.
endloop.
Note:
In place of the above select you insert your join select statement. It is working for me.
You have declared your internal table wrongly. In the internal table instead of TYPE use LIKE, it will work.
Hope this will work for you.
Thanks & Regards
Haritha. -
How to display data from internal table in the SELECTION-SCREEN
Hello Experts,
My requirement is to display the data's from an internal table in the selection screen. I tried using selection-screen comment. But it is working only for a single record. Can anyone please tell me how to do this?Hi Ritika,
we cant use write statement inside selection-screen.
see my coding.
SELECTION-SCREEN BEGIN OF SCREEN 123 AS WINDOW TITLE TEXT-456.
SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-BL1
NO INTERVALS.
SELECT-OPTIONS SEL1 FOR SY-DATUM.
PARAMETERS PAR1(10).
<b>** I WANT ALL RECORDS FROM AN INTERNAL TABLE HERE ONLY</b>
SELECTION-SCREEN END OF BLOCK BL1.
SELECTION-SCREEN PUSHBUTTON 2(10) but1 USER-COMMAND cli1.
SELECTION-SCREEN PUSHBUTTON 20(10) but2 USER-COMMAND cli2.
SELECTION-SCREEN END OF SCREEN 123. -
Update all alv (grid) displayed records to internal table
Hi all,
i want to update the records into the internal table which are changed by the user in the edit field.
after he select save button.
i have to save the ALV grid displayed records in the internal table.
hw can i do this ?ALV with EDIT and SAVE functionality
Code:REPORT z_demo_alv_jg.*******************************************************************
TYPE-POOLS *
TYPE-POOLS: slis. *******************************************************************
INTERNAL TABLES/WORK AREAS/VARIABLES *
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
w_field TYPE slis_fieldcat_alv,
p_table LIKE dd02l-tabname,
dy_table TYPE REF TO data,
dy_tab TYPE REF TO data,
dy_line TYPE REF TO data.*******************************************************************
FIELD-SYMBOLS *
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
<dyn_wa> TYPE ANY,
<dyn_field> TYPE ANY,
<dyn_tab_temp> TYPE STANDARD TABLE.*******************************************************************
SELECTION SCREEN *
PARAMETERS: tabname(30) TYPE c,
lines(5) TYPE n.*******************************************************************
START-OF-SELECTION *
START-OF-SELECTION.* Storing table name
p_table = tabname.* Create internal table dynamically with the stucture of table name
entered in the selection screen
CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_table->* TO <dyn_table>.
IF sy-subrc <> 0.
MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'. LEAVE TO LIST-PROCESSING.
ENDIF.
Create workarea for the table
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.* Create another temp. table
CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_tab->* TO <dyn_tab_temp>. SORT i_fieldcat BY col_pos.* Select data from table
SELECT * FROM (p_table)
INTO TABLE <dyn_table>
UP TO lines ROWS. REFRESH <dyn_tab_temp>.* Display report
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'SET_PF_STATUS'
TABLES
t_outtab = <dyn_table>
EXCEPTIONS
program_error = 1
OTHERS = 2. IF sy-subrc <> 0. ENDIF.&----
*& Form SET_PF_STATUS
Setting custom PF-Status
-->RT_EXTAB Excluding table
FORM set_pf_status USING rt_extab TYPE slis_t_extab. SET PF-STATUS 'Z_STANDARD'.ENDFORM. "SET_PF_STATUS&----
*& Form user_command
Handling custom function codes
-->R_UCOMM Function code value
-->RS_SELFIELD Info. of cursor position in ALV
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.* Local data declaration
DATA: li_tab TYPE REF TO data,
l_line TYPE REF TO data.* Local field-symbols
FIELD-SYMBOLS:<l_tab> TYPE table,
<l_wa> TYPE ANY.* Create table
CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN li_tab->* TO <l_tab>.* Create workarea
CREATE DATA l_line LIKE LINE OF <l_tab>.
ASSIGN l_line->* TO <l_wa>. CASE r_ucomm.* When a record is selected
WHEN '&IC1'.* Read the selected record
READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
rs_selfield-tabindex. IF sy-subrc = 0.* Store the record in an internal table
APPEND <dyn_wa> TO <l_tab>.* Fetch the field catalog info
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'Z_DEMO_PDF_JG'
i_structure_name = p_table
CHANGING
ct_fieldcat = i_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc = 0.* Make all the fields input enabled except key fields
w_field-input = 'X'. MODIFY i_fieldcat FROM w_field TRANSPORTING input
WHERE key IS INITIAL. ENDIF.* Display the record for editing purpose
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
it_fieldcat = i_fieldcat
i_screen_start_column = 10
i_screen_start_line = 15
i_screen_end_column = 200
i_screen_end_line = 20
TABLES
t_outtab = <l_tab>
EXCEPTIONS
program_error = 1
OTHERS = 2. IF sy-subrc = 0.* Read the modified data
READ TABLE <l_tab> INDEX 1 INTO <l_wa>.* If the record is changed then track its index no.
and populate it in an internal table for future
action
IF sy-subrc = 0 AND <dyn_wa> <> <l_wa>.
<dyn_wa> = <l_wa>.
i_index = rs_selfield-tabindex.
APPEND i_index.
ENDIF.
ENDIF. ENDIF.* When save button is pressed
WHEN 'SAVE'.* Sort the index table
SORT i_index.* Delete all duplicate records
DELETE ADJACENT DUPLICATES FROM i_index. LOOP AT i_index.* Find out the changes in the internal table
and populate these changes in another internal table
READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX i_index.
IF sy-subrc = 0.
APPEND <dyn_wa> TO <dyn_tab_temp>.
ENDIF. ENDLOOP.* Lock the table
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3. IF sy-subrc = 0.* Modify the database table with these changes
MODIFY (p_table) FROM TABLE <dyn_tab_temp>. REFRESH <dyn_tab_temp>.* Unlock the table
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table. ENDIF.
ENDCASE. rs_selfield-refresh = 'X'.ENDFORM. "user_command -
Download into CSV format from internal table
Hi,
I would like to download my internal table records in CSV format without any manual formating.
It is easy to concatenate internal table fields into a string with ',' seperator. But I would like to do in a better way that this becasue of more number of fields in my internal table.
Could you someone help me in this, I have searched in this form for help I found few function modules which did not help me.
SAP_CONVERT_TO_CSV_FORMAT / LIST_DOWNLOAD .
Prabhu Rajesh.Sravan,
type-pools: truxs.
DATA : BEGIN OF itab OCCURS 0,
name1(10),
name2(10),
END OF itab.
DATA : itab1 TYPE truxs_t_text_data.
DO 10 TIMES.
itab-name1 = 'Prabhu'.
itab-name2 = 'Rajesh'.
APPEND itab.
CLEAR : itab.
ENDDO.
LOOP AT itab.
WRITE:/ itab-name1, itab-name2.
ENDLOOP.
CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'
EXPORTING
i_field_seperator = ';'
I_LINE_HEADER =
i_filename =
I_APPL_KEEP = ' '
TABLES
i_tab_sap_data = itab
CHANGING
I_TAB_CONVERTED_DATA = itab1
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. -
How to call Subroutines,Standard Text & using Internal Table in SmartForm
Hi all,
need help in the following areas.Its very urgent!
1.How to CAll Subroutines in Smart Forms
2.How to CAll Standard Text in Smart Forms
Situation:
We have an Internal Table T_SALES with all the data which am going to display in the smartform,How to retrive data from an internal table in Smart forms
Any Help in this direction would be highly appreciated.
Regards
RamuHi,
When you are using quantity or currency fields, you have to mentiong the reference fileds in a tab called CURRENCY/QUANTITY FILEDS in the GLOBAL DATA node.
Specifying a Currency or Quantity Reference
Use
In the ABAP Dictionary, you can assign a currency or quantity field to a table field. In the output of these fields, the system can then insert the relevant currency or unit:
· If the value field is in the same table as the corresponding currency or quantity field, the system recognizes the reference automatically, and formats the value field according to the currency or unit in the assigned field.
· If the value field is in a different table from the currency or quantity field, the system cannot recognize this reference automatically.
In the second case, you must indicate this reference to the system in the form, to ensure that the value field is formatted correctly.
Procedure
You want to assign a currency or quantity field in one table (for example, CURTAB) to a value field in another table (for example, VALTAB).
1. Create the reference to the currency field by entering the following values:
- Field Name: VALTAB-VALUE, if this is the value field of VALTAB that you want to display.
- Reference Field: CURTAB-CURRENCY, which is the currency field of CURTAB.
2. Under Data Type, specify whether the data type is a currency or quantity.
Result
In the output of the PDF-based print form, the system formats the value field VALTAB-VALUE according to the assigned value in the currency or quantity field of the global variable CURTAB-CURRENCY.
Thanks and Regards,
Bharat Kumar Reddy.V
Message was Added by: Bharat Reddy V
Message was Added by: Bharat Reddy V
Maybe you are looking for
-
How do I add my phone number to my iPad 2 so that I can use iMessage?
I have an iPad 2 and I want to receive my iPhone messages on it like I do on my computer. Is there somewhere that I can add my number so that I can receive them? It is running on iOS 5.1.1 and I've tried updating it but it says that there are no ne
-
Home sharing crash itunes 10.5.0.142 on win7 pro service pack 1 64-bit
8 GByte RAM, Intel i7 CPU, flash hard drive (256 GB) with files stored on Ethernet shared file server (2 TB) per bottom of iTunes window: 16-17k podcasts, 354 GB 9800 songs, 80 GB 34 movies, 110 GB 17 tv shows, 114 GB 5 iTunes U, 0.9 GB 26 books, 5.2
-
F.05 - Foreign currency valuation of customers and vendors
Hello all, My client wants to post the valuation differences realized gain/loss from exchange rates for customer and vendor open items to the customer/vendor account itself. Meaning, at the moment the F.05 creates the accounting documents for revalua
-
I recently purchased what looked like the same TDK DVD-RW disks I had been using, but my Mac was unable to write to them. I then noticed that the only distinction between the old and new ones is this "RW2" mark. TDK's website does not say anything ab
-
hi friends i am facing problem in creating transaction code for a program. its asking screen number. which number i have to give and from where i can and how i can find that screen number. kumar.