Displaying internal table fields data based on user selection
Hi all,
I am having a checkbox for each field in the internal table.
and i only have to display the fields of the internal table which the user has selected based on the check boxes provided.
Could you plz help me out, how can i display the data of only those fields which the user has selected initially.....
Thanks,
anil.
Hi,
This is not the best solution but this can be one solution.
Check this code
REPORT z_sdn.
PARAMETERS:
p_kunnr AS CHECKBOX DEFAULT 'X',
p_land1 AS CHECKBOX,
p_name1 AS CHECKBOX.
DATA:
BEGIN OF fs_tab,
kunnr TYPE kunnr,
land(10) TYPE c,
name(10) TYPE c,
END OF fs_tab.
DATA:
t_tab LIKE
TABLE OF
fs_tab.
START-OF-SELECTION.
CLEAR fs_tab.
fs_tab-kunnr = '001'.
fs_tab-land = 'Land1'.
fs_tab-name = 'Name1'.
APPEND fs_tab TO t_tab.
CLEAR fs_tab.
fs_tab-kunnr = '002'.
fs_tab-land = 'Land2'.
fs_tab-name = 'Name2'.
APPEND fs_tab TO t_tab.
IF p_kunnr = 'X' AND p_land1 IS INITIAL AND p_name1 IS INITIAL.
WRITE: / 'KUNNR:'.
LOOP AT t_tab INTO fs_tab.
WRITE: / fs_tab-kunnr.
ENDLOOP.
ENDIF.
IF p_land1 = 'X' AND p_kunnr IS INITIAL AND p_name1 IS INITIAL.
WRITE: / 'LAND:'.
LOOP AT t_tab INTO fs_tab.
WRITE: / fs_tab-land.
ENDLOOP.
ENDIF.
IF p_name1 = 'X' AND p_kunnr IS INITIAL AND p_land1 IS INITIAL.
WRITE: / 'NAME:'.
LOOP AT t_tab INTO fs_tab.
WRITE: / fs_tab-name.
ENDLOOP.
ENDIF.
IF p_kunnr = 'X' AND p_land1 = 'X' AND p_name1 IS INITIAL.
WRITE: / 'KUNNR:',
'LAND'.
LOOP AT t_tab INTO fs_tab.
WRITE: / fs_tab-kunnr,
fs_tab-land.
ENDLOOP.
ENDIF.
IF p_kunnr = 'X' AND p_name1 = 'X' AND p_land1 IS INITIAL.
WRITE: / 'KUNNR:',
'NAME'.
LOOP AT t_tab INTO fs_tab.
WRITE: / fs_tab-kunnr,
fs_tab-name.
ENDLOOP.
ENDIF.
IF p_name1 = 'X' AND p_land1 = 'X' AND p_kunnr IS INITIAL.
WRITE: / 'LAND:',
'NAME:'.
LOOP AT t_tab INTO fs_tab.
WRITE: / fs_tab-land,
fs_tab-name.
ENDLOOP.
ENDIF.
IF p_name1 = 'X' AND p_land1 = 'X' AND p_kunnr = 'X'.
WRITE: / 'KUNNR',
'LAND:',
'NAME:'.
LOOP AT t_tab INTO fs_tab.
WRITE: / fs_tab-kunnr,
fs_tab-land,
fs_tab-name.
ENDLOOP.
ENDIF.
Regards
Abhijeet
Similar Messages
-
Display internal table as per value entered in selection screen
hi experts,
i need help on this issue. I have an internal table like this.
f1 f2 f3
a 2 5
b 3 4
c 4 3
d 5 2
e 2 6
totf2 =16 totf3= 20
i am getting this sum displayed using AT END OF.
Now there is a provision to enter a value for totf2, totf3 in selection screen. so based on this value entered for eg. if totf2 = 9 and totf3 = 13, is entered, then my internal table display shd b like:
f1 f2 f3
a 2 5
b 3 4
c 4 3
totf2 = 9, tot f3= 12.
someone plz help quick.
thanks.Hi,
Try this..
DATA: v_totf2 TYPE I.
DATA: v_totf3 TYPE I.
* Create a internal table similar to your internal table.
DATA: ITAB_FINAL LIKE TABLE OF itab.
LOOP AT itab INTO wa.
* Sum up the total for fields 2 and 3
v_totf2 = v_totf2 + wa-f2.
v_totf3 = v_totf3 + wa-f3.
* If total exceeds for the field 2 and 3 than given in the selection screen.Then exit.
IF v_totf2 >= p_totf2. " p_totf2 - selection screen value
OR
v_totf3 >= p_totf3. " p_totf3 - selection screen value
EXIT. " Exit out of the loop.
ENDIF.
* Move the values to the final internal table.
APPEND wa to ITAB_FINAL.
ENDLOOP.
* ITAB_FINAL will have the final values.
Thanks
Naren -
Output different data based on user select
Hi everyone,
Quick question, I would like to output different report columns based on user select, eg., users would be presented with two choices in a radiobutton list, eg., 1 and 2.
I have query results that contain columns A, B, C, D, E, F, G.
If user selects 1 then the output should be columns A, B, C, D, E.
If user selects 2 then the output should be columns A, B, C, F, G.
I am sure this is possible and easy? If so, what topic should I be reading/searching internet on?
Please advise.
Thanks!I would say that this is most often something that your user interface should be dealing with (i.e. which columns should be shown).
There is no way to do that in SQL.
In PL/SQL it is a simple situation of creating two cursors and simply deciding which one to open.
<pre>declare
l_cur sys_refcursor;
begin
if :user_selection = 1 then
open l_cur for select A, B, C, D, E from tbl;
else
open l_cur for select A, B, C, F, G from tbl;
end if;
-- use the cursor
close l_cur; -- or return to user interface
end;
/</pre>
Hope this helps. -
Importing Excel files and using a search function to use specific data based on user selection
Hi, I'm trying to create a search and solve function within Visual Basic.
I want to use the combustion equation C8H18 + 20(O2 + 3.76 N2) = 8 CO2 + 9H20 + 47 N2 to determine flame temperature using
9*Hf of C02 + 8 * Hf H20 + 47 Hf N2 = Hf C8H18
I have all of the values of Hf in an excel spreadsheet but I want to be able to search the spreadsheet as my application requires the user to change to fuel (the C8H18 bit) which changes the value of Hf.
Is there a way of searching that excel file each time I run my program?
Thanks
JackThanks for answering so quickly.
I've used that method before, and I'm sorry I didn't specify.
This will be used as a student learning aid and so the application itself and the tables will be downloaded as a zip file and so I don't believe the line below would work?
I've heard about including excel as a reference file in the application but I haven't been able to find any further information on that.
Thanks again
Dim oWBa As Excel.Workbook = oApp.Workbooks.Open("C:\Users\v-youtan\Desktop\colleagues.xlsx")" -
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 -
Need a POP-UP which can display internal table data in ALV format
HI All,
I need to display INTERNAL TABLE values through a POP-UP. Only condition is that the window with the internal table data should be in ALV format and not in TEXT only format.
To clarify, I used FM 'POPUP_WITH_TABLE_DISPLAY_OK' and 'POPUP_WITH_TABLE_DISPLAY', but both display the data in TEXT format and there is no provision to put the FIELD names there. Everthing needs to be put into internal table and it displays it in text format.
So I want a FM where I can display internal tabel data in ALV format( same format that would appear if you creata search help for a filed and output window would have all the ALV features like SORT buttons etc.
Hope there is some FM to achieve this ALV format data thing.
Thanks in advance for all your help.
Regards
FX3check this
REPORT y_demo_alv_3.
TYPE-POOLS: slis.
DATA: BEGIN OF i_outtab OCCURS 0.
INCLUDE STRUCTURE sflight.
DATA: w_chk TYPE c. "For multiple selection
DATA: END OF i_outtab.
* I_OUTTAB TYPE SFLIGHT OCCURS 0,
DATA: i_private TYPE slis_data_caller_exit,
i_selfield TYPE slis_selfield,
W_exit(1) TYPE c.
PARAMETERS: p_title TYPE sy-title.
START-OF-SELECTION.
SELECT * FROM sflight INTO TABLE i_outtab.
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
i_title = p_title
i_selection = 'X'
i_zebra = 'X'
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
i_checkbox_fieldname = 'W_CHK'
* I_LINEMARK_FIELDNAME =
* I_SCROLL_TO_SEL_LINE = 'X'
i_tabname = 'I_OUTTAB'
i_structure_name = 'SFLIGHT'
* IT_FIELDCAT =
* IT_EXCLUDING =
* I_CALLBACK_PROGRAM =
* I_CALLBACK_USER_COMMAND =
* IS_PRIVATE = I_PRIVATE
IMPORTING
es_selfield = i_selfield
e_exit = w_exit
TABLES
t_outtab = i_outtab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE i000(0k) WITH sy-subrc.
ENDIF.
*****the internal table is modified with a cross sign for marking the
***rows selected
LOOP AT i_outtab WHERE w_chk = 'X'.
WRITE: / i_outtab-carrid, i_outtab-price.
ENDLOOP. -
How to populate internal table field with text data?
Hello Experts,
I was able to load text file to a internal table but data is not populating each field. Can someone help me how to populate each field of internal table from text file?
Here is the text file:
io_name, io_type, io_txsht, io_txlng, io_datatype, io_length
ZEA_IO1, CHA, IO Test, IO Test 1, CHAR, 20
ZEA_IO2, CHA, IO Test, IO Test 2, CHAR, 20
Here is the Code:
*& Report ZAS_BAPI_TEST *
*& InfoObject Creation through BAPI.
*& Read the Text file, call a BAPI to create InfoObjects. *
*& Text file will hold the Info Object Structure. Text file will be *
*& located either work station or local PC.
*& Step 1. Create internal table to hold InfoObject structure *
*& Step 2. Retrieve/Load text file into Internal Table structure *
*& Step 3. Call BAPI Function to Create IO *
*& Step 4. Call BAPI Function to Activate IO *
REPORT ZAS_BAPI_TEST .
Make data separator a comma
CONSTANTS: gc_tab TYPE c VALUE ','.
Declaring Internal table for creating InfoObject
DATA: p_file TYPE string.
DATA: BEGIN OF itab-bapi OCCURS 0,
io_name like BAPI6108-infoobject,
io_type like BAPI6108-type,
io_txsht like BAPI6108-textshort,
io_txlng like BAPI6108-textlong,
io_datatype like BAPI6108-datatp,
io_length like BAPI6108-intlen,
END OF itab-bapi.
DATA ibapi LIKE STANDARD TABLE OF itab-bapi.
PARAMETERS: sel_file(1500) TYPE c default ' ' OBLIGATORY LOWER CASE.
PUT THE TEXT FILE PATH TO P_FILE
p_file = sel_file.
Copy the file from the workstation to the server ****
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = SPACE
HEADER_LENGTH = 0
DAT_MODE = SPACE
CODEPAGE = SPACE
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
READ_BY_LINE = 'X'
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = itab-bapi[]
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
MESSAGE e012(zea_spms) WITH 'Method' 'GUI_UPLOAD' sy-subrc.
&1 &2 issued return code &3
ELSE.
pit_data[] = lit_data[].
ENDIF.
ENDIF.
loop at itab-bapi.
write: /5 itab-bapi-io_name,
20 itab-bapi-io_type,
30 itab-bapi-io_txsht,
50 itab-bapi-io_txlng,
75 itab-bapi-io_datatype,
85 itab-bapi-io_length.
endloop.
SELECT THE LOCATION FOR TEXT FILE
AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_file.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = ''
def_path = 'C:\'
mask = ',Documentos de texto (*.txt), *.txt.'
mode = ''
IMPORTING
filename = p_file
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
find '.txt' IN p_file.
if sy-subrc <> 0.
concatenate p_file '.txt' into sel_file.
else.
sel_file = p_file.
endif.
Create InfoObject through BAPI Function
*CALL FUNCTION 'BAPI_IOBJ_CREATE'.
*IMPORTING
VALUE(DETAILS) LIKE BAPI6108 STRUCTURE BAPI6108
*EXPORTING
VALUE(INFOOBJECT) LIKE BAPI6108-INFOOBJECT
VALUE(RETURN) LIKE BAPIRET2 STRUCTURE BAPIRET2
TABLES
COMPOUNDS STRUCTURE BAPI6108CM OPTIONAL
ATTRIBUTES STRUCTURE BAPI6108AT OPTIONAL
NAVIGATIONATTRIBUTES STRUCTURE BAPI6108AN OPTIONAL
ATRNAVINFOPROVIDER STRUCTURE BAPI6108NP OPTIONAL
HIERARCHYCHARACTERISTICS STRUCTURE BAPI6108HC OPTIONAL
ELIMINATION STRUCTURE BAPI6108IE OPTIONAL
RETURNTABLE STRUCTURE BAPIRET2 OPTIONAL
Activate InfoObject through BAPI Function
CALL FUNCTION 'BAPI_IOBJ_ACTIVATE_MULTIPLE'
*ENDFORM. " RETRIEVE_DATASET
I appreciate your help.
Regards,
MauI have used tab delimited file.
Here are file contents
io_name io_type io_txsht io_txlng io_datatype io_length
ZEA_IO1 CHA IO Test IO Test 1 CHAR 20
ZEA_IO2 CHA IO Test IO Test 2 CHAR 20
And here is program used
*& Report ZAS_BAPI_TEST *
*& InfoObject Creation through BAPI.
*& Read the Text file, call a BAPI to create InfoObjects. *
*& Text file will hold the Info Object Structure. Text file will be *
*& located either work station or local PC.
*& Step 1. Create internal table to hold InfoObject structure *
*& Step 2. Retrieve/Load text file into Internal Table structure *
*& Step 3. Call BAPI Function to Create IO *
*& Step 4. Call BAPI Function to Activate IO *
REPORT ZAS_BAPI_TEST .
Make data separator a comma
CONSTANTS: gc_tab TYPE c VALUE ','.
Declaring Internal table for creating InfoObject
DATA: p_file TYPE string.
DATA: BEGIN OF itab-bapi OCCURS 0,
io_name like BAPI6108-infoobject,
io_type like BAPI6108-type,
io_txsht like BAPI6108-textshort,
io_txlng like BAPI6108-textlong,
io_datatype like BAPI6108-datatp,
io_length like BAPI6108-intlen,
END OF itab-bapi.
DATA ibapi LIKE STANDARD TABLE OF itab-bapi.
PARAMETERS: sel_file(1500) TYPE c default ' ' OBLIGATORY LOWER CASE.
PUT THE TEXT FILE PATH TO P_FILE
p_file = sel_file.
Copy the file from the workstation to the server ****
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_file
<b>FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'</b>
TABLES
data_tab = itab-bapi[]
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
MESSAGE e012(zea_spms) WITH 'Method' 'GUI_UPLOAD' sy-subrc.
&1 &2 issued return code &3
ELSE.
pit_data[] = lit_data[].
ENDIF.
ENDIF.
loop at itab-bapi.
write: /5 itab-bapi-io_name,
20 itab-bapi-io_type,
30 itab-bapi-io_txsht,
50 itab-bapi-io_txlng,
75 itab-bapi-io_datatype,
85 itab-bapi-io_length.
endloop.
SELECT THE LOCATION FOR TEXT FILE
AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_file.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = ''
def_path = 'C:\'
mask = ',Documentos de texto (*.txt), *.txt.'
mode = ''
IMPORTING
filename = p_file
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
find '.txt' IN p_file.
if sy-subrc <> 0.
concatenate p_file '.txt' into sel_file.
else.
sel_file = p_file.
endif.
Create InfoObject through BAPI Function
*CALL FUNCTION 'BAPI_IOBJ_CREATE'.
*IMPORTING
VALUE(DETAILS) LIKE BAPI6108 STRUCTURE BAPI6108
*EXPORTING
VALUE(INFOOBJECT) LIKE BAPI6108-INFOOBJECT
VALUE(RETURN) LIKE BAPIRET2 STRUCTURE BAPIRET2
TABLES
COMPOUNDS STRUCTURE BAPI6108CM OPTIONAL
ATTRIBUTES STRUCTURE BAPI6108AT OPTIONAL
NAVIGATIONATTRIBUTES STRUCTURE BAPI6108AN OPTIONAL
ATRNAVINFOPROVIDER STRUCTURE BAPI6108NP OPTIONAL
HIERARCHYCHARACTERISTICS STRUCTURE BAPI6108HC OPTIONAL
ELIMINATION STRUCTURE BAPI6108IE OPTIONAL
RETURNTABLE STRUCTURE BAPIRET2 OPTIONAL
Activate InfoObject through BAPI Function
CALL FUNCTION 'BAPI_IOBJ_ACTIVATE_MULTIPLE'
*ENDFORM. " RETRIEVE_DATASET
This program is working fine. You can test it.
Only problem is as the column headings are big for some columns, they are getting truncated which you can always change by changing the column width in declaration
Please let me know if this helps.
ashish -
How to populate dynamic internal table fields with data??
Hi Folks,
How to assign a particular internal table field to a dynamically assigned internal table?
I have an excel sheet, and i upload the excel sheet data into an internal IT_EXLOAD table using FM ALSM_EXCEL_TO_INTERNAL_TABLE
Now i created a dynamic internal table which has the same column as in my DB table.
I have to fill the dynamically created Internal table with the IT_EXLOAD data dynamically.
Suppose in future if i add some field in DB table and for that field if i add some column in excel sheet there is no need to change in the program.
Looking for reply...
Best Regards,
Sayakhi,
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_path
i_begin_col = '1'
i_begin_row = '2'
i_end_col = '2'
i_end_row = '1000'
TABLES
intern = intern
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
*declare intern_tmp as internal table tb_data in wich you want the data
*and declare a field symbol <fs_123>
LOOP AT intern.
ASSIGN COMPONENT intern-col OF STRUCTURE
intern_tmp TO <fs_123>.
IF NOT <fs_123> IS ASSIGNED.
CLEAR intern.
CLEAR intern_tmp.
CONTINUE.
ENDIF.
<fs_123> = intern-value.
AT END OF row.
CLEAR tb_data.
MOVE-CORRESPONDING: intern_tmp TO tb_data.
APPEND tb_data.
CLEAR intern_tmp.
ENDAT.
CLEAR intern.
ENDLOOP.
**paste this code and you can see the data in ur tables dynamically.
Thanks
Nitin Sachdeva -
Regarding spliting of the data in the internal table fields
TYPES :BEGIN OF X_flat_file,
banks LIKE lfbk-banks,
bankl LIKE lfbk-bankl,
bankn LIKE lfbk-bankn,
koinh LIKE lfbk-koinh,
bkont LIKE lfbk-bkont,
END OF X_flat_file.
DATA: t_itab TYPE STANDARD TABLE OF X_flat_file INITIAL SIZE 0,
wa_itab TYPE X_flat_file,
Now data in internal table is as follows:
t_itab-banks is AD,DE, AB
t_itab-bankl is 123456578,123456588,123456579
t_itab-bankn is 12345666,12345677,12345688
t_itab-koinh is vinod1,vinod2,vinod3
t_itab-bkont is 01,01,01
TYPES :BEGIN OF X_banks1,
banks LIKE lfbk-banks,
bankl LIKE lfbk-bankl,
bankn LIKE lfbk-bankn,
koinh LIKE lfbk-koinh,
bkont LIKE lfbk-bkont,
END OF X_banks1.
DATA: T_BANKS1 TYPE STANDARD TABLE OF X_BANKS1 INITIAL SIZE 0,
WA_BANKS1 TYPE X_BANKS1,
Now i want internal table t_itab data should split at commas and transfered to internal table t_banks1.
ex : t_itab-banks is AD,DE, AB should transfered to
t_banks: AD ( 1 record)
DE (2 record)
AB ( 3 record).
I used following coding ......
SPLIT wa_itab-BANKS AT ',' INTO T_BANKS1-BANKS.
SPLIT wa_itab-BANKL AT ',' INTO TABLE T_BANKS1-BANKL.
SPLIT wa_itab-BANKN AT ',' INTO TABLE T_BANKS1-BANKN.
SPLIT wa_itab-KOINH AT ',' INTO TABLE T_banks1-KOINH.
SPLIT wa_itab-BKONT AT ',' INTO TABLE T_BANKS1-BKONT.
SPLIT wa_itab-BANKA AT ',' INTO TABLE T_BANKA1-BANKA.
But its not working.Dear Sarvesh,
I have closed all the previous threads and only this one is open.
My coding is like this.
DATA:X(2),N(2) TYPE N.
N = 0.
LOOP AT T_BANKS INTO WA_BANKS.
N = N + 1.
ENDLOOP.
X = 1.
perform bdc_dynpro using 'SAPMF02K' '0130' 'X'.
CNT = 1.
DO N TIMES.
IF CNT > 5.
perform bdc_field using 'BDC_OKCODE' '=P+'. "*LOGIC FOR EXTENDING TABLE CONTROL
perform bdc_field using 'BDC_OKCODE' '/00'.
perform bdc_field using 'BDC_CURSOR' 'BANKNAM(01)'.
CNT = 1.
ENDIF.
LOOP AT T_BANKS INTO WA_BANKS FROM X TO X.
CONCATENATE 'LFBK-BANKS(' CNT ')' INTO FLD.
perform bdc_field using FLD wa_BANKS-BANKS.
ENDLOOP.
LOOP AT T_BANKL INTO WA_BANKL FROM X TO X.
CONCATENATE 'LFBK-BANKL(' CNT ')' INTO FLD.
perform bdc_field using FLD wa_BANKL-BANKL.
ENDLOOP.
LOOP AT T_BANKN INTO WA_BANKN FROM X TO X.
CONCATENATE 'LFBK-BANKN(' CNT ')' INTO FLD.
perform bdc_field using FLD wa_BANKN-BANKN.
ENDLOOP.
LOOP AT T_KOINH INTO WA_KOINH FROM X TO X.
CONCATENATE 'LFBK-KOINH(' CNT ')' INTO FLD.
perform bdc_field using FLD wa_KOINH-KOINH.
ENDLOOP.
LOOP AT T_BKONT INTO WA_BKONT FROM X TO X.
CONCATENATE 'LFBK-BKONT(' CNT ')' INTO FLD.
perform bdc_field using FLD wa_BKONT-BKONT.
ENDLOOP.
perform bdc_field using 'BDC_CURSOR' 'LFBK-bkont'.
perform bdc_field using 'BDC_OKCODE' '=BANK'.
perform bdc_dynpro using 'SAPLBANK' '0100' 'X'.
LOOP AT T_BANKA INTO WA_BANKA FROM X TO X.
CONCATENATE 'BNKA-BANKA(' CNT ')' INTO FLD.
perform bdc_field using FLD wa_BANKA-BANKA.
ENDLOOP.
perform bdc_field using 'BDC_CURSOR' 'BNKA-BANKA'.
perform bdc_field using 'BDC_OKCODE' '=ENTR'.
CNT = CNT + 1.
X = X + 1.
ENDDO.
My problem is that first table control data is getting loaded in the table fields BANKS, BANKL, BANKN, KOINH, BKONT . But next screen ('SAPLBANK' '0100' 'X'.) is not getting called and BANKA data is not getting filled..
Pls help.
As per the recording, first BANKS, BANKL, BANKN, KOINH, BKONT table control data should be filled and next screen should be called and then BANKA data should be filled and again cursor should come back to screen ('SAPMF02K' '0130' 'X'.).
similarly second table control data. -
How to display filtered data based on user login
We have a SSRS report (.rdlc) which gives the report about Online count of machines. Report is incoperayed in Asp.net.
We have many filters in This report. Now we have to retrict the report based on user login to the application .
For ex: report has a drop down for Regional Admin. Now if one person login to the application he has to view only his region online count.
How can we do this in SSRS?. We have our application hosted in Microsoft Azure . Please suggestHi csmbrnoc,
In Reporting Services, if we want to filter data based on user login, then there must be some relationship between the UserID and the Region in the dataset. For example, there is a field named UserID in the dataset, and each ID map some region and the corresponding
“Online count of machines”. In this scenario, just as Visakh suggested, we can use built-in field User!UserID to obtain UserID of the current user, then directly add a filter to the dataset as below:
Expression: [UserID]
Operator: =
Value: [&UserID]
If there are any other questions, please feel free to let me know.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Assigning value to Field - Symbol ( which is type of internal table field )
Hi All,
I am facing problem to assign the value to a field symbol. My requirement is creating a dynamic internal table and populate values into that internal table, so that i can display the values .
I am having a structure with fields like status , Plant1 name , Plant2 name.....Plant n .
So i declared an internal table it_tab with this structure.
I am having one more table which having number of records for Plant1 ,Plant 2 ,....Plant n based on some condition.
I need to count the number of records for Plant1 and i need to put in the internal table it_tab.
For this i created field-symbol .
Here, t_deployment table will have the plants 1,2,3...and
t_devobject will have some records for these plants.
LOOP AT T_DEPLOYMENT.
clear w_count.
LOOP AT T_DEVOBJECT WHERE ZDEPLOYMENT = T_DEPLOYMENT-DOMVALUE_L AND
ZADSTATUS = '10'.
w_count = w_count + 1.
ENDLOOP.
concatenate 'it_tab-' t_deployment-domvalue_l into var_bet_name.
assign var_bet_name to <bet_var_name>.
now my internal table field i.e. it_tab-plant1 came into <bet_var_name> . But i want to assign a value for it.
at last what i need is it_tab-plant1 = w_count.
whaterver the w_count has value that needs to assign to it_tab-plant1. But i don't want to assign directly it it_tab-plant1. I want to assign dynamically. Because tommorrow some more plants added to t_deployments , i don't want to make changes to my program. It should take care....w/o changing the program.
I tried the following statement.
(<bet_var_name>) = w_count. But its not working.
Please let me know how i can get this.
Thanks in Advance.
Pavan.Hi pavan,
As ur requirement is creating a dynamic internal table,
try the following way,
remember the fieldcat should be of type LVC not SLIS.
BUILD LT_LVCFIELDCAT in a way that, the value from the internal table becomes the fieldname
ex:-
loop at it_models INTO WA_MODELS.
LS_LVCFIELDCAT-FIELDNAME = WA_models-MODEL.
LS_LVCFIELDCAT-SELTEXT = WA_models-MODEL.
append ls_lvcfieldcat to lt_lvcfieldcat.
endloop.
DATA: DREF TYPE REF TO DATA,WA_REF TYPE REF TO DATA.
FIELD-SYMBOLS: <TEMP_TAB> TYPE TABLE, <TEMP_WA> TYPE ANY.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = LT_LVCFIELDCAT
IMPORTING
EP_TABLE = DREF.
ASSIGN dref->* TO <TEMP_TAB>.
now basing on the fieldcatalog <temp_tab> is build.
NOW FILL <TEMP_TAB>.
WHILE FILLING, ASSIGN COMPONENT IDX/NAME.....
this statement will be very usefull.
i hope this will be help full.
pls reward the points if it helps u.
regards
Hyma -
Accessing Dynamic Internal table fields
Hello All,
I have one internal table ep_tabx having 138 columns whose data is getting displayed
by using function module reuse_alv_grid_display.
Now my query is, i have created one custom button on the appl toolbar to download ep_tabx data.
IF the user changes the the layout of the output at runtime and then presses that custom button
then i have created one dynamic internal table using call method cl_alv_table_create=>create_dynamic_table suppose <dyn_table> whose struc will be that of
dynamic fieldcatalog returned by using FM REUSE_ALV_GRID_LAYOUT_INFO_GET.
And then I have put a loop on the int table ep_tabx and move corresponding to the int table
<dyn_table>. But when i download the <dyn_table> data through GUI_DOWNLOAD the
date fields data is not getting downloaded correctly. I have 4 date fields in my ep_tabx.
In the alv grid output the date is getting displayed like 08/30/2004(ie mon/date/yr) but in download
file it comes like 20040830(ie yr/mon/date and that too without /).How to access the dynamic
internal tables fields separately so asto convert them in the pgm before the download.
Kindly Help.
Thanks in advance.
MansiHi,
Search in SDN you would get loads of info on accessing dynamic itab's .
in order to convert your date format use WRITE stmt to convert the value in your itab before passing it to download FM.
Regards,
Raghavendra -
Header to internal table fields
Hi All,
How can I add header description to the internal table fields and download this internal table to desktop as EXCEL form.
I want to show heading in the first line of the excel and then 2 - 3 blank lines and then next line should be populated with DATE and Exec. Time, then 2-3 blank lines , then the data with the header description to be displayed.
My sample internal table data is as below,
John M 12 2344
Thomas M 17 8960
Lin F 10 8467
Jan M 12 4323
I need to add, description as NAME above John, Thomas, Lin etc.
as GENDER above M,M,F etc.
as CODE above 12, 17,10 etc. and
as EXTENTION above 2344, 8960,8467 etc
final execl sheet should be as below,
COMPANY DATA
DATE 28 - 08 - 2009 TIME 12:32
NAME GENDER CODE EXTENTION
John M 12 2344
Thomas M 17 8960
Lin F 10 8467
Jan M 12 4323
Please let me know, how to do this.
Thanks in advance ,
SabuHi,
Kindly go through this sample code below:
"Create T_Head internal table with the required structure for the header
*func mod to download header and contents to the given path
call function 'GUI_DOWNLOAD'
exporting
write_field_separator = 'X'
filename = v_pathname "path entered by the user
tables
data_tab = t_head. "Header Internal table
refresh t_head.
clear t_head.
call function 'GUI_DOWNLOAD'
exporting
* BIN_FILESIZE =
filename = v_pathname
filetype = 'ASC'
append = 'X' "Here by giving 'X', header will be appended in the download int table
write_field_separator = 'X'
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* IMPORTING
* FILELENGTH =
tables
data_tab = itab
* FIELDNAMES =
exceptions
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
others = 22
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.
Hope it helps
Regards
Mansi -
Need to display Internal table records on screen without using table contro
Hi Experts,
I have a requirement to display internal table on screen which is having three columns (Material no, Serial No and quantity).
But I can't use table control as it is not supported by hand held devices.
They are going to use this transaction on hand held devices.
Thanks In advance.
GauravYou should be able to use the good old STEP LOOP processing for this... create your three fields in the row then convert them to a STEP-LOOP.
You can look up in the help how to work with STEP-LOOPs if you are not familiar with it. It was the way to manage table-like information before the age of table controls -
Filling dynamic internal table with data from other internal table
Hi Friends,
My problem is that i have already built a dynamic internal table
(class int_table->create) but now i want to fill it with data from other internal table.
The dynamic table column name and the field value of the data filled internal table are same, but how to access that column name, since i cant hard code it anyway.
Like if my werks field value is '8001'. I want to place it under the column 8001 of dynamic table, Can anybody help me in this regard?
Awarding points is not a problem for even giving a slight hint.
Best RegardsHi
See this
Dynamic internal table is internal table that we create on the fly with flexible column numbers.
For sample code, please look at this code tutorial. Hopefully it can help you
Check this link:
http://www.****************/Tutorials/ABAP/DynamicInternaltable/DynamicInternalTable.htm
Sample code:
DATA: l_cnt(2) TYPE n,
l_cnt1(3) TYPE n,
l_nam(12),
l_con(18) TYPE c,
l_con1(18) TYPE c,
lf_mat TYPE matnr.
SORT it_bom_expl BY bom_comp bom_mat level.
CLEAR: l_cnt1, <fs_dyn_wa>.
Looping the component internal table
LOOP AT it_bom_expl INTO gf_it_bom_expl.
CLEAR: l_cnt1.
AT NEW bom_comp.
CLEAR: l_cnt, <fs_dyn_wa>, lf_mat.
For every new bom component the material data is moved to
temp material table which will be used for assigning the levels
checking the count
it_mat_temp[] = it_mat[].
Component data is been assigned to the field symbol which is checked
against the field of dynamic internal table and the value of the
component number is been passed to the dynamic internal table field
value.
ASSIGN COMPONENT c_comp_list OF STRUCTURE <fs_dyn_wa> TO
<fs_check>.
<fs_check> = gf_it_bom_expl-bom_comp.
ENDAT.
AT NEW bom_mat.
CLEAR l_con.
ENDAT.
lf_mat = gf_it_bom_expl-bom_mat.
Looping the temp internal table and looping the dynamic internal table
*by reading line by line into workarea, the materialxxn is been assigned
to field symbol which will be checked and used.
LOOP AT it_mat_temp.
l_nam = c_mat.
l_cnt1 = l_cnt1 + 1.
CONCATENATE l_nam l_cnt1 INTO l_nam.
LOOP AT <fs_dyn_table2> ASSIGNING <fs_dyn_wa2>.
ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa2> TO <fs_xy>.
ENDLOOP.
IF <fs_xy> = lf_mat.
CLEAR lf_mat.
l_con1 = l_con.
ENDIF.
Checking whether the material exists for a component and if so it is
been assigned to the field symbol which is checked against the field
of dynamic internal table and the level of the component number
against material is been passed to the dynamic internal table field
value.
IF <fs_xy> = gf_it_bom_expl-bom_mat.
ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa> TO <fs_check>.
CLEAR l_con.
MOVE gf_it_bom_expl-level TO l_con.
CONCATENATE c_val_l l_con INTO l_con.
CONDENSE l_con NO-GAPS.
IF l_con1 NE space.
CONCATENATE l_con1 l_con INTO l_con SEPARATED BY c_comma.
CLEAR l_con1.
l_cnt = l_cnt - 1.
ENDIF.
<fs_check> = l_con.
l_cnt = l_cnt + 1.
ENDIF.
ENDLOOP.
AT END OF bom_comp.
At end of every new bom component the count is moved to the field
symbol which is checked against the field of dynamic internal table
and the count is been passed to the dynamic internal table field
value.
ASSIGN COMPONENT c_count OF STRUCTURE <fs_dyn_wa> TO <fs_check>.
<fs_check> = l_cnt.
INSERT <fs_dyn_wa> INTO TABLE <fs_dyn_table>.
ENDAT.
ENDLOOP.
Reward if useful
Anji
Maybe you are looking for
-
How to capture the value selected in the drop down box
Hi all, I am populating values in drop down box by using FM vrm_set_values in module pool. like below 01 ABC 02 ACB 03 BCA 04 CAB in module pool drop down box element name is RQGM-VALUE. Problem is what ever the value is select in the drop down box
-
hi all, i want to make one field in display mode in mir7 how i can achieve this...plz help regards, umesh
-
SAP GRC AC 5.3 integrated with BW
Hi all, Has anyone of you implemented integration between SAP GRC AC 5.3 and BW and develop custom reports? Thanks in advance. Regards, Imanol
-
When is it safe to release IMFSample and data?
According to the tutorial here: http://msdn.microsoft.com/en-us/library/windows/desktop/ff819477(v=vs.85).aspx, it looks like we are supposed to release the sample and sample buffer right away: // Send the sample to the Sink Writer. if (SUCCEEDED(hr)
-
Hello: I use Premiere Pro 2.0. Last week I exported a video file just fine, but now my Adobe Media Encoder appears lost. No window pops up to adjust settings etc. I've tried cleaning up my system and reloading the PP 2.0 software but no luck. I