Dynamic Field selection
HI All,
I am looking for experts advise here. My requirement is like this. I have 8 checkboxes in the selection screen. Based on the selected chekbox it has to pick the corresponding field table values. The selection of values I have completed but displaying them in a excel sheet is a challange here.
I have to display the record in the excel download(This I can Do through WS_DOWNLOAD). But the question is If I choose Check box A only thos fields needs to be displayed and if checkbox B only those fields needs to be displayed in excel. If both the checkboxes checked then all the fields needs to be displayed in the excel.
Could any one advise me how to achieve this functionality. Actually I picked the values corresponding to the checkbox and it is available in the different internal tables.
Chckbox 1 - itab1, chckbox 2 -itab2,chckbox3-tab3......
Regards
Ram.
DATA: ls_fcat TYPE lvc_s_fcat.
DATA: lt_fcat TYPE lvc_t_fcat.
FIELD-SYMBOLS:
<fs_dyn_table> TYPE STANDARD TABLE,
<fs_dyn_wa> TYPE ANY,
<fs_final> TYPE ANY,
<fs_val> TYPE ANY.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = iv_struc_name " THIS IS YOUR STRUCTURE FOR 8 CHECK BOX
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = lt_struc_fld
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3
IF sy-subrc <> 0.
ev_failed = abap_true.
EXIT.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Count the columns, create fcat
LOOP AT lt_struc_fld INTO ls_struc_fld.
" DEFINE THE PROPERTIES OF THE FIELDCAT
" ONLY APPEND, IF THE USER HAS SELECTED THE CHECK BOX
ls_fcat-dd_outlen = ls_struc_fld-intlen.
ls_fcat-decimals = ls_struc_fld-decimals.
ls_fcat-datatype = ls_struc_fld-datatype.
ls_fcat-fieldname = ls_struc_fld-fieldname.
APPEND ls_fcat TO lt_fcat.
ENDLOOP.
ENDIF.
* Create a dynamic internal table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_fcat
IMPORTING
ep_table = lt_dy_table.
* Create dynamic work area and assign to FS
ASSIGN lt_dy_table->* TO <fs_dyn_table>.
CREATE DATA lt_dy_line LIKE LINE OF <fs_dyn_table>.
ASSIGN lt_dy_line->* TO <fs_dyn_wa>.
"NOW GET THE DATA FROM THE TABLE TO YOUR INTERNAL TABLE
*SELECT * UP TO 4 ROWS
* FROM mara
* INTO TABLE <fs_tab>.
Similar Messages
-
Dynamic field Select from table
Hi,
I have to select certain field from table. The field which I have to select I do not know.
It will come dynamically from program.
Plz help me what is correct statement to execute.
Thanks.
S SahooHi Sahoo,
Pllease follow below steps.
1, Create internal table with field Fieldname TYPE FIELDNAME (Say ITAB)
2. Append Fields (thats you want to select) to internal table [at run time]
3. Use
SELECT (ITAB)
into table <table>
from <DB>
where <cond>
Hope this helps,
Nag -
Dynamic field selection by variable input in bex report
Hi Frineds,
I have created variable on characteristic ( 0CURTYPE ) which mainly have two values 'A' and ' B' .Based on my variable input in Bex I have to dynamical select key figuers Example .
0CURTYPE KeyfigA KeyFigB
A 123 Rs 144 $
B 124 Rs 145 $
In above example is user select A I have to display KeyfigA if I select B then i should display Keyfig B in Bex report .
I know that by using user exit in report we can do but I would like to try with out Exit .
Thanks ,
Kumar.Your formula variable allowed to be of type either number or amount or date or quantity which are all numeric(currency type/type tab) .But your reference characteristics is a letter.So there is an inconsistency here and you can not make equal your formula variable and 0currtype's variable.
Have a look at Akshata's post in this thread :How to create formula variables in sap bi?
Therefore this model does not work and I can not see any other way apart from a very simple user exit which says if 0currype=A, then formula variable=0 else if 0currtype=B then formula variable=1.After that you can use your formula variable in your formula since the letters are now converted to numbers.
By the way it mustn't ask two things in the selection screen.Since your formula variable takes the values of 0currtype's variable automatically.Did you create the formula variable with replacement path(general tab) referencing to 0currtype?Just create a formula, enter this formula,right click create formula variable,go to general tab then replacement path then reference to 0currtype.But as I told, you nevertheless can not achieve it, just explaining it.
Regards,
Sunny -
Dynamic field selection in internal table
hello,
I want to display the fields in the internal table dynamically.
In myReport i am giving plant as the input. On the basis of plant i want to dislpay work centres as the heading and for the particular plant i want to display the pieces for the confirmed operation of the particular work centre.
workcentre1 workcentre2 workcenter3 ...........workcentren
12 10 9 ............ 4
in my report i have to include these fields with my earlier fields
Please help.hello,
I want to display the fields in the internal table dynamically.
In myReport i am giving plant as the input. On the basis of plant i want to dislpay work centres as the heading and for the particular plant i want to display the pieces for the confirmed operation of the particular work centre.
workcentre1 workcentre2 workcenter3 ...........workcentren
12 10 9 ............ 4
in my report i have to include these fields with my earlier fields
Please help. -
Hi Team,
I have to select dynamic fields from database table GLT0.
This depends on period value given on screen.
If period is 01 then fields will be hsl01.
If period is 02 then fields will be hsl01 and hsl02.
If period is 03 then fields will be hsl01,hsl02 and hsl03 .
so on...till 12..
My code is throwing exception at select query.
"Error in module RSQL of the database interface."
My code :
*" Type declaration to store field name as per given period
TYPES : BEGIN OF y_fieldname ,
fieldname(10) TYPE c ,
END OF y_fieldname .
data t_fieldname TYPE STANDARD TABLE OF y_fieldname .
DO p_monat TIMES.
clear w_count .
MOVE sy-index TO w_count
IF sy-index LE c_9.
CONCATENATE c_hsl
c_0
w_count
INTO e_fieldname-fieldname.
APPEND e_fieldname TO t_fieldname.
ELSE.
CONCATENATE c_hsl
w_count
INTO e_fieldname-fieldname.
APPEND e_fieldname TO t_fieldname.
ENDIF.
ENDDO.
Get Local Currency Amounts
from table glt0 depending on period
SELECT (t_fieldname)
FROM glt0
INTO TABLE t_glto_with_saknr
FOR ALL ENTRIES IN t_bukrs
WHERE rldnr EQ c_00
AND rrcty EQ c_0
AND rvers EQ c_001
AND bukrs EQ t_bukrs-bukrs
AND ryear EQ p_gjahr
AND racct IN r_saknr.
Please guide me.
Thanking u in advance.
Sangeeta VermaHi Asik,
I m selecting all fields now as suggestd by u so in one record i have hsl01 to hsl12.
I have to calculate balance into e_glt0_bal-bal .This balance is summation of e_glt0_bal-hsl01 till e_glt0_bal-hsl12 (depending on monat).
I m using logic in process then
my code now :
data: w_monat_bal type string .
DO p_monat TIMES.
MOVE c_01 TO w_count .
CONCATENATE 'e_glt0_bal-hsl'
w_count
INTO w_monat_bal.
ASSIGN w_monat_bal TO <fs_monat_bal>.
e_glt0_bal-bal = e_glt0_bal-bal + <fs_monat_bal>.
w_count = w_count + c_01.
ENDDO.
But <fs_monat_bal> can not be added.
Giving exception :
Unable to interpret "e_glt0_bal-hsl01" as a number.
If I do <fs_monat_bal> type GLT0-hslvt instead to type any
Then assigning from w_monat_bal is not possible. -
Dynamic field in select statment.
Hello,
I created a report in which i have two checkboxes in the selection screen. The first checkbox is for the option to bring or not, initial purchase requisitions (BANFN) from EKPO and the second is to bring initial or not, RFQs
(ANFNR). I want the select statment to have this form:
select ...
from ekpo
into g_table
where ..
and dynamic field = " ".
Can this be done ?
i tried to put it as a string but it didnt work. (data: dynamic field type string value "EKPO-BANFN")
P.S i know that it can be by writing the same select code twice.
I just wonder if this can be done by this way
\Regards.Hey Nick,
I have more conditions than the one i said before , should all be in the lv_where_clause ?
check my code.
DATA: G_CHBFLD type STRING.
G_CHBFLD = 'P~BANFN = '' " '.
FORM SELECT_DATA_EKPO_EKKO.
SELECT .....
FROM EKPO AS P INNER JOIN EKKO AS K
ON PEBELN = KEBELN
INTO CORRESPONDING FIELDS OF TABLE GT_EKPOEKKO
WHERE K~EBELN IN S_EBELN
AND K~AEDAT IN S_AEDAT
AND K~BSTYP IN S_BSTYP
and ( G_CHBFLD ) . -
> //DEBUGER ")" is not a valid comparison operator. comparison operator. -
Dynamic fields in select statement
Hi all,
In selection screen we are having period as select option.The values for period are 01 to 16. Based on
the values entered in selection screen for period we need to select HSLXX from FAGLFLEXT.
For example if we enter 01 to 03 in selection screen then we need to select HSL01 HSL02 HSL03
from FAGLFLEXT.
Like this we need to select fields dynamically in select statement. Can any one tell me how to restrict fields dynamically.
Regards,
Swethahi Swetha,
the third select statemnet will work for you..
try this..
_Dynamic where clause in select query.._
* With a variable, result: AND rbusa = '5145'
concatenate 'AND rbusa = ' '''' i_tab-zgsber ''''
append where_clause to where_tab.
* Select
select * from zcostfreq
where (where_tab).
endselect.
_Using a dynamic table name_
parameters:
p_tab type tabname.
start-of-selection.
select count(*) from (p_tab) into l_count.
_Dynamic retrieval and writing of data_
FIELD-SYMBOLS:
<row> TYPE ANY,
<component> TYPE ANY.
PARAMETERS:
p_tab TYPE tabname.
CREATE DATA dataref TYPE (p_tab).
* The variable dataref cannot be accessed directly, so a field symbol is
* used
ASSIGN dataref->* TO <row>.
SELECT *
FROM (p_tab) UP TO 10 ROWS
INTO <row>.
NEW-LINE.
DO.
* Write all the fields in the record
ASSIGN COMPONENT sy-index
OF STRUCTURE <row>
TO <component>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
WRITE <component>.
ENDDO.
ENDSELECT.
Regards,
Prabhduas -
How to pass selection screen value to LDB dynamic field.
Hello everybody,
In my program, I am using standard LDB(PSJ) for getting data. And there is a requirement that I have to display some dynamic fields on my selection screen like plant , person responsible ( which are mandatory also ) etc. and inside the program I have to fill those dynamic fields for which the user has entered the value in selection screen.
Could you please tell me how to pass some of selection screen values to ldb dynamic fields before GET statement.
Thanks !!!
Regards,
Mitra>
Pavan Bhamidipati wrote:
> Hi,
>
>
I have to fill those dynamic fields for which the user has entered the value in selection screen.
>
>
> This means that the user is going to enter the values in the selection screen for the dynamic field values so
>
> SET PARAMETERID 'XYZ' FIELD p_field.
>
> where p_field is a parameter on the selection screen
>
> Regards
> Pavan
You can capture the values selected through the dynamic selections using some of the functions modules below, just search the forum for the below FM's, perhaps you can find some sample code
FREE_SELECTIONS_EX_2_RANGE
FREE_SELECTIONS_EX_2_WHERE
FREE_SELECTIONS_RANGE_2_EX
FREE_SELECTIONS_RANGE_2_WHERE
FREE_SELECTIONS_WHERE_2_EX
FREE_SELECTIONS_WHERE_2_RANGE -
Reg: Dynamic Field catalog in ALV
Hi ,
Can any one guide me to build a dynamic field catalog in ALV report?
Below is the format which i expect..........
Material | Plant1 | Plant2 | Plant3 | ....................| Plant 20 |
Qty
Val
Qty
Val
Qty
Val
Qty
Val
The plant 1 to 20 has to be brought dynamically as headings from T001W table. (Horizontally populate)
Below each plant i need sub-headings "QTY" and "VAL". (Horizontally populate)
List of Materials should be brought vertically from MARA table. (Vertically populate)
Can anyone suggest how to bring out this format for populating data accordingly into the o/p format?
Ur help will be appreciated.
Thanks,
K.S.Kannanyour part of the code is present in routine
perform dynamic_table.
*& Report ZCS_NAC_MAT_CHARACTERISTICS
2/ Description ...: Business requirement is to get all materials
without any characteristic values maintained in SAP
which are given in the selection screen.
REPORT znac_material_char.
TYPE-POOLS : abap,
slis.
TABLES : kssk,
klah,
mara,
makt,
cabn,
t134,
t023.
DATA : i_fieldcat TYPE slis_t_fieldcat_alv ,
wa_fieldcat TYPE slis_fieldcat_alv.
DATA : w_layout TYPE slis_layout_alv.
DATA : st_layout TYPE slis_layout_alv.
DATA : t_header TYPE slis_t_listheader,
w_header TYPE slis_listheader.
TYPES : BEGIN OF ty_cabn,
atinn TYPE cabn-atinn,
atnam TYPE cabn-atnam,
END OF ty_cabn.
DATA : i_cabn TYPE STANDARD TABLE OF ty_cabn WITH HEADER LINE.
DATA : w_cabn LIKE i_cabn.
TYPES : BEGIN OF ty_ausp,
objek TYPE ausp-objek,
atinn TYPE ausp-atinn,
klart TYPE ausp-klart,
END OF ty_ausp.
DATA : i_ausp TYPE STANDARD TABLE OF ty_ausp WITH HEADER LINE.
DATA : w_ausp LIKE i_ausp.
TYPES : BEGIN OF ty_mara,
matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
matkl TYPE mara-matkl,
prdha TYPE mara-prdha,
mstae TYPE mara-mstae,
mstde TYPE mara-mstde,
END OF ty_mara.
DATA : i_mara TYPE STANDARD TABLE OF ty_mara WITH HEADER LINE.
DATA : w_mara LIKE i_mara.
DATA : i_mara_temp TYPE STANDARD TABLE OF ty_mara WITH HEADER LINE.
DATA : w_mara_temp LIKE i_mara_temp.
TYPES :BEGIN OF ty_data,
atnam TYPE cabn-atnam,
atinn TYPE cabn-atinn,
objek TYPE ausp-objek,
klart TYPE ausp-klart,
matnr TYPE mara-matnr,
maktx TYPE makt-maktx,
mtart TYPE mara-mtart,
matkl TYPE mara-matkl,
prdha TYPE mara-prdha,
mstae TYPE mara-mstae,
mstde TYPE mara-mstde,
END OF ty_data.
DATA : i_data TYPE STANDARD TABLE OF ty_data WITH HEADER LINE.
DATA : w_data LIKE i_data.
DATA : i_class TYPE STANDARD TABLE OF sclass WITH HEADER LINE.
DATA : w_class LIKE i_class.
DATA : i_class_temp TYPE STANDARD TABLE OF sclass WITH HEADER LINE.
DATA : w_class_temp LIKE i_class_temp.
DATA : i_objdata TYPE STANDARD TABLE OF clobjdat WITH HEADER LINE.
DATA : w_objdata LIKE i_objdata.
TYPES : BEGIN OF ty_objdata_temp.
TYPES: matnr TYPE mara-matnr.
TYPES: maktx TYPE makt-maktx.
INCLUDE STRUCTURE clobjdat.
TYPES : prdha TYPE mara-prdha.
TYPES : mstde TYPE mara-mstde.
TYPES : END OF ty_objdata_temp.
DATA : i_objdata_temp TYPE STANDARD TABLE OF ty_objdata_temp WITH HEADER LINE.
DATA : w_objdata_temp LIKE i_objdata_temp.
FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE,
<fs_dyntable>,
<fs_fldval> TYPE ANY.
DATA: t_newtable TYPE REF TO data,
t_newline TYPE REF TO data,
fs_fldcat TYPE slis_t_fieldcat_alv,
t_fldcat1 TYPE lvc_t_fcat,
wa_it_fldcat TYPE lvc_s_fcat,
wa_colno(2) TYPE n,
wa_flname(30) TYPE c.
DATA: fieldname(20) TYPE c.
DATA: fieldvalue(40) TYPE c.
DATA: index(3) TYPE c,
v_time(60) TYPE c.
DATA: wa_cat LIKE LINE OF fs_fldcat.
CONSTANTS : c_nac TYPE klah-class VALUE 'NAC',
c_klart TYPE ausp-klart VALUE '001',
c_check TYPE c VALUE 'X' .
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (28) text-001 .
SELECT-OPTIONS: s_atnam FOR cabn-atnam NO INTERVALS OBLIGATORY. " Characteristic name
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b1 .
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
SELECT-OPTIONS: s_matnr FOR mara-matnr. " material Number
SELECT-OPTIONS: s_mtart FOR mara-mtart. " material type
SELECT-OPTIONS: s_matkl FOR mara-matkl. " material type
SELECT-OPTIONS: s_mstae FOR mara-mstae. " X-Plant material status
PARAMETERS : s_date LIKE sy-datum OBLIGATORY DEFAULT sy-datum . " date
SELECTION-SCREEN END OF BLOCK b2 .
AT SELECTION-SCREEN ON s_atnam.
SELECT SINGLE * FROM cabn WHERE atnam IN s_atnam.
IF sy-subrc 0.
MESSAGE text-003 TYPE 'E'.
ENDIF.
AT SELECTION-SCREEN ON s_matnr.
SELECT SINGLE * FROM mara WHERE matnr IN s_matnr.
IF sy-subrc 0.
MESSAGE text-004 TYPE 'E'.
ENDIF.
AT SELECTION-SCREEN ON s_mtart.
SELECT SINGLE * FROM t134 WHERE mtart IN s_mtart.
IF sy-subrc 0.
MESSAGE text-005 TYPE 'E'.
ENDIF.
AT SELECTION-SCREEN ON s_matkl.
SELECT SINGLE * FROM t023 WHERE matkl IN s_matkl.
IF sy-subrc 0.
MESSAGE text-006 TYPE 'E'.
ENDIF.
START-OF-SELECTION.
PERFORM get_data.
PERFORM get_data_keydate.
PERFORM material_all_charname.
PERFORM get_classification.
PERFORM dynamic_table.
*& Form dynamic_table
text
--> p1 text
<-- p2 text
FORM dynamic_table.
PERFORM fieldcatalog.
PERFORM dynamic_table_create.
PERFORM final_data.
PERFORM final_fieldcatalog.
PERFORM layout_build.
PERFORM grid_display.
ENDFORM. " fieldcat
*& Form layout_build
text
FORM layout_build .
st_layout-zebra = c_check.
st_layout-no_vline = ''.
st_layout-colwidth_optimize = c_check.
st_layout-detail_popup = c_check.
st_layout-detail_initial_lines = c_check.
st_layout-detail_titlebar = text-021.
ENDFORM. " layout_build
*& Form alv_top_of_page
text
FORM alv_top_of_page.
REFRESH t_header.
CLEAR t_header.
w_header-typ = 'H'. "H=Header, S=Selection, A=Action
w_header-key = ' '.
w_header-info = text-019.
APPEND w_header TO t_header.
CONCATENATE sy-datum4(2) '-' sy-datum6(2) '-' sy-datum0(4) ' / ' sy-uzeit0(2) ':' sy-uzeit2(2) ':' sy-uzeit4(2) INTO v_time.
w_header-typ = 'S'. "H=Header, S=Selection, A=Action
w_header-key = text-020.
w_header-info = v_time.
APPEND w_header TO t_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header.
ENDFORM. "alv_top_of_page
*& 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_top_of_page = 'ALV_TOP_OF_PAGE'
it_fieldcat = fs_fldcat
is_layout = st_layout
i_default = c_check
i_save = 'A'
it_events = v_events[]
TABLES
t_outtab = <t_dyntable>.
ENDFORM. " grid_display
*& Form FINAL_FIELDCATALOG
text
--> p1 text
<-- p2 text
FORM final_fieldcatalog .
wa_cat-fieldname = text-009.
wa_cat-seltext_m = text-015.
wa_cat-outputlen = 18.
APPEND wa_cat TO fs_fldcat.
wa_cat-fieldname = text-011.
wa_cat-seltext_m = text-016.
wa_cat-outputlen = 40.
APPEND wa_cat TO fs_fldcat.
LOOP AT s_atnam.
CLEAR wa_cat.
wa_cat-fieldname = s_atnam-low.
wa_cat-seltext_m = s_atnam-low.
wa_cat-outputlen = '15'.
APPEND wa_cat TO fs_fldcat.
ENDLOOP.
wa_cat-fieldname = text-012.
wa_cat-seltext_m = text-017.
wa_cat-outputlen = 18.
APPEND wa_cat TO fs_fldcat.
wa_cat-fieldname = text-013.
wa_cat-seltext_m = text-018.
wa_cat-outputlen = 8.
APPEND wa_cat TO fs_fldcat.
ENDFORM. " FINAL_FIELDCATALOG
*& Form FIELDCATALOG
text
--> p1 text
<-- p2 text
FORM fieldcatalog .
wa_it_fldcat-fieldname = text-009.
wa_it_fldcat-datatype = text-010.
wa_it_fldcat-intlen = 18.
APPEND wa_it_fldcat TO t_fldcat1.
wa_it_fldcat-fieldname = text-011.
wa_it_fldcat-datatype = text-010.
wa_it_fldcat-intlen = 40.
APPEND wa_it_fldcat TO t_fldcat1.
LOOP AT s_atnam.
CLEAR wa_it_fldcat.
wa_it_fldcat-fieldname = s_atnam-low.
wa_it_fldcat-datatype = text-010.
wa_it_fldcat-intlen = 30.
APPEND wa_it_fldcat TO t_fldcat1.
ENDLOOP.
wa_it_fldcat-fieldname = text-012.
wa_it_fldcat-datatype = text-010.
wa_it_fldcat-intlen = 18.
APPEND wa_it_fldcat TO t_fldcat1.
wa_it_fldcat-fieldname = text-013.
wa_it_fldcat-datatype = text-014.
wa_it_fldcat-intlen = 8.
APPEND wa_it_fldcat TO t_fldcat1.
ENDFORM. " FIELDCATALOG
*& Form DYNAMIC_TABLE_CREATE
text
--> p1 text
<-- p2 text
FORM dynamic_table_create .
Create dynamic internal table and assign to FS
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fldcat1
IMPORTING
ep_table = t_newtable.
ASSIGN t_newtable->* TO <t_dyntable>.
Create dynamic work area and assign to FS
CREATE DATA t_newline LIKE LINE OF <t_dyntable>.
ASSIGN t_newline->* TO <fs_dyntable>.
ENDFORM. " DYNAMIC_TABLE_CREATE
*& Form FINAL_DATA
text
--> p1 text
<-- p2 text
FORM final_data .
LOOP AT i_objdata_temp INTO w_objdata_temp.
*assign w_objdata_temp-matnr to <fs_dyntable>.
AT NEW matnr.
wa_flname = text-009.
fieldvalue = w_objdata_temp-matnr.
CONDENSE fieldvalue NO-GAPS.
ASSIGN COMPONENT wa_flname
OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
<fs_fldval> = fieldvalue.
ENDAT.
wa_flname = text-011.
fieldvalue = w_objdata_temp-maktx.
CONDENSE fieldvalue NO-GAPS.
ASSIGN COMPONENT wa_flname
OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
<fs_fldval> = fieldvalue.
wa_flname = w_objdata_temp-atnam.
fieldvalue = w_objdata_temp-ausp1.
CONDENSE fieldvalue NO-GAPS.
ASSIGN COMPONENT wa_flname
OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
<fs_fldval> = fieldvalue.
wa_flname = text-012.
fieldvalue = w_objdata_temp-prdha.
CONDENSE fieldvalue NO-GAPS.
ASSIGN COMPONENT wa_flname
OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
<fs_fldval> = fieldvalue.
wa_flname = text-013.
fieldvalue = w_objdata_temp-mstde.
CONDENSE fieldvalue NO-GAPS.
ASSIGN COMPONENT wa_flname
OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
<fs_fldval> = fieldvalue.
AT END OF matnr.
APPEND <fs_dyntable> TO <t_dyntable>.
ENDAT.
ENDLOOP.
ENDFORM. " FINAL_DATA
*& Form GET_CLASSIFICATION
text
--> p1 text
<-- p2 text
FORM get_classification .
LOOP AT i_data INTO w_data.
SELECT SINGLE * FROM klah WHERE class = c_nac.
IF sy-subrc = 0.
IF w_data-mstde >= klah-vondt.
CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
EXPORTING
class = c_nac
classtext = c_check
classtype = c_klart
clint = 0
features = c_check
language = sy-langu
object = w_data-objek
TABLES
t_class = i_class
t_objectdata = i_objdata
EXCEPTIONS
no_classification = 1
no_classtypes = 2
invalid_class_type = 3
OTHERS = 4.
LOOP AT i_class INTO w_class.
MOVE w_class TO w_class_temp.
APPEND w_class_temp TO i_class_temp.
ENDLOOP .
LOOP AT s_atnam.
READ TABLE i_objdata INTO w_objdata WITH KEY atnam = s_atnam-low.
IF sy-subrc = 0.
MOVE w_data-matnr TO w_objdata_temp-matnr.
MOVE w_data-maktx TO w_objdata_temp-maktx.
MOVE-CORRESPONDING w_objdata TO w_objdata_temp.
MOVE w_data-prdha TO w_objdata_temp-prdha.
MOVE w_data-mstde TO w_objdata_temp-mstde.
APPEND w_objdata_temp TO i_objdata_temp.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " GET_CLASSIFICATION -
Hello Experts,
I have a requirement to design all fields in a form dynamically..!
It means if the user selects speific fields in a custom config, the form should be genarated with only those fields.
I know it can be done placing fields at design time and then hiding it later.. but I am looking for dynamic fields creation and position and setting its properties dynamically.
Thanx for Ur time.. !hi,
Did you try creating a composite form ?? The sap.help link to creating Dynamic forms is give below
[link|http://help.sap.com/saphelp_nwce10/helpdata/en/44/bca11fc60b7006e10000000a155369/content.htm]
Hope this helps
Regards
Manthan. -
Select Dynamic for Select Option
Hi. Good Night.
I have the following screen of selection for a user. I need create a Select Dynamic for the table ANLA, Having in count the values selected by the user in each option of the screen.
SELECTION-SCREEN BEGIN OF BLOCK SEL WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS:
BUKRS FOR ANLA-BUKRS,
ANLKL FOR ANLA-ANLKL,
KOSTL FOR ANLZ-KOSTL,
GDLGRP FOR ANLA-GDLGRP,
INVNR FOR ANLA-INVNR.
SELECTION-SCREEN END OF BLOCK SEL.
How can do this?
Thank in advance for your help.
Regards.This is the error:
Err.tmpo.ejec. SAPSQL_WHERE_ILLEGAL_VALUE
Excep. CX_SY_DYNAMIC_OSQL_SEMANTICS
Fecha y hora 17.08.2010 10:05:08
This is my source code.
SELECTION-SCREEN BEGIN OF BLOCK SEL WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: SOCIEDAD FOR ANLA-BUKRS, "
CLASEAF FOR ANLA-ANLKL, "
CENCOST FOR ANLZ-KOSTL,"
CARRESP FOR ANLA-GDLGRP,
NUMINV FOR ANLA-INVNR.
SELECTION-SCREEN END OF BLOCK SEL.
DATA: l_lines(72) TYPE c.
itab for fields selection
DATA: lt_condition LIKE TABLE OF l_lines(72),
lt_fields LIKE TABLE OF l_lines(72).
DEFINE m_add_fields.
l_lines = &1.
append l_lines to lt_fields.
END-OF-DEFINITION.
m_add_fields 'BUKRS'.
m_add_fields 'ANLK'.
m_add_fields 'GDLGRP'.
m_add_fields 'INVNR'.
*bukrs
l_lines = 'BUKRS in SOCIEDAD'.
APPEND l_lines TO lt_condition.
ANLK
l_lines = 'AND ANLK in CLASEAF'.
APPEND l_lines TO lt_condition.
Select statement
SELECT INVNR ANLKL SERNR ANLN1 TXT50 AKTIV ZUGDT
BSTDT LIFNR LIEFE ORD41 ORD42 ORD43 AIBN1
AIBN2 VMGLI FLURN
INTO TABLE it_tabla
FROM ANLA
WHERE (lt_condition).
Thank in advance for your help.
Regards -
Dynamic field in master page header?
Is it possible to put a dynamic field in a master page header that will either pull from a hidden text field added to each subform (e.g., appID) or pull in the title of the subform itself? I have a number of variable-sized subforms that need the same header and footer, with the only distinct element being a different number at the top.
I've been looking for a standard variable or wildcard that can be used to dynamically reference an object at the same level in multiple subforms, but so far have not been able to find what I need.
Hierarchy:
form1
masterpage
subformApp1
subformApp2Hi Sankar,
Create on eattribute of type String and bind to title property of page header,
and your WDDOINIT or any event write code to set title for PG header,
You are using different buttons, use this code in your buttons and change text.
DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->Element_context.
DATA lv_pg TYPE wd_this->Element_context-pg.
* get element via lead selection
lo_el_context = wd_context->get_element( ).
data pg1 type string.
pg1 = 'selected the record'.
lv_pg = Pg1.
* set single attribute
lo_el_context->set_attribute(
name = `PG`
value = lv_pg ).
In button 1..
lv_pg = 'Enter the entries'.
* set single attribute
lo_el_context->set_attribute(
name = `PG`
value = lv_pg ).
Cheers,
Kris. -
Dynamic Sql Select Query : getting no response
Hi
I am working on a synchronous interface that has jdbc at the receiver side..
I need to be doing a select dynamically based on a filed from the request like
select locationId from dbTablename where empId = 'xxx' AND delFlag =0
the xxx will be populated from a filed in the request
For this i have set up a request structure with action as "SQL_QUERY" and the following query in the access field
SELECT location_id from dbtablename where empID='$cv_EMPID$' and delFlag=0
I have a key element which has a sub-element "cv_EMPID"
Unfortunately, the query doestn pull any records from the dbtable..
In sxmb_moni , I get a query like this
- <STATEMENT>
- <TABLENAME action="SQL_QUERY">
<TABLE>tablename</TABLE>
</TABLENAME>
<access>select cv_locationID from tablename where cv_empID='$cv_EmpID$'</access>
- <key>
<cv_EmpID>60000016</cv_EmpID>
</key>
</STATEMENT>
but there is no response
What do u think is the problem here?
Thanks
KrishnaHi,
Refer these links:
http://help.sap.com/saphelp_nw70/helpdata/en/b0/676b3c255b1475e10000000a114084/content.htm
RDBMS system integration using XI 3.0 JDBC Sender/Receiver adapter
SYNCHRONOUS SOAP TO JDBC - END TO END WALKTHROUGH
Check out this-
http://help.sap.com/saphelp_erp2005vp/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
Also check that, JDBC driver is installed correctly- for this
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3867a582-0401-0010-6cbf-9644e49f1a10
Check out these links
http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
JDBC Receiver Adapter -- Synchronous Select Step by Step
Regards,
Nithiyanandam -
Dynamic Internal Table with Dynamic Fields
Hi all,
My scenario is fairly simple----
--> End user clicks a button on screen and he gets the list of HR tables.
--> Then selects a table and list of all the fields for that table gets displayed.
--> He/she selects the fields they want data to be retrieved for.
So, the requirement is, the dynamic internal table should get created with the fields selected.
The select statement should only retrieve fields which were selected by the end user
and from the table selected by the end user.
I believe the fields selected by end user can be passed by a variable of type string.
something like this---
select (fields)
from (p_table) " Table selected by end user
into dynamic internal table. " should contain columns selected by end user"
Appreciate your inputs and guidance.
Warm regards,
Hari KiranTYPE-POOLS :ABAP.
Parameters P_TAB TYPE DDOBJNAME.
DATA : GO_LINE_TYPE TYPE REF TO CL_ABAP_STRUCTDESCR,
GO_TABLE_DESC TYPE REF TO CL_ABAP_TABLEDESCR,
GS_COMPONENTS TYPE ABAP_COMPONENTDESCR,
GT_COMPONENTS TYPE ABAP_COMPONENT_TAB,
GR_TAB TYPE REF TO DATA,
GT_FIELDS TYPE TABLE OF DFIES WITH HEADER LINE.
FIELD-SYMBOLS: <GT_TABLE> TYPE TABLE,
<GS_TABLE> TYPE ANY,
<GV_VALUE> TYPE ANY.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
TABNAME = P_TAB
* FIELDNAME = ' '
* LANGU = SY-LANGU
* LFIELDNAME = ' '
* ALL_TYPES = ' '
* GROUP_NAMES = ' '
* UCLEN =
* IMPORTING
* X030L_WA =
* DDOBJTYPE =
* DFIES_WA =
* LINES_DESCR =
TABLES
DFIES_TAB = GT_FIELDS
* FIXED_VALUES =
EXCEPTIONS
NOT_FOUND = 1
INTERNAL_ERROR = 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.
LOOP AT GT_FIELDS.
CLEAR GS_COMPONENTS.
GS_COMPONENTS-NAME = GT_FIELDS-FIELDNAME.
GS_COMPONENTS-TYPE ?= CL_ABAP_STRUCTDESCR=>DESCRIBE_BY_NAME( GT_FIELDS-ROLLNAME ).
APPEND GS_COMPONENTS TO GT_COMPONENTS.
ENDLOOP.
GO_LINE_TYPE = CL_ABAP_STRUCTDESCR=>CREATE( GT_COMPONENTS ).
GO_TABLE_DESC = CL_ABAP_TABLEDESCR=>CREATE( GO_LINE_TYPE ).
CREATE DATA: GR_TAB TYPE HANDLE GO_TABLE_DESC.
ASSIGN: GR_TAB->* TO <GT_TABLE>.
SELECT * FROM (P_TAB) APPENDING CORRESPONDING FIELDS OF TABLE <GT_TABLE>.
LOOP AT <GT_TABLE> ASSIGNING <GS_TABLE>.
NEW-LINE.
DO.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE <GS_TABLE> TO <GV_VALUE>.
IF SY-SUBRC NE '0'.
EXIT.
ENDIF.
WRITE : <GV_VALUE>.
ENDDO.
ENDLOOP. -
How to dynamic field insert into intenal table?
hi friends
this is my urgent requirements .... how to dynamic field insert into internal table if it possible please tell me
thanks & regards
pauldharmaHi,
Go through this
REPORT yusmm_text1 NO STANDARD PAGE HEADING
LINE-SIZE 199.
T A B L E S
TABLES: MARA,
MAKT,
THEAD.
GLOBAL TYPE-POOLS
TYPE-POOLS : SLIS.
GLOBAL TYPES
TYPES : BEGIN OF TP_FINAL,
MATNR TYPE MARA-MATNR,
BEGRU TYPE MARA-BEGRU,
MTART TYPE MARA-MTART,
MAKTX TYPE MAKT-MAKTX,
SPRAS TYPE MAKT-SPRAS,
LTXT(2000) TYPE C ,
SRNO TYPE N ,
END OF TP_FINAL.
TYPES : BEGIN OF TP_T002,
SPRAS TYPE T002-SPRAS,
LAISO TYPE T002-LAISO,
SRNO TYPE N ,
END OF TP_T002.
TYPES : BEGIN OF TP_MARA_MAKT,
MATNR TYPE MARA-MATNR,
BEGRU TYPE MARA-BEGRU,
MTART TYPE MARA-MTART,
SPRAS TYPE MAKT-SPRAS,
MAKTX TYPE MAKT-MAKTX,
END OF TP_MARA_MAKT.
Types: BEGIN OF tp_matnr,
matnr TYPE mara-matnr,
END OF tp_matnr.
GLOBAL ELEMENTARY VARIABLES
DATA : gv_date TYPE sy-datum.
DATA : gv_repid TYPE sy-repid.
DATA : g_var1(10) TYPE C.
DATA : gv_index TYPE sy-tabix.
DATA: gv_strg TYPE string,
gv_strg1(2000) TYPE C.
DATA : gv_lang TYPE sy-langu.
DATA : g_v(3) TYPE N .
DATA : gv_lines(3) TYPE N .
DATA : gv_var(3) TYPE N .
DATA : gv_var1(3) TYPE N.
DATA: gv_str TYPE STRING.
DATA: gv_str1 TYPE STRING.
DATA : gv_li TYPE I,
gv_lit TYPE I,
gv_lin TYPE I.
DATA: g_var11(3) TYPE N,
gv_li1(3) TYPE N,
g_var2(3) TYPE N.
DATA : gv_i1 TYPE I.
DATA : gv_i TYPE I.
DATA: gl_lenght TYPE I.
GLOBAL STRUCTURES
DATA: T_NEWTABLE TYPE REF TO DATA,
T_NEWLINE TYPE REF TO DATA,
T_FLDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
T_FLDCAT TYPE LVC_T_FCAT,
WA_IT_FLDCAT TYPE LVC_S_FCAT,
WA_IT_FLDCAT1 TYPE SLIS_FIELDCAT_ALV,
WA_COLNO(2) TYPE N,
WA_FLNAME(5) TYPE C,
L_LT TYPE SLIS_LAYOUT_ALV.
GLOBAL INTERNAL TABLES (WITH INCLUDE STRUCTURE)
DATA : IG_MARA_MAKT TYPE STANDARD TABLE OF TP_MARA_MAKT,
WG_MARA_MAKT TYPE TP_MARA_MAKT.
DATA : IG_T002 TYPE STANDARD TABLE OF TP_T002,
WG_T002 TYPE TP_T002.
DATA : IG_FINAL TYPE STANDARD TABLE OF TP_FINAL,
WG_FINAL TYPE TP_FINAL.
data : IG_MATNR TYPE STANDARD TABLE OF TP_MATNR WITH HEADER LINE,
WG_MATNR TYPE TP_MATNR.
DATA:BEGIN OF IG_THEAD OCCURS 0.
INCLUDE STRUCTURE THEAD .
DATA: END OF IG_THEAD.
DATA:BEGIN OF IG_TLINE OCCURS 0.
INCLUDE STRUCTURE TLINE .
DATA:END OF IG_TLINE.
FIELD-SYMBOLS
FIELD-SYMBOLS: <T_DYNTABLE> TYPE STANDARD TABLE,"Dynamic internal
"tablename
<FS_DYNTABLE>, "Field symbol to create work area
<FS_FLDVAL> TYPE ANY. " Field symbol to assign values
COMPULSORY
FIELD-SYMBOLS: <FS_DATA> TYPE REF TO DATA,
<FS_DATA1> TYPE REF TO DATA,
<FS_2> TYPE STANDARD TABLE,
<FS_22> TYPE STANDARD TABLE,
<FS_1>,
<FS_11>,
<F>,
<FA>,
<LWA_LINE_WA>,
<LWA_LINE_WA1>.
------- Create Dyn Table From FC
DATA: LT_DATA TYPE REF TO DATA,
LT_DATA1 TYPE REF TO DATA,
LWA_LINE TYPE REF TO DATA,
LWA_LINE1 TYPE REF TO DATA,
LI_FIELD_CAT TYPE LVC_T_FCAT,
LWA_FIELD_CAT TYPE LVC_S_FCAT.
PARAMETERS & SELECT-OPTIONS
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_SPRAS FOR MAKT-SPRAS NO INTERVALS DEFAULT 'EN'
OBLIGATORY ,
S_MATNR FOR MARA-MATNR,
S_MTART FOR MARA-MTART.
PARAMETERS: GP_SIZE TYPE I DEFAULT '200'.
SELECTION-SCREEN : END OF BLOCK B1.
INITIALIZATION
INITIALIZATION.
gv_repid = sy-repid.
gv_date = sy-datum.
AT SELECTION-SCREEN
AT SELECTION-SCREEN.
IF GP_SIZE < 0.
MESSAGE E002(00).
ENDIF.
IF GP_SIZE > 50000.
MESSAGE W130(26) WITH TEXT-004.
SET CURSOR FIELD 'gp_size'.
ENDIF.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM FIELDCAT.
PERFORM LAYOUT.
PERFORM DATA_FETCH.
PERFORM READ_DATA_TO_FINAL.
SORT ig_final BY matnr spras.
gv_lin = gv_li.
gv_li = gv_li - 2.
LOOP AT ig_final INTO wg_final.
ASSIGN COMPONENT 1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = 'Material Number'.
ASSIGN COMPONENT 2 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = 'Authorization Group'.
g_VAR11 = wg_final-srno + 2.
gv_li1 = gv_li1 + 2.
MOVE : g_var11 TO gv_i1.
ASSIGN COMPONENT g_var11 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = 'MatDesc'.
g_var2 = g_var11 + gv_lines.
ASSIGN COMPONENT g_var2 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = 'BasicData'.
APPEND <LWA_LINE_WA1> TO <FS_22>.
EXIT.
ENDLOOP.
LOOP AT ig_final INTO wg_final.
AT NEW matnr.
gv_index = sy-tabix.
ASSIGN COMPONENT 1 OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = wg_final-matnr.
ENDAT.
AT NEW MATNR.
GV_INDEX = SY-TABIX.
ASSIGN COMPONENT 1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = wg_final-matnr.
ENDAT.
ASSIGN COMPONENT 2 OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = wg_final-begru.
ASSIGN COMPONENT 2 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = wg_final-begru.
gv_var = wg_final-srno + 2.
gv_li = gv_li + 2.
MOVE : gv_var TO gv_i.
ASSIGN COMPONENT gv_var OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = wg_final-maktx.
ASSIGN COMPONENT gv_var OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = wg_final-maktx.
gv_var1 = gv_var + gv_lines .
ASSIGN COMPONENT gv_var1 OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = wg_final-ltxt.
ASSIGN COMPONENT gv_var1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = wg_final-ltxt.
AT END OF matnr.
APPEND <LWA_LINE_WA> TO <FS_2>.
CLEAR <LWA_LINE_WA>.
ENDAT.
AT END OF matnr.
APPEND <LWA_LINE_WA1> TO <FS_22>.
CLEAR <LWA_LINE_WA1>.
ENDAT.
ENDLOOP.
PERFORM display..
*& Form data_fetch
text
--> p1 text
<-- p2 text
FORM DATA_FETCH .
SELECT matnr
from mara up to gp_size rows
appending corresponding fields of table ig_matnr
where matnr in s_matnr
and mtart in s_mtart.
loop at ig_matnr.
SELECT MARA~MATNR
MARA~BEGRU
MARA~MTART
MAKT~SPRAS
MAKT~MAKTX FROM MARA INNER JOIN MAKT
ON MARAMATNR = MAKTMATNR
appending corresponding fields of TABLE ig_mara_makt UP TO GP_SIZE
ROWS
WHERE makt~spras IN s_spras
AND mara~matnr IN s_matnr
AND mara~mtart IN s_mtart
AND mara~matnr EQ ig_matnr-matnr.
endloop.
IF sy-subrc = 0.
SORT ig_mara_makt.
ENDIF.
ENDFORM. " data_fetch
*& Form read_data_to_final
text
--> p1 text
<-- p2 text
FORM READ_DATA_TO_FINAL .
LOOP AT ig_mara_makt INTO wg_mara_makt .
wg_final-MATNR = wg_mara_makt-MATNR.
wg_final-BEGRU = wg_mara_makt-BEGRU.
wg_final-MTART = wg_mara_makt-MTART.
wg_final-SPRAS = wg_mara_makt-SPRAS.
wg_final-MAKTX = wg_mara_makt-MAKTX.
READ TABLE ig_t002 INTO wg_t002 WITH KEY spras = wg_final-spras.
IF sy-subrc = 0.
wg_final-srno = wg_t002-srno.
ENDIF.
CLEAR ig_thead[].
ig_thead-TDOBJECT = 'MATERIAL'.
ig_thead-TDNAME = wg_final-matnr.
ig_thead-TDID = 'GRUN'.
ig_thead-TDSPRAS = wg_final-spras.
CALL FUNCTION 'TEXT_READ'
EXPORTING
I_HEADER = IG_THEAD
I_READONLY = 'X'
IMPORTING
E_HEADER = IG_THEAD
TABLES
T_LINES = IG_TLINE[]
EXCEPTIONS
NOTFOUND = 1.
IF sy-subrc EQ 0.
LOOP AT ig_tline.
gv_strg = ig_tline-tdline.
IF gv_strg1 <> ' '.
CONCATENATE gv_strg1 ';' gv_strg INTO gv_strg1.
ELSE.
gv_strg1 = gv_strg.
ENDIF.
ENDLOOP.
wg_final-ltxt = gv_strg1.
APPEND wg_final TO ig_final.
CLEAR wg_final.
gv_strg1 = ' '.
ELSE.
APPEND wg_final TO ig_final.
ENDIF.
ENDLOOP.
ENDFORM. " read_data_to_final
" read_data_to_final
*& Form layout
text
--> p1 text
<-- p2 text
FORM LAYOUT .
CLEAR L_LT.
L_LT-ZEBRA = 'X'.
L_LT-COLWIDTH_OPTIMIZE = 'X'.
L_LT-WINDOW_TITLEBAR = 'MATERIAL DETAILS'.
ENDFORM. " layout
*& Form fieldcat
text
--> p1 text
<-- p2 text
FORM FIELDCAT .
SELECT SPRAS
LAISO FROM t002 INTO CORRESPONDING FIELDS OF TABLE ig_t002
WHERE spras IN s_spras.
DESCRIBE TABLE ig_t002 LINES gv_lines.
LOOP AT ig_t002 INTO wg_t002.
g_v = g_v + 1.
Wg_t002-srno = g_v.
MODIFY ig_t002 FROM wg_t002 TRANSPORTING SRNO.
ENDLOOP.
LOOP AT ig_t002 INTO wg_t002.
CLEAR WA_IT_FLDCAT.
MOVE SY-INDEX TO WA_COLNO.
CONCATENATE 'MD-' wg_t002-LAISO
WA_COLNO
INTO WA_FLNAME.
WA_IT_FLDCAT-FIELDNAME = WA_FLNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = WA_FLNAME.
WA_IT_FLDCAT-INTLEN = 250.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
APPEND WA_IT_FLDCAT TO T_FLDCAT.
CLEAR wg_t002.
ENDLOOP.
LOOP AT ig_t002 INTO wg_t002.
CLEAR WA_IT_FLDCAT.
MOVE SY-INDEX TO WA_COLNO.
CONCATENATE 'BD-' wg_t002-LAISO
WA_COLNO
INTO WA_FLNAME.
WA_IT_FLDCAT-FIELDNAME = WA_FLNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = WA_FLNAME.
WA_IT_FLDCAT-INTLEN = 250.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
APPEND WA_IT_FLDCAT TO T_FLDCAT.
CLEAR wg_t002.
ENDLOOP.
MOVE 'MATNR' TO WA_FLNAME.
WA_IT_FLDCAT-FIELDNAME = WA_FLNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = 'Material No'.
WA_IT_FLDCAT-INTLEN = 18.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
INSERT WA_IT_FLDCAT INTO T_FLDCAT INDEX 1.
MOVE 'BEGRU' TO WA_FLNAME.
WA_IT_FLDCAT-FIELDNAME = WA_FLNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = 'Authorization Group'.
WA_IT_FLDCAT-INTLEN = 4.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
INSERT WA_IT_FLDCAT INTO T_FLDCAT INDEX 2.
DESCRIBE TABLE T_FLDCAT LINES gv_li.
ASSIGN LT_DATA TO <FS_DATA>.
Creating the Dynamic Internal Table
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = T_FLDCAT " Fieldcatalogue
IMPORTING
EP_TABLE = <FS_DATA> " Dynamic Internal Table
EXCEPTIONS
GENERATE_SUBPOOL_DIR_FULL = 1
OTHERS = 2.
Assign Dyn Table To Field Sumbol
ASSIGN <FS_DATA>->* TO <FS_1>.
Assigning the Internal Table TYPE ANY to Standard internal Table
ASSIGN <FS_1> TO <FS_2>.
Creating a Workarea
CREATE DATA LWA_LINE LIKE LINE OF <FS_2> .
Assigning the Content to the workares as a Pointer
ASSIGN LWA_LINE->* TO <LWA_LINE_WA>.
LOOP AT T_FLDCAT INTO WA_IT_FLDCAT.
WA_IT_FLDCAT1-FIELDNAME = WA_IT_FLDCAT-FIELDNAME.
WA_IT_FLDCAT1-TABNAME = WA_IT_FLDCAT-TABNAME.
WA_IT_FLDCAT1-SELTEXT_L = WA_IT_FLDCAT-SELTEXT.
WA_IT_FLDCAT1-REF_TABNAME = 'MARC'.
APPEND WA_IT_FLDCAT1 TO T_FLDCAT1.
CLEAR : WA_IT_FLDCAT,WA_IT_FLDCAT1.
ENDLOOP.
ASSIGN LT_DATA1 TO <FS_DATA1>.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = T_FLDCAT " Fieldcatalogue
IMPORTING
EP_TABLE = <FS_DATA1> " Dynamic Internal table
EXCEPTIONS
GENERATE_SUBPOOL_DIR_FULL = 1
OTHERS = 2.
Assign Dyn Table To Field Sumbol
ASSIGN <FS_DATA1>->* TO <FS_11>.
Assigning the Internal Table TYPE ANY to Standard internal Table
ASSIGN <FS_11> TO <FS_22>.
Creating a Workarea
CREATE DATA LWA_LINE1 LIKE LINE OF <FS_22> .
Assigning the Content to the workares as a Pointer
ASSIGN LWA_LINE1->* TO <LWA_LINE_WA1>.
ENDFORM. " fieldcat
*& Form show
text
--> p1 text
<-- p2 text
FORM Display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = GV_REPID
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_SET'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = L_LT
IT_FIELDCAT = T_FLDCAT1[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = <FS_2>
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.
ENDFORM. " display
FORM PF_STATUS_SET USING RS_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'DISPLAY' .
ENDFORM. "PF_STATUS_SET
*& Form Name: user_command *
*& Form Desc: For Handling USER_COMMAND *
FORM USER_COMMAND USING IF_UCOMM TYPE SY-UCOMM
IS_SELFIELD TYPE SLIS_SELFIELD.
CASE IF_UCOMM.
WHEN 'DOWNLOAD'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = ' '
DIAGNOSE_OBJECT = ' '
TEXT_QUESTION = 'Data download to excel'
TEXT_BUTTON_1 = 'Ja'(001)
ICON_BUTTON_1 = ' '
TEXT_BUTTON_2 = 'Nein'(002)
ICON_BUTTON_2 = ' '
DEFAULT_BUTTON = '1'
DISPLAY_CANCEL_BUTTON = 'X'
USERDEFINED_F1_HELP = ' '
START_COLUMN = 25
START_ROW = 6
POPUP_TYPE =
IMPORTING
ANSWER =
TABLES
PARAMETER =
EXCEPTIONS
TEXT_NOT_FOUND = 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.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'C:\Material-Text.xls'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = 'X'
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = 'X'
IMPORTING
FILELENGTH = GL_LENGHT
TABLES
DATA_TAB = <FS_22>
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.
IF GL_LENGHT NE 0.
MESSAGE S398(00) WITH 'DATA downloaded to EXCEL'.
ENDIF.
Thanks
ENDCASE.
ENDFORM. "user_command
Maybe you are looking for
-
Reading FlashVars in SWF File.
I do have a question in regards to FlashVars and how you test for the existance of a certain value inside a SWF movie? This code right here works fine for me. if (_level0.myURL == undefined) { else { pflipper.gotoPage(3); gotoAndStop(1); However, it
-
Difficulty Importing a Properly Sized TIFF image (I think)
Hello, I am having difficulty importing an appropriately sized TIFF image that is a screen shot from my film. It seems to be a resizing issue of some sort. The TIFF image is a straight frame grab from my film, which is sized 1920 x 1080. here is the
-
How to see the generic users in 11.5.10 which have not been enddated
Hi all, Can anybody let me know how to see the generic users in 11.5.10 who are not enddated? Thanks.
-
Period (.) appearing at end of position displays
Hello I've noticed that sometimes a period (.) is appearing at the end of position displays in the transport and event lists. eg 4 1 2 156. this can occur no matter how many digits are in the last number eg 4 1 2 1. Does this mean that some informati
-
Hi there. I recently added some data to my capped plan mobile phone and want to remove the added data. So it was 2GB usage and I made it 2.2GB but I want to go back to 2GB. Anyone know where/how to do this please :/