Problem with populating internal with field-symbol
hi all,
I have following structure of internal table .
internal Table 1(int1) : source,source_field, and other fields.
internal Table 2 (int2): x1,x2,x3,x4,x5,x6 .
Read table 1 assigning <gs_t1> with....
assign ( <gs_t1>-source_field ) to <ld_char> .
case <gs_t1>-source.
when 'int1'.
Read int1 assgining <gs_int1> .
ASSIGN COMPONENT <ld_char> OF STRUCTURE <gs_int1>
TO <fs_char>.
wa_output-x1 = <fs_char>.
simillarly,
ASSIGN COMPONENT <ld_char> OF STRUCTURE <gs_int1>
TO <fs_char>.
wa_output-x2 = <fs_char>.
The source_field of int1 contains any value either it can be x2,x3,x4 .
Now the problem is how my work wa_output should know that <fs_char> contains value of field x1 .
I mean to say how we willl determine that value to be passed is to wa_output-x1 or wa_output-x2 as <ld_char> is just a pointer we cannot determine anything .
so how should i make my workarea . It can be made as a fields-symbol but how to that .
As it is having a strucutre of like :
componenet component_type
CONTROLLER PRXCTRLTAB<-this is also a line type having value two fields
x1 char5
x2 char5
Plz help...
Hi all,
i have to pass all field values after obtaining them to a workarea wa_output .
data : wa_output type xyz.
READ TABLE ist_smp_tst ASSIGNING <gs_smp_tst>
WITH KEY iden_no =
<gs_smp_tst_dtl>-iden_no
BINARY SEARCH.
ASSIGN COMPONENT <ld_char_val> OF STRUCTURE
<gs_smp_tst_lab> TO <fs_char>.
CONCATENATE 'WA_OUTPUT-' <fs_char> INTO l_field.
ASSIGN (l_field) TO <wa_field>.
<wa_field> = <fs_char>.
read table ist_temp .........
<wa_field> = <fs_char>.
I have done this but <wa_field> actually holds the current data of <fs_char>
it should be like
wa_ouput-f1 = <fs_char>..
wa_output-f2 = <fs_char>.
and the appending it to wa_output to i_output .
How we can do this using field-symbol.
Plz required help.
Regards.
Similar Messages
-
Re: Problem in ALV reports using Field symbols
Hi Friends,
Can you tell me how to convert a normal report using field symbols into ALV report
can ypu please suggest me any solutions.I am sending the code along with this mail.
Regards,
Dinesh
<b>Coding:</b>
*& Report YSDBTEMP *
REPORT YSDBTEMP .
tables: ekko , ekpo .
TYPE-POOLS: SLIS.
*Internal Table Declaration
data: begin of line ,
ebeln like ekko-ebeln , "Purchasing Document No.
bedat like ekko-bedat , "Purchasing Document Date
matnr like ekpo-matnr , "Material No.
netwr like ekpo-netwr , "Net Order Value in PO Currancy
meins like ekpo-meins , "UOM
change like ekpo-menge ,
end of line .
*Internal table Declaration
DATA: IT_final like table of line with header line.
DATA : FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV with header line.
DATA : V_REPID TYPE SYREPID.
DATA : IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
data : i_layout type slis_layout_alv .
Header for Main Grid Display
data:i_header1 type slis_t_listheader with header line.
Header for Interactive Report Display
data:i_header2 type slis_t_listheader with header line.
*Field Symbol declaration.
FIELD-SYMBOLS: <FS> type any table.
**select option Declaration
selection-screen begin of block block.
select-options: s_ebeln for ekko-ebeln .
selection-screen end of block block .
start-of-selection.
perform get_data.
perform field_cat.
perform layout using i_layout .
perform grid_display .
*& Form get_data
text
--> p1 text
<-- p2 text
FORM get_data .
SELECT EKKO~EBELN
EKKO~BEDAT
EKPO~EBELP
EKPO~MATNR
EKPO~NETWR
EKPO~MEINS
EKPO~MENGE
EKPO~BPRME
INTO CORRESPONDING FIELDS OF table IT_FINAL
FROM EKKO INNER JOIN EKPO ON EKKOEBELN = EKPOEBELN
WHERE EKKO~EBELN IN S_EBELN.
ENDFORM. " get_data
*& Form field_cat
text
--> p1 text
<-- p2 text
FORM field_cat .
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order No'.
fieldcatalog-col_pos = 1.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'BEDAT'.
fieldcatalog-seltext_m = 'Purchasing Document Date'.
fieldcatalog-col_pos = 2.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material No'.
fieldcatalog-col_pos = 3.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Net order'.
fieldcatalog-col_pos = 4.
append fieldcatalog .
clear fieldcatalog.
ENDFORM. " field_cat
*& Form layout
text
-->P_I_LAYOUT text
FORM layout USING P_I_LAYOUT.
i_layout-lights_tabname = 'IT_FINAL'.
i_layout-box_tabname = 'IT_FINAL'.
ENDFORM. " layout
*& Form grid_display
text
--> p1 text
<-- p2 text
FORM grid_display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'SET_PO_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = FIELDCATALOG[]
*IT_EVENTS = I_EVENT[]
TABLES
t_outtab = <fs>.
endform.Hi,
This is one sample program,
Check this.
I hope it is helpful to you.
TABLES : zeastable_02,zeastable_04.
TYPE-POOLS : slis.
TYPES : BEGIN OF fieldst,
name LIKE zeastable_02-name,
znum LIKE zeastable_02-znum,
empno LIKE zeastable_04-empno,
zempsalary LIKE zeastable_04-zempsalary,
END OF fieldst.
DATA itab TYPE TABLE OF fieldst WITH HEADER LINE.
DATA: w_report_id LIKE sy-repid. "Program name
DATA: w_title TYPE lvc_title VALUE 'Assignment 1 in ALV'.
DATA: w_layout TYPE slis_layout_alv. "Layout setup
DATA: w_fieldcat TYPE slis_t_fieldcat_alv. "Field Catlog
START-OF-SELECTION.
SELECT-OPTIONS employee FOR zeastable_04-empno.
SELECT zeastable_02name zeastable_02znum
zeastable_04empno zeastable_04zempsalary
INTO CORRESPONDING FIELDS OF TABLE itab FROM
zeastable_02 INNER JOIN zeastable_04 ON
zeastable_02name = zeastable_04name
WHERE zeastable_04~empno IN employee.
w_report_id = sy-repid.
PERFORM i_layout CHANGING w_layout.
PERFORM i_fieldcat CHANGING w_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZEASALV_04'
i_grid_title = w_title
is_layout = w_layout
it_fieldcat = w_fieldcat
i_save = 'A'
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
PERFORM i_layout CHANGING w_layout.
PERFORM i_fieldcat CHANGING w_fieldcat.
*& Form i_layout
text
<--P_W_LAYOUT text
form i_layout changing p_w_layout.
clear w_layout.
w_layout-colwidth_optimize = 'X'.
w_layout-edit = ' '.
endform. " i_layout
*& Form i_fieldcat
text
<--P_W_FEILDCAT text
form i_fieldcat changing p_w_feildcat.
data: l_line_fieldcat type slis_fieldcat_alv.
clear l_line_fieldcat.
l_line_fieldcat-fieldname = 'NAME'.
l_line_fieldcat-ref_tabname = 'itab'.
l_line_fieldcat-seltext_m = 'NAME'.
l_line_fieldcat-key = 'X'.
append l_line_fieldcat to w_fieldcat.
clear l_line_fieldcat.
l_line_fieldcat-fieldname = 'ZNUM'.
l_line_fieldcat-ref_tabname = 'itab'.
l_line_fieldcat-seltext_m = 'NUMBER'.
l_line_fieldcat-key = 'X'.
append l_line_fieldcat to w_fieldcat.
clear l_line_fieldcat.
l_line_fieldcat-fieldname = 'EMPNO'.
l_line_fieldcat-ref_tabname = 'itab'.
l_line_fieldcat-seltext_m = 'EMPLNUM'.
*l_line_fieldcat-key = 'X'.
append l_line_fieldcat to w_fieldcat.
clear l_line_fieldcat.
l_line_fieldcat-fieldname = 'ZEMPSALARY'.
l_line_fieldcat-ref_tabname = 'itab'.
l_line_fieldcat-seltext_m = 'SALARY'.
*l_line_fieldcat-key = 'X'.
append l_line_fieldcat to w_fieldcat.
endform. " i_fieldcat
Reward for useful answers. -
Facing problem in populating a output field only
Hi,
I have created two fields on the screen with names code and description. My requirement is to get F4 help on code field and on selecting value from the popup, the description field as well should filled. I am using FM 'MD_POPUP_SHOW_INTERNAL_TABLE' to get a popup. The popup I am getting is alright as it is showing values for both columns i.e. code and its description. But anyhow when I select a value from the popup list, code field gets filled but the other field remains empty.
I even debugged the program, and there I found that control is assinging values to both fields, but its not showing on screen for description field.
Need help.
Thanks,
RamHi,
Check this function module MD_SHOW_PLANNING_REQUESTS.It is using that function module.
Check this code.May be it can help you.
Tables Declaration
tables : vbap. " Sales Document: Item Data
Constant Declaration *
CONSTANTS:
C_X TYPE C VALUE 'X'. " Translate to Uppercase
Variable Declaration *
Variable for Table index
data v_sytabix like sy-tabix.
Variable for Program name
data L_NAME LIKE SYST-REPID.
Ranges Declaration *
Range for getting values form selection screen
DATA: BEGIN OF range1 OCCURS 0,
SIGN(1),
OPTION(2),
LOW LIKE vbap-vbeln,
high like vbap-vbeln,
END OF range1.
Structure Declaration *
Internal table Declaration *
Internal table for Report output
data: begin of i_vbap occurs 0,
vbeln like vbap-vbeln, " Sales Document
posnr like vbap-posnr, " Sales Document item
end of i_vbap.
Internal table for output to the F4 help
data: begin of I_DISPLAY occurs 0,
vbeln like vbap-vbeln, " Sales Document
posnr like vbap-posnr, " Sales Document item
end of I_DISPLAY.
Internal table for return value form function module
DATA: BEGIN OF I_RETURNVAL OCCURS 0.
INCLUDE STRUCTURE DDSHRETVAL. " Interface Structure Search
DATA: END OF I_RETURNVAL.
Internal table for F4 help field heading
DATA: I_FIELDTAB LIKE DFIES OCCURS 0 WITH HEADER LINE.
Internal table for getting screen values from selection screen
data L_SCR_FIELDS LIKE DYNPREAD OCCURS 1 WITH HEADER LINE.
Field-Symbols *
Selection-screen *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME title text-001.
select-options:
S_VBELN for vbap-vbeln no intervals,
S_POSNR for vbap-posnr no intervals.
SELECTION-SCREEN end OF BLOCK B1.
AT SELECTION-SCREEN ON VALUE-REQUEST *
at selection-screen on value-request for s_posnr-low.
clear: L_SCR_FIELDS, I_FIELDTAB, i_display, I_RETURNVAL.
refresh: L_SCR_FIELDS, I_FIELDTAB, i_display, I_RETURNVAL.
L_NAME = SYST-REPID.
MOVE 'S_VBELN-LOW' TO L_SCR_FIELDS-FIELDNAME.
APPEND L_SCR_FIELDS.
Call the Function module DYNP_VALUES_READ to get the values form
selection screen
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = L_NAME
DYNUMB = SYST-DYNNR
TRANSLATE_TO_UPPER = C_X " X
TABLES
DYNPFIELDS = L_SCR_FIELDS
EXCEPTIONS
INVALID_ABAPWORKAREA = 1
INVALID_DYNPROFIELD = 2
INVALID_DYNPRONAME = 3
INVALID_DYNPRONUMMER = 4
INVALID_REQUEST = 5
NO_FIELDDESCRIPTION = 6
INVALID_PARAMETER = 7
UNDEFIND_ERROR = 8
DOUBLE_CONVERSION = 9
STEPL_NOT_FOUND = 10
OTHERS = 11
IF SY-SUBRC eq 0.
LOOP AT L_SCR_FIELDS.
range1-sign = 'I'.
range1-option = 'EQ'.
range1-low = L_SCR_FIELDS-FIELDVALUE.
range1-high = space.
append range1.
ENDLOOP.
ENDIF.
F4 help Field headings
I_FIELDTAB-TABNAME = 'I_DISPLAY'.
I_FIELDTAB-FIELDNAME = 'VBELN'.
I_FIELDTAB-POSITION = '1'.
I_FIELDTAB-OUTPUTLEN = '10'.
I_FIELDTAB-INTTYPE = 'C'.
I_FIELDTAB-INTLEN = '10'.
APPEND I_FIELDTAB.
I_FIELDTAB-FIELDNAME = 'POSNR'.
I_FIELDTAB-POSITION = '2'.
I_FIELDTAB-OFFSET = '10'.
I_FIELDTAB-OUTPUTLEN = '6'.
I_FIELDTAB-INTTYPE = 'N'.
I_FIELDTAB-INTLEN = '6'.
APPEND I_FIELDTAB.
Retrieve sales document, Sales document item from table Sales
Document: Item Data(VBAP).
Primary keys used for selection: VBELN
select vbeln posnr from vbap
into table i_display
where vbeln in range1.
Call the function module F4IF_INT_TABLE_VALUE_REQUEST for F4 values
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'POSNR'
WINDOW_TITLE = 'Line Item'
VALUE_ORG = 'S'
MULTIPLE_CHOICE = C_X " (for muliple selection)
TABLES
VALUE_TAB = I_DISPLAY
FIELD_TAB = I_FIELDTAB
RETURN_TAB = I_RETURNVAL
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 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.
ELSE.
Star for For single values
READ TABLE I_RETURNVAL INDEX 1.
S_POSNR-LOW = I_RETURNVAL-FIELDVAL.
End for the single values
Start For multiple selection
loop at i_returnval.
s_posnr-sign = 'I'.
s_posnr-option = 'EQ'.
s_posnr-low = I_RETURNVAL-FIELDVAL.
append s_posnr.
endloop.
sort s_posnr.
read table s_posnr index 1.
End for multiple selection
ENDIF.
Start-of-selection *
start-of-selection.
Retrieve sales document, Sales document item from table Sales
Document: Item Data(VBAP).
Primary keys used for selection: VBELN
select vbeln posnr from vbap
into table i_vbap
where vbeln in s_vbeln
and posnr in s_posnr.
if the above selection is successful continue the process else exit *
form the report
if sy-subrc ne 0.
message e002 with 'No data to display'.
endif.
End-of-selection *
end-of-selection.
if not i_vbap[] is initial.
loop at i_vbap.
write:/ i_vbap-vbeln, i_vbap-posnr.
endloop.
endif. -
Coloring of Particular Cells in a dynamic internal table(field symbols)
Hi,
I have a requirement to introduce color into some particular cells in a dynamic internal table(Field symbol) based on some conditions.I know that color can be introduced at cell level in the case of static internal table.But, can anybody tell me whether it is possible to introduce color to particular cells in the dynamic internal table(Field Symbol) .Please suggest me on this issue.
Thanks in advance,
RajeshHi,
This is the sample coding for the colour cell report.
Kindly go through it. It will helps u.
REPORT YMS_COLOURTEST .
DATA: BEGIN OF TP OCCURS 10, ID, NR(8), TEXT(255), END OF TP.
DATA: LENGTH TYPE I VALUE 8, " Length of list
TESTSTRING(15) TYPE C VALUE '012345678901234',
WIDTH TYPE I. " Width of list
DATA: TXT_REPORT LIKE DOKHL-OBJECT.
START-OF-SELECTION.
PERFORM HEADING.
PERFORM OUTPUT_BODY.
FORM HEADING.
FORMAT INTENSIFIED OFF. " Remove any INTENSIFIED
ULINE AT (WIDTH). " Upper frame border
FORMAT COLOR COL_HEADING INTENSIFIED." Title color
WRITE: / SY-VLINE. " Left border
WRITE: 'No |Colour |intensified |intensified off|',
'inverse' NO-GAP.
WRITE: AT WIDTH SY-VLINE. " Right border
ULINE AT (WIDTH). " Line below titles
FORMAT COLOR OFF.
ENDFORM.
FORM OUTPUT_BODY.
DO LENGTH TIMES.
PERFORM WRITE_LINE USING SY-INDEX.
ENDDO.
ENDFORM.
FORM WRITE_LINE USING COUNT TYPE I.
DATA: HELP(14) TYPE C,
COUNT1 TYPE I.
COUNT1 = SY-INDEX - 1.
WRITE: / SY-VLINE NO-GAP.
WRITE: (4) COUNT1 COLOR COL_KEY INTENSIFIED NO-GAP.
WRITE: SY-VLINE NO-GAP.
CASE COUNT1.
WHEN '0'.
HELP = 'COL_BACKGROUND'.
WHEN '1'.
HELP = 'COL_HEADING'.
WHEN '2'.
HELP = 'COL_NORMAL'.
WHEN '3'.
HELP = 'COL_TOTAL'.
WHEN '4'.
HELP = 'COL_KEY'.
WHEN '5'.
HELP = 'COL_POSITIVE'.
WHEN '6'.
HELP = 'COL_NEGATIVE'.
WHEN '7'.
HELP = 'COL_GROUP'.
ENDCASE.
WRITE: HELP COLOR COL_KEY INTENSIFIED NO-GAP.
WRITE: SY-VLINE NO-GAP.
WRITE: TESTSTRING COLOR = COUNT1 INTENSIFIED NO-GAP.
WRITE: SY-VLINE NO-GAP.
WRITE: TESTSTRING COLOR = COUNT1 INTENSIFIED OFF NO-GAP.
WRITE: SY-VLINE NO-GAP.
WRITE: TESTSTRING COLOR = COUNT1 INVERSE NO-GAP.
WRITE AT WIDTH SY-VLINE NO-GAP.
ENDFORM.
Thanks,
Shankar -
ALV report with internal in field symbol
Hi Shifu ABAP,
I have ALV report.
My problem is when I tried to do sum using the sum icon. I got a message 'desired operation cannot be performed for column 'Dignostic delay'. Is it because I used field symbol, then when I clicked on the column it didn't recorgnise the field.
FYI.
1)The internal table for my ALV report is stored in field symbol.
2)I dont have a problem to display the report.
3)I had to set 'do_sum' at ALV field category, still doesn't work
My source code to define ALV category.
loop at i_qpcd into wa_qpcd.
CLEAR ls_fieldcat2.
ls_fieldcat2-col_pos = pos2.
ls_fieldcat2-fieldname = wa_qpcd-code.
ls_fieldcat2-reptext_ddic = wa_qpcd-desc.
ls_fieldcat2-just = 'C'.
ls_fieldcat2-do_sum = 'X'.
APPEND ls_fieldcat2 TO gt_fieldcat2.
endloop.
My source code call the ALV FM
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZMPMR001_Q1OOT'
i_callback_pf_status_set = 'PF_STATUS_SET'
is_layout = ls_layout
it_fieldcat = gt_fieldcat2[]
is_print = ls_print
TABLES
t_outtab = <l_table>
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Thanks a lot in advance for your attention.my situation is like this, declare the internal tble
1) data : begin of itab occurs 0,
code like qpcd-code,
desc like QPCT-KURZTEXT,
end of itab.
2) populate the itab like this
code desc
01 desc 1
02 desc 2
03 desc 3
3) take the selected record converted it into new dynamic internal table using field symbol declare as table, now the component of this new table are 01, 02 and 03.
4) populate the new table with some data, so technically my new table structure will be like this
01 02 03
1 0 1
0 0 3
2 2 2
5) display the new table in ALV report, in ALV I tried to sum-up each of column.
6) Question : HOW can I convert the componet 01, 02 and 03 as an integer/numeric field.
Regards
Nislina -
Problem With Insert statement using field symbols with unicode enabled
I was writng a function module for dyanamic operations on the table. We are using the field symbols, function module is unicode enabled.
Assign statements are working fine, with which we created work are <fs_wa_header> and internal table <fs_tb_item> dynamically based on the table name (IM_TB_HENAME) which we get as import parameter.
we have query which is giving us dump.
INSERT (IM_TB_HENAME) FROM <FS_WA_HEADER>.Hi
INSERT (IM_TB_HENAME) FROM <FS_WA_HEADER> is good for inserting a line in the database, so IM_TB_HENAME has to have the name of dictionary table.
U should write:
INSERT <FS_WA_HEADER> INTO (IM_TB_HENAME).
But I believe you can't use the variable IM_TB_HENAME, you should use another field-symbols:
ASSIGN (IM_TB_HNAME) TO <FS_TB_ITEM>.
INSERT <FS_WA_HEADER> INTO <FS_TB_ITEM>.
Max -
Populating internal table field with same value
Is there syntax that will fill a field value in every record in an internal table without looping?
Hi Rob,
I didn't know this, after studying online help on MODIFY itab, ABAP Statement
MODIFY itab - itab_lines
Syntax
... itab FROM wa TRANSPORTING comp1 comp2 ... WHERE log_exp.
I tried
DATA:
ls_t100 TYPE t100,
lt_t100 TYPE TABLE OF t100.
SELECT * INTO TABLE lt_t100 FROM t100 UP TO 20 ROWS.
MODIFY lt_t100 FROM ls_t100 TRANSPORTING text where text <> ls_t100-text .
clears field text in all rows of lt_t100.
after many years of field-symbols finally a reason to use MODIFY again
Regards,
Clemens -
Problem to call international with Siri
Dear,
I tried to call a friend with Siri and Siri says that it cannot call the number.The number starts with "+ country code and phone number". When I do that normally (with the phone keyboard) it works. Do you have the solution?
Thank youI have the exact same problem with some international calls, but only in one country...
-
Internal - dynamic - field-symbols
All,
This is my requirement
data in itab is
NAME , COUNT , STRTDATE, ENDDATE, durinmin.
a 123 10/1/08 10/1/08 12
a 123 10/2/08 10/5/08 30
a 123 10/3/08 10/8/08 15
b 123 10/1/08 10/1/08 12
b 123 10/2/08 10/5/08 30
b 123 10/3/08 10/8/08 15
to be displayed like
name count 10/1/08 10/2/08 10/3/08
a 123 12 30 15
b 123 12 30 15
This is how I am coding...
DATA:
r_dyn_table TYPE REF TO data,
r_wa_dyn_table TYPE REF TO data,
r_dock_ctnr TYPE REF TO cl_gui_docking_container,
r_alv_grid TYPE REF TO cl_gui_alv_grid,
t_fieldcat1 TYPE lvc_t_fcat, "with cell color
t_fieldcat2 TYPE lvc_t_fcat, "without cell color
wa_fieldcat LIKE LINE OF t_fieldcat1,
wa_cellcolors TYPE LINE OF lvc_t_scol,
wa_is_layout TYPE lvc_s_layo.
FIELD-SYMBOLS:
<t_dyn_table> TYPE STANDARD TABLE,
<wa_dyn_table> TYPE ANY,
<t_cellcolors> TYPE lvc_t_scol,
<w_field> TYPE ANY.
data begin of itab
NAME ,
COUNT ,
STRTDATE,
ENDDATE,
durinmin(6),
end of itab.
build catalog
form build_cat_for_table.
data : fname(6) value 'Day'.
data : cntr(3) type n, ctext(10).
wa_fieldcat-fieldname = 'NAME'.
wa_fieldcat-inttype = 'C'.
wa_fieldcat-outputlen = '32'.
wa_fieldcat-coltext = 'Name'.
wa_fieldcat-seltext = wa_fieldcat-coltext.
APPEND wa_fieldcat TO t_fieldcat1.
wa_fieldcat-fieldname = 'Wtavgtime'.
wa_fieldcat-inttype = 'C'.
wa_fieldcat-outputlen = '6'.
wa_fieldcat-coltext = 'Wt Avg Time'.
wa_fieldcat-seltext = wa_fieldcat-coltext.
APPEND wa_fieldcat TO t_fieldcat1.
*now add all the dates.
loop at dtrange.
cntr = 1.
concatenate fname cntr into fname.
ctext = dtrange-ddate.
wa_fieldcat-fieldname = fname.
wa_fieldcat-inttype = 'C'.
wa_fieldcat-outputlen = '6'.
wa_fieldcat-coltext = ctext.
wa_fieldcat-seltext = wa_fieldcat-coltext.
cntr = cntr + 1.
clear fname.
APPEND wa_fieldcat TO t_fieldcat1.
endloop.
endform.
form fill_data.
data : fname(6) value 'Day'.
data : cntr(3) type n, ctext(10).
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fieldcat1
IMPORTING
ep_table = r_dyn_table
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
IF sy-subrc ne 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ASSIGN r_dyn_table->* TO <t_dyn_table>.
CREATE DATA r_wa_dyn_table LIKE LINE OF <t_dyn_table>.
ASSIGN r_wa_dyn_table->* TO <wa_dyn_table>.
loop at itab.
ASSIGN COMPONENT 'NAME' OF STRUCTURE <wa_dyn_table> TO <w_field>.
<w_field> = itab-name.
ASSIGN COMPONENT 'Wtavgtime' oF STRUCTURE <wa_dyn_table> TO <w_field>.
<w_field> = itab-wtavgtime.
cntr = 0.
do.
cntr = 1.
concatenate fname cntr into fname.
assign component fname of structure <wa_dyn_table> to <w_field>.
<w_field> = itab-
enddo.
endform.
This is where I am stucked how to put the dates as the columns while displaying and then put the duration in the rows corresponding to the columns.
Any help is appriciated.
THERE ARE LOT OF EXAMPLES on forum but some how I am not able to grasp it in my code, may be my knowledge of field symbols falling short. I guess I need to use Header / field groups but not clicking me .
Thanks in advance.Hi,
I changed ur code a little.... i dont know whether it will work or not...
But it will give u some idea...
1. when preparing the Fieldcatalog.
*now add all the dates.
LOOP AT dtrange.
* cntr = 1.
* CONCATENATE fname cntr INTO fname.
fname = dtrange-ddate. "---u may need to change this (but give a date here)
ctext = dtrange-ddate.
wa_fieldcat-fieldname = fname.
wa_fieldcat-inttype = 'C'.
wa_fieldcat-outputlen = '6'.
wa_fieldcat-coltext = ctext.
wa_fieldcat-seltext = wa_fieldcat-coltext.
cntr = cntr + 1.
CLEAR fname.
APPEND wa_fieldcat TO t_fieldcat1.
ENDLOOP.
2. When adding values...
SORT itab BY name.
LOOP AT itab.
ASSIGN COMPONENT 'NAME' OF STRUCTURE <wa_dyn_table> TO <w_field>.
<w_field> = itab-name.
ASSIGN COMPONENT 'Wtavgtime' OF STRUCTURE <wa_dyn_table> TO <w_field>.
<w_field> = itab-wtavgtime.
cntr = 0.
* DO.
* cntr = 1.
* CONCATENATE fname cntr INTO fname.
* ASSIGN COMPONENT fname OF STRUCTURE <wa_dyn_table> TO <w_field>.
fname = itab-strtdate. "---same thing here
ASSIGN COMPONENT fname OF STRUCTURE <wa_dyn_table> TO <w_field>.
IF <w_field> IS ASSIGND.
<w_field> = itab-durinmin.
ENDIF.
AT END OF name.
MODIFY <t_dyn_table> FROM <wa_dyn_table>.
ENDAT.
* ENDDO.
ENDLOOP. -
Having issues with populating a Text Field with data from 2 other fields
I have 3 fields Tools_1a_pri, Tools_1a_pri_other, Tools_1a_pri_txt.
Tools_1a_pri is a drop down combo with a predefined list. One of the options is "Other". When "Other" is selected, the text field Tools_1a_pri_other becomes visible for users to enter the name of the other tool.
The Tools_1a_pri_txt is a text field with a calculation that shows either text stating that no tool has been selected or the Tools_1a_pri & or Tools_1a_pri_other.
When I select one of the predefined tools, everything works. When I select other, it appears that nothing has changed. It requires that I click on another field before it populates. This is confusing to the user.
Tools_1a_pri Validate code
this.getField("Tools_1a_pri_Other").display = event.value=="Other" ? display.visible : display.hidden;
Tools_1a_pri_txt Calculation code
//if nothing is selected, do the following
if (getField("Tools_1a_pri").value.length < 2) {
event.target.textColor = color.red
event.value = "No primary tool identified";
}else if (getField("Tools_1a_pri").value != "Other") {
//otherwise do this if other is selected
event.target.textColor = color.black
event.value = getField("Tools_1a_pri").value;
}else if (getField("Tools_1a_pri").value = "Other") {
//otherwise do this if other is not selected
event.target.textColor = color.black
event.value = getField("Tools_1a_pri").value + " - " + getField("Tools_1a_pri_Other").value;You made the classic mistake of using the assignment operator in an if-statement instead of the comparison operator. Change this line:
} else if (getField("Tools_1a_pri").value = "Other") {
To this:
} else if (getField("Tools_1a_pri").value == "Other") { -
Problem in populating the new field from the extract structure. Kindly help
my requirement a new text field is added on R/3 side and I have to populate
the same field into BW.
In the R/3 a new customization table 'AAA' is created which will have
code - char 3 and
text - char 30.
The code field is added to a table BBB.
The SAP standard generic data source exracts data from the table BBB where in the new code field have been added.
Now I can the see the code field in the extract structure and not in the data source as the filed has selection value 'A' when checked in the ROOSFIELD table.
To populate the value in BW, I will be creating a Generic Master Data text wherein I fetch the values from the table 'AAA' which the fields code and text and replicate the same in BW.
In the reporting level, the code InfoObject will be selected as display both KEY and TeXT, by doing I can populate the values of TEXT in the reporting.
But to achieve the same I need to add the field code in the ODS but cannot do the same because I am not able to see the field code in the data source.
Kindly let me know how to achieve the same.
Also let me know if there is any alternate solution to populate the text field in BW.
Any Inputs will be appreciated.
Thanks> You should get the userdatasources bound to the
> columns and assign the values of the recordset to
> each one and after that use "setLineData" to write in
> the matrix.
>
> hope it helps
Hi all,
i have created tables (non BO Tables) directly on the SQL-server and want to use recordset to populate a user form matrix.
Is there any workaround to achieve this using non BO tables?
Please provide some sample code since it is a very urgent matter.
regards
Daniel -
Issue with populating documents with data connections
Hi Guys
I have two issues one we have set up an infopath document for browser enabled. But when I upload it, it doesnt work in IE.
Also how do you get the data connections working to the form?
ThanksHell,
Refer this thread to open form in browser by force: (just add "?OpenIn=Browser" in form URL at the end)
http://stackoverflow.com/questions/7361858/infopath-2010-forms-do-not-open-in-the-browser-using-ie8
>Also how do you get the data connections working to the form?
If you are using same site collection data connection then it should work without UDCX file but if there is cross site collection data connection then create UDCX for your data connection.
http://msdn.microsoft.com/en-us/library/office/ms772101%28v=office.14%29.aspx
If it does not resolve you problem then provide the error detail
Hemendra:Yesterday is just a memory,Tomorrow we may never see
Please remember to mark the replies as answers if they help and unmark them if they provide no help -
Problem with dynamic internal table updation
Hello Folks,
I created a dynamic internal table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = i_fieldcat
IMPORTING
ep_table = i_dyntab
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
ASSIGN i_dyntab->* TO <f_dyntable>.
and created a work area
CREATE DATA wg_f_split LIKE LINE OF <f_dyntable>.
ASSIGN wg_f_split->* TO <f_wg_dyntable>.
My requirement is that , i have to loop a normal internal table and append those records to the filed symbol internal table.
READ TABLE i_normal_itab INTO wg_split INDEX wl_rows-index.
IF sy-subrc EQ 0.
ASSIGN wg_split to <f_wg_dyntable>.
APPEND <f_wg_dyntable> to <f_dyntable>.
endif.
here i am geeting dump as "MOVE src TO dst" ... i can get the data in the work area FSymbol but cannot append it in Internal table Field Symbol.. Please help..
<Added code tags>
Edited by: Suhas Saha on Aug 3, 2011 10:52 AMHello Sandra,
Thanks for the reply..
First i tried appending the normal work area to the fieldsymbol internal table.
append wg_split to <f_dyntable>
This is hiting dump the same dump and so i created a fieldsymbol work area. ( <f_wg_dyntable>.)and tried to append the field symbol internal table with this work area. which is again giving the dump
APPEND <f_wg_dyntable> to <f_dyntable>. ( Again a Dump)
Edited by: Charan-SAP on Aug 2, 2011 9:40 PM
Edited by: Charan-SAP on Aug 2, 2011 9:42 PM -
Delete row from internal table using field symbol.
Hi friends,
I created dynamic internal table using field symbol. I want to delete some data using where clause.
for example. i want to use like,
DELETE <FS> WHERE KUNNR = WA_KNA1-KUNNR.
Like the above statment it won't work. How i can use delete with where clause in field symbols.
Hope any one can help me.
Thanks and regards
Srikanth. Shi Srikanth,
I think you have to LOOP through the whole internal table and check each line and decide to delete or not:
LOOP at <itab> INTO <wa>.
ASSIGN COMPONENT 'KUNNR' OF STRUCTURE <wa> TO <field>.
CHECK <field> IS ASSIGNED.
IF <field> EQ WA_KNA1-KUNNR.
DELETE ...
ENDIF.
UNASSIGN <field>.
ENDLOOP.
hope this helps
ec -
Loop at field-symbol (any table) into string ?
Hi Everyone,
I need little help, I have a requirement to extract table content with columns names as the header.
After doing some search I figured out the best way to this since table name will be only avaialbe at runtime through
a selection field . my problem is to loop through field-symbol and convert a structure to string value so that I can
write to the file.
REPORT zlab_tbl_export.
DATA table_name(30) VALUE 'ZSMARTTS_HTML'.
DATA v_file(100) VALUE 'c:\sap_export.txt'.
DATA line(1000).
DATA: o_data TYPE REF TO data.
CREATE DATA o_data TYPE TABLE OF (table_name).
FIELD-SYMBOLS: <table> TYPE ANY TABLE.
ASSIGN o_data->* TO <table>.
SELECT * UP TO 100 ROWS FROM (table_name) INTO TABLE <table>.
OPEN DATASET v_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
>>>>>>> LOOP at <table> into line. >>>>>>>>>>>> " Here the code breaks and fail
TRANSFER line to v_file.
WRITE :/ line.
ENDLOOP.
CLOSE DATASET v_file.
Exception Message
|Error analysis |
| You attempted to move one data object to another. |
| This is not possible here because the conversion of a data object |
| of type "v" to type "C" is not supported. |
| |
| List of internal ABAP types: |
| |
| C Text (Character) |
| N Numerical text |
| D Date (YYYYMMDD) |
| T Time (HHMMSS) |
| X Hexadecimal |
| I Integer |
| P Packed number |
| F Floating point number |
| |
| h Internal table |
| r Object reference |
| l Data reference |
| g String of type C |
| y String of type X |
| s 2-byte integer with plus/minus sign |
| b 1-byte integer without plus/minus sign |
| u Structure (flat structure) |
| v Structure (deep structure) |Hi Everyone, I need little help, I have a requirement to extract table content with columns names as the header. After doing some search I figured out the best way to this since table name will be only avaialbe at runtime through a selection field . my problem is to loop through field-symbol and convert a structure to string value so that I can write to the file.
thie is the code
REPORT zlab_tbl_export.
DATA table_name(30) VALUE 'ZSMARTTS_HTML'.
DATA v_file(100) VALUE 'c:\sap_export.txt'.
DATA line(1000).
DATA: o_data TYPE REF TO data.
CREATE DATA o_data TYPE TABLE OF (table_name).
FIELD-SYMBOLS: <table> TYPE ANY TABLE.
ASSIGN o_data->* TO <table>.
SELECT * UP TO 100 ROWS FROM (table_name) INTO TABLE <table>.
OPEN DATASET v_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP at <table> into line. " Fail here
TRANSFER line to v_file.
WRITE :/ line.
ENDLOOP.
CLOSE DATASET v_file.
and this is the exception:
Error analysis
You attempted to move one data object to another.
This is not possible here because the conversion of a data object
of type v to type C is not supported.
Edited by: Misbah on Jan 7, 2010 11:50 PM
Maybe you are looking for
-
Seems like Yahoo is the new Firefox default browser.
-
Classpath in LINUX????
Where and how to set classpath in linux??. Is it the same way as we do it for windows???. regards, koel
-
FRM-92101: Load Balancing Forms 10g with Web Cache
Hi, I´m having some problems with Oracle Forms and Webcache 10g and I was wondering if you could help. Machines: (Pentium IV 2.6 GHz; 2GB RAM; 80GB HD) A. Red Hat Linux AS 2.1 Oracle AS 10g - Infrastructure Installation B. Windows 2000 Server - Serv
-
Hi I have embedded a couple of video clips in my design document, it will be eventually exported out as a swf. Although my videos play nicely within the exported version, once they get to the end, i would like the video to return to the beginning pos
-
Connect Electronic Drumset to IMac / Garageband???
Is there any way I can connect my Yamaha DTXpress III Electronic Drumset to my IMac for use with Garageband? The "brain" for the drums has a MIDI port...NO USB port...but does have 1/4" out phono plugs....