Dynamic Select in FOR REC IN (SELECT
Hello Guys,
We are trying to use dynamic select statement in FOR REC IN based on certain parameter. But does not compile with following error message.
209/10 PLS-00103: Encountered the symbol "END" when expecting one of the following:
loop
Could some one let us know how this can be achieved, may be with an example. Thankis in advance. Here is the sample code:
IF pPROCESS_BY = 'ALL' THEN
FOR REC IN (SELECT LSP.HAZMNP_SEQ_NO,
LSP.LSP_START_DATE,
LSP.LSP_END_DATE,
LSP.LSP_OST,
LSP.LSP_DBI,
LSP.LSP_DBI_FREQUENCY_PERIIOD,
LSP.LSP_DBI_RETENTION_PERIOD,
LSP.LSP_DBI_RETENTION_FREQUENCY,
LSP.LSP_ENDURANCE_LEVEL,
LSP.LSP_RDE_PERIOD1,
LSP.LSP_RDE_PERIOD2,
LSP.LSP_RDE_PERIOD3,
LSP.LSP_RDE_PERIOD4,
LSP.LSP_EXCLUDED_ACTIVITIES,
LSP.LSP_SEQ_NO
FROM LEVEL_SET_PARAM LSP
WHERE LSP.LSP_PROCESS_ALL_NIINS = 'Y'
AND LSP.LSP_IS_ALL_NIINS_PROCESSED = 'N'
AND LSP.HAZMNP_SEQ_NO = pHAZMINSEQNO
AND ROWNUM = 1
ORDER BY LSP_SEQ_NO DESC)
END IF;
IF pPROCESS_BY = 'SPN' THEN
FOR REC IN (SELECT LSP.HAZMNP_SEQ_NO,
LSP.LSP_START_DATE,
LSP.LSP_END_DATE,
LSP.LSP_OST,
LSP.LSP_DBI,
LSP.LSP_DBI_FREQUENCY_PERIIOD,
LSP.LSP_DBI_RETENTION_PERIOD,
LSP.LSP_DBI_RETENTION_FREQUENCY,
LSP.LSP_ENDURANCE_LEVEL,
LSP.LSP_RDE_PERIOD1,
LSP.LSP_RDE_PERIOD2,
LSP.LSP_RDE_PERIOD3,
LSP.LSP_RDE_PERIOD4,
LSP.LSP_EXCLUDED_ACTIVITIES,
LSP.LSP_SEQ_NO
FROM LEVEL_SET_PARAM LSP
WHERE LSP.HAZMNP_SEQ_NO = pHAZMINSEQNO
AND LSP.LSP_SPECIFIC_NIIN = pSPECIFIC_NIIN
AND ROWNUM = 1
ORDER BY LSP_SEQ_NO DESC)
END IF;
LOOP
You need to use cursor variables if you want to process result sets based on different query statements.
For more information and a sample see
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/06_ora.htm#1510
Similar Messages
-
Dynamic table field for filtering a selection criteria
Hi Friends
I am using a table a981 and fetching data in internal table but the table has a fieil Country whose technical name is ALAND in dev and LAND1 in production.Now i cannot use LAND1 as it wont let me to activate the report and if i use ALAND i cannot move the request to production as it fails. So how can i achive dynamic table field in the select query based on server.My query is-
select kschl
wkreg
matnr
knumh
from a981 into corresponding fields of table it_a981
for all entries in it_marc where matnr = it_marc-matnr
and kschl in ('MWST','ZSER')
and aland = 'IN'
and datab le sy-datum
and datbi ge sy-datum.
I need to make aland dynamic.Pls suggestHi,
this forum is for the BusinessObjects Integration Kit for SAP but I don't see how you entry is related to it.
Ingo -
Select query for fields in selection screen
SELECT * FROM hrus_d2
INTO TABLE ta_list
WHERE us_name IN subs_obj
and begdat in date_ran.
and enddat in date_ran
How can I rewrite the above query for high and low ranges of date_ran field in condition? It doesn't allow in operator with date_ran-low.Can u please help me outHi
rahul
SELECT *
FROM hrus_d2
INTO TABLE ta_list
WHERE us_name IN subs_obj
and begdat = date_ran-low
and enddat = date_ran -high.
u can write like this or i amnot getting why u r expliciting this date u can give directly as
SELECT *
FROM hrus_d2
INTO TABLE ta_list
WHERE us_name IN subs_obj
date in date_ran.
plzz reward if i am usefull to u in any way.. plzz dont forget to reward -
Querying many tables at once from a select statement for specific values
Hi all,
I'm very new to PL/SQL and have a daunting task ahead of me. I'm pretty sure our database normalization scheme is all out of whack, which I dont have the experience to fix yet, but this is the task ahead of me without getting to change or fix our structure:
in the universe has 1000+ tables.
need--> Some of those tables have fields that contain a value that has to be changed.
The only thing I have to go on is the column name will contain 'EMP'... but there is no specific naming convention for the column names.
When I search on:
select * from all_tab_columns where column_name like UPPER('%EMP%')
It returns 750 rows. (So 750 rows = 750 columns in 500 different tables (some tables have 2 or more columns in it))
tables names are random (table1, table2, etc).
columns names are random with EMP in it (column1,column2,etc).
I have 75 possible field values that I need to check each of those 750 columns for.
Maybe this is too messy, but I'm looking at subqueries, joins, arrays, cursors, etc, anything to minimize the amount of work I have to do.
I think this is too much to do a join with, but that seems to be what all the documentation is pointing me to.
can you point me to a simple example of what i could
write?
the logic i see it would be
run the select statement to grab the column names that meet EMP.
one at a time, search each column in the corresponding table for the 75 values.
return the results of rows for each column/table that meet one of the 75 unique values.
I'll have to also update each of the 75 values to (used to be values 1, 2, 3 ... to new values X1, X2, X3, etc.)
Any help at all would be very helpful,
aspiring pl/sql programmer but having a rough time of itI think you're looking to do something like the following pseudocode:
BEGIN
FOR tblrec IN (SELECT table_name, column_name
FROM all_tab_columns
WHERE column_name LIKE '%EMP%')
LOOP
FOR rec IN (SELECT ROWID
FROM tblrec.table_name
WHERE REGEXP_LIKE(tblrec.column_name, '(expr1|expr2|...)')
LOOP
DBMS_OUTPUT.PUT_LINE(
'Found expression on ROWID ' || rec.rowid
|| ' in column ' || tblrec.column_name
|| ' on table ' || tblrec.table_name);
END LOOP;
END LOOP;
END; -
Restrict Select-Options for Logical Database field
The way we restrict select options for custom defined select option fields on selection screen.. can we restrict select options for standard Logical Database fields?
i.e. report uses PNPCE logical database and has field called PERNR. I want to restrict select options for this PERNR field so that it has options for 'Select single values' only.
Thanks,
Falguni
Edited by: Falguni V on Nov 13, 2010 6:42 AMYou can user AT SELECTION-SCREEN event, and check whether any record is having high value for PNPPERNR.
-
How to write Select statement for this codition
I need to check whether SGTXT contains BELNR value.
SGTXT is a text field and It should be matched with BELNR
How to write select statement for this.
Select AUGBL AUGDT into t_BSAD
from BSAD
where SGTXT should have the given BELNR Value.
Plz note : Here I cannot give as SGTXT = BELNR as coz BELNR have only 10 digits.Hi,
data temp(12).
concatenate '%' belnr '%' into temp.
Select AUGBL AUGDT into t_BSAD
from BSAD
where SGTXT like temp.
If belnr is having multiple values,just create a internal table as follows.
types : begin of ty,
belnr....
temp(12),
end of ty.
data itab_ type standard table of ty.
data wa type ty.
loop at itab into wa.
concatenate '%' wa-belnr '%' into wa-temp.
modify itab from wa index sy-tabix transporting temp.
endloop.
Change your select statement accordingly.
Kindly reward poits if it helps. -
Where/what is the "command" button to select pictures for emailing?
Select the photos in the grid. For a continous set, click the first photo, then shift click the last to select all the intermediate photos. Command (Mac) or Control (PC) click to add individual photos. Then go to File>Email Photo to open the Email dialog.
-
Due to MODIF ID, SELECT query in START-OF-SELECTION not getting triggered
Dear SAP Gurus,
I'm stuck with this program, where, my program is not being executed, as in, my SELECT query in my event START-OF-SELECTION is not getting triggered. Since i hav used MODIF ID, for SELECT-OPTIONS, even after putting the entries in select-options...................when i click on the execute button, or press F8, the program still goes into the AT SELECTION-SCREEN OUTPUT event..........but i want it to goto START-OF-SELECTION event where my SELECT query is........what should i do??????????????
Please find the notepad file having the code, n exucse me for any selection-texts absence.
Need help from u in this issue.
Thanks in advance.
REPORT ZPPR_CONVSTAT NO STANDARD PAGE HEADING.
INCLUDE ZPPR_CONVSTAT_TOP. " data declaration
INCLUDE ZPPR_CONVSTAT_SEL_CRITERIA. " selection criteria
INCLUDE ZPPR_CONVSTAT_PBO. " event at selection-screen output
INCLUDE ZPPR_CONVSTAT_START_SELECTION. " event start-of-selection
INCLUDE ZPPR_CONVSTAT_F_START_OF_SEL.
*& Include ZPPR_CONVSTAT_TOP
TABLES : VBUK,
VBUP,
VBAK,
VBAP,
VBEP,
VBPA,
TVAK,
EKUB,
LIKP,
LIPS,
MARA,
MAKT,
MARC,
PLAF,
AUFK,
AFKO,
AFPO,
AFVC,
AFVV,
CRHD,
PBIM,
KNA1,
T134,
IOHEADER,
IOITEM.
TYPE-POOLS : slis.
TYPES : BEGIN OF ty_final,
werks TYPE vbap-werks, "Plant
auart TYPE vbak-auart, "Sales Order Doc. type
erdat TYPE vbak-erdat, "Sales Order Creation date
vbeln TYPE vbak-vbeln, "Sales Order No.
posnr TYPE vbap-posnr, "Sales Order Item No.
aedat TYPE vbak-aedat, "Sales Order Change Date
kwmeng TYPE vbap-kwmeng, "Sales Order qty.
vdatu TYPE vbak-vdatu, "Requested Delivery Date
lfimg TYPE lips-lfimg, "Sales Order Delivered Qty.
matnr TYPE vbap-matnr, "Material ID
arktx TYPE vbap-arktx, "Material Description
strgr TYPE marc-strgr, "Planning Strategy
vrkme TYPE vbap-vrkme, "UOM
plnum TYPE plaf-plnum, "Plan Order No.
gsmng TYPE plaf-gsmng, "Plan Order Qty.
auffx TYPE plaf-auffx, "Plan Order Firming Indicator u2013 Qty.
stlfx TYPE plaf-stlfx, "Plan Order Firming Indicator - Component
erdat2 TYPE aufk-erdat, "Production Order Creation Date
aufnr TYPE aufk-aufnr, "Production Order No.
prdqty TYPE afko-gamng, "Production Order qty.
pckqty TYPE lips-lfimg, "Packed Delivered Qty.
psamg TYPE afpo-psamg, "Allotted scrap
igmng TYPE afko-igmng, "Confirmed Yield Qty.
iasmg TYPE afko-iasmg, "Confirmed Scrap Qty
iamng TYPE afpo-iamng, "Expected Yield
wemng TYPE afpo-wemng, "Delivered Qty.
altscrp TYPE c LENGTH 6, "Allotted Scrap %
actscrp TYPE c LENGTH 6, "Actual Scrap %
umrez TYPE afvv-umrez, "Ups (from Prd. ORD)
ups TYPE clobjdat-ausp1, "Ups (from Material Master)
crtnstl TYPE clobjdat-ausp1, "Carton Style
ppopr TYPE clobjdat-ausp1, "Pre-Printing Operation
brdtyp TYPE clobjdat-ausp1, "Board Type
lsdim1 TYPE clobjdat-ausp1, "Layout Size u2013 Dim 1
lsdim2 TYPE clobjdat-ausp1, "Layout Size u2013 Dim 2
lsgsm TYPE clobjdat-ausp1, "GSM
inktyp TYPE clobjdat-ausp1, "Ink Type
foiltyp TYPE clobjdat-ausp1, "Foiling
wintyp TYPE clobjdat-ausp1, "Window Type
lamin TYPE clobjdat-ausp1, "Lamination
fsvrnsh TYPE clobjdat-ausp1, "Front Side Varnish
bsvrnsh TYPE clobjdat-ausp1, "Back Side Varnish
emboss TYPE clobjdat-ausp1, "Embossing
punch TYPE clobjdat-ausp1, "Punching
paste TYPE clobjdat-ausp1, "Pasting
oprno TYPE afvc-vornr, "Operation No.
wrkcntr TYPE crhd-arbpl, "Work Centre
oprtxt TYPE afvc-ltxa1, "Operation Text
oprqty TYPE afvv-mgvrg, "Operation qty.
yield TYPE afvv-lmnga, "Yield
scrap TYPE afvv-xmnga, "Scrap
jobtyp TYPE vbak-augru, "Job Type
prordst TYPE bsvx-sttxt, "Production Order Status
solinst TYPE vbup-lfsta, "Sales Order Line Item Status
sldprty TYPE kna1-name1, "Sold to Party Name
shpprty TYPE kna1-name1, "Ship to Party Name
shpcity TYPE kna1-ort01, "Ship to party - City
END OF ty_final.
TYPES : BEGIN OF ty_vbak,
auart TYPE vbak-auart,
erdat TYPE vbak-erdat, "Doc creation date
vbeln TYPE vbak-vbeln,
aedat TYPE vbak-aedat, "Doc change date
vdatu TYPE vbak-vdatu, "Requested delivery date
kunnr TYPE vbak-kunnr,
augru TYPE vbak-augru, "Job Type
END OF ty_vbak.
TYPES : BEGIN OF ty_vbap,
vbeln TYPE vbap-vbeln,
posnr TYPE vbap-posnr,
werks TYPE vbap-werks,
matnr TYPE vbap-matnr,
arktx TYPE vbap-arktx,
kwmeng TYPE vbap-kwmeng,
vrkme TYPE vbap-vrkme,
END OF ty_vbap.
TYPES : BEGIN OF ty_pbim,
pbdnr TYPE pbim-pbdnr, "Requirements Plan Number
bdzei TYPE pbim-bdzei, "Independent requirements pointer
matnr TYPE pbim-matnr,
werks TYPE pbim-werks,
END OF ty_pbim.
TYPES : BEGIN OF ty_pbhi,
bdzei TYPE pbhi-bdzei, "Independent requirements pointer
pdatu TYPE pbhi-pdatu, "Requirement date
laeda TYPE pbhi-laeda, "Date of Last Change
END OF ty_pbhi.
TYPES : BEGIN OF ty_ekko,
ebeln TYPE ekko-ebeln, "STO doc no
bsart TYPE ekko-bsart,
reswk TYPE ekko-reswk, "Supplying plant
aedat TYPE ekko-aedat, "Doc creation date
END OF ty_ekko.
TYPES : BEGIN OF ty_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
aedat TYPE ekpo-aedat, "Doc change date
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
matnr TYPE ekpo-matnr,
txz01 TYPE ekpo-txz01,
END OF ty_ekpo.
TYPES : BEGIN OF ty_eket,
ebeln TYPE eket-ebeln,
ebelp TYPE eket-ebelp,
eindt TYPE eket-eindt, "Requested delivery date
END OF ty_eket.
TYPES : BEGIN OF ty_lips,
vbeln TYPE lips-vbeln,
posnr TYPE lips-posnr,
vgbel TYPE lips-vgbel,
vgpos TYPE lips-vgpos,
lfimg TYPE lips-lfimg,
END OF ty_lips.
TYPES : BEGIN OF ty_plaf,
plnum TYPE plaf-plnum,
matnr TYPE plaf-matnr,
gsmng TYPE plaf-gsmng,
auffx TYPE plaf-auffx,
stlfx TYPE plaf-stlfx,
kdauf TYPE plaf-kdauf,
kdpos TYPE plaf-kdpos,
pbdnr TYPE plaf-pbdnr,
END OF ty_plaf.
TYPES : BEGIN OF ty_aufk,
aufnr TYPE aufk-aufnr,
erdat TYPE aufk-erdat,
objnr TYPE aufk-objnr,
END OF ty_aufk.
TYPES : BEGIN OF ty_afko,
aufnr TYPE afko-aufnr,
gamng TYPE afko-gamng, "Total order quantity
gasmg TYPE afko-gasmg, "Total scrap quantity in the order
igmng TYPE afko-igmng, "Confirmed Yield Qty
iasmg TYPE afko-iasmg, "Confirmed Scrap Qty
aufpl TYPE afko-aufpl, "Routing number of operations in the order
END OF ty_afko.
TYPES : BEGIN OF ty_afpo,
aufnr TYPE afpo-aufnr,
plnum TYPE afpo-plnum,
matnr TYPE afpo-matnr,
pgmng TYPE afpo-pgmng, "Plan Order Qty
kdauf TYPE afpo-kdauf,
kdpos TYPE afpo-kdpos,
psamg TYPE afpo-psamg, "Allotted scrap
iamng TYPE afpo-iamng, "Expected Yield Variance
wemng TYPE afpo-wemng, "Delivered Qty
END OF ty_afpo.
TYPES : BEGIN OF ty_afvc,
vornr TYPE afvc-vornr,
aufpl TYPE afvc-aufpl, "Routing number of operations in the order
aplzl TYPE afvc-aplzl, "General counter for order
arbid TYPE afvc-arbid, "Object ID of the resource
ltxa1 TYPE afvc-ltxa1,
END OF ty_afvc.
TYPES : BEGIN OF ty_afvv,
aufpl TYPE afvv-aufpl, "Routing number of operations in the order
aplzl TYPE afvv-aplzl, "General counter for order
umrez TYPE afvv-umrez,
mgvrg TYPE afvv-mgvrg,
lmnga TYPE afvv-lmnga,
xmnga TYPE afvv-xmnga,
END OF ty_afvv.
TYPES : BEGIN OF ty_mdvm,
mdkey TYPE mdvm-mdkey,
disst TYPE mdkp-disst,
matnr TYPE mdkp-matnr,
plwrk TYPE mdkp-plwrk,
END OF ty_mdvm.
DATA : it_final TYPE STANDARD TABLE OF ty_final,
it_vbak TYPE STANDARD TABLE OF ty_vbak,
it_vbap TYPE STANDARD TABLE OF ty_vbap,
it_lips TYPE STANDARD TABLE OF ty_lips,
it_pbim TYPE STANDARD TABLE OF ty_pbim,
it_pbhi TYPE STANDARD TABLE OF ty_pbhi,
it_ekko TYPE STANDARD TABLE OF ty_ekko,
it_ekpo TYPE STANDARD TABLE OF ty_ekpo,
it_eket TYPE STANDARD TABLE OF ty_eket,
it_plaf TYPE STANDARD TABLE OF ty_plaf,
it_aufk TYPE STANDARD TABLE OF ty_aufk,
it_afko TYPE STANDARD TABLE OF ty_afko,
it_afpo TYPE STANDARD TABLE OF ty_afpo,
it_afvc TYPE STANDARD TABLE OF ty_afvc,
it_afvv TYPE STANDARD TABLE OF ty_afvv,
it_mdvm TYPE STANDARD TABLE OF ty_mdvm.
DATA : wa_final TYPE ty_final,
wa_vbak TYPE ty_vbak,
wa_vbap TYPE ty_vbap,
wa_lips TYPE ty_lips,
wa_pbim TYPE ty_pbim,
wa_pbhi TYPE ty_pbhi,
wa_ekko TYPE ty_ekko,
wa_ekpo TYPE ty_ekpo,
wa_eket TYPE ty_eket,
wa_plaf TYPE ty_plaf,
wa_aufk TYPE ty_aufk,
wa_afko TYPE ty_afko,
wa_afpo TYPE ty_afpo,
wa_afvc TYPE ty_afvc,
wa_afvv TYPE ty_afvv,
wa_mdvm TYPE ty_mdvm.
DATA : it_object TYPE hum_object_t,
wa_object TYPE hum_object,
it_item TYPE hum_hu_item_t,
wa_item TYPE vepovb,
count1(6) TYPE n.
DATA : gv_objek TYPE ausp-objek. "Put matnr for use in FM u2018CLAF_CLASSIFICATION_OF_OBJECTSu2019
DATA : BEGIN OF it_sclass OCCURS 0.
INCLUDE STRUCTURE sclass.
DATA : END OF it_sclass.
DATA : BEGIN OF it_clobjdat OCCURS 0.
INCLUDE STRUCTURE clobjdat.
DATA : END OF it_clobjdat.
*& Include ZPPR_CONVSTAT_SEL_CRITERIA
SELECTION-SCREEN FOR 'PLANNING STAGE'
SELECTION-SCREEN BEGIN OF BLOCK main WITH FRAME TITLE text-001.
PARAMETERS: mrpntdn RADIOBUTTON GROUP sel DEFAULT 'X' user-command flag,
pldord RADIOBUTTON GROUP sel,
prdord RADIOBUTTON GROUP sel.
SELECTION-SCREEN END OF BLOCK main.
SELECTION-SCREEN FOR 'SELECTION BY PLANT AND PLANT DATA'
SELECTION-SCREEN BEGIN OF BLOCK plant WITH FRAME TITLE text-002.
PARAMETERS : p_werks LIKE ioheader-werks OBLIGATORY DEFAULT '1100' MATCHCODE OBJECT H_T001W.
SELECT-OPTIONS : so_matnr FOR ioitem-matnr MATCHCODE OBJECT MAT1.
PARAMETERS : so_mtart TYPE t134-mtart OBLIGATORY DEFAULT 'ZFIN' MATCHCODE OBJECT H_T134.
SELECT-OPTIONS : so_plnum FOR ioitem-plnum MATCHCODE OBJECT plnum MODIF ID pld,
so_aufnr FOR ioheader-aufnr MATCHCODE OBJECT orde MODIF ID prd.
PARAMETERS : p_prdsta LIKE tj02t-txt04 MODIF ID prd.
SELECTION-SCREEN END OF BLOCK plant.
SELECTION-SCREEN FOR 'SELECTION BY REQUIREMENT TYPE'
SELECTION-SCREEN BEGIN OF BLOCK reqtyp WITH FRAME TITLE text-003.
PARAMETERS : cb_so TYPE AUSWL_EB AS CHECKBOX USER-COMMAND flag,
cb_sto TYPE AUSWL_EB AS CHECKBOX USER-COMMAND flag,
cb_pir TYPE AUSWL_EB AS CHECKBOX USER-COMMAND flag.
SELECTION-SCREEN END OF BLOCK reqtyp.
SELECTION-SCREEN FOR 'SELECTION BY DATE AND REQUIREMENT TYPE NOS'
SELECTION-SCREEN BEGIN OF BLOCK dtreqtypno WITH FRAME TITLE text-004.
SELECT-OPTIONS : so_crtdt FOR vbak-erdat MODIF ID gen,
so_vbeln FOR vbap-vbeln MATCHCODE OBJECT WTY_F4_VBAP MODIF ID rso,
so_posnr FOR vbap-posnr MODIF ID rso,
so_ebeln FOR ekub-ebeln MATCHCODE OBJECT MEKKM MODIF ID rst,
so_ebelp FOR ekub-ebelp MODIF ID rst,
so_pbdnr FOR pbim-pbdnr MODIF ID rpi,
so_reqdt FOR vbep-edatu MODIF ID gen.
SELECTION-SCREEN END OF BLOCK dtreqtypno.
SELECTION-SCREEN FOR 'SELECTION BY OTHER PARAMETERS'
SELECTION-SCREEN BEGIN OF BLOCK othrparam WITH FRAME TITLE text-005.
SELECT-OPTIONS : so_kunnr FOR kna1-kunnr MATCHCODE OBJECT debi MODIF ID rso,
so_auart FOR tvak-auart MATCHCODE OBJECT H_TVAK MODIF ID rso,
so_lfsta FOR vbup-lfsta MODIF ID rso.
SELECTION-SCREEN END OF BLOCK othrparam.
*& Include ZPPR_CONVSTAT_PBO
*& Event AT SELECTION-SCREEN OUTPUT
AT SELECTION-SCREEN OUTPUT.
IF mrpntdn = 'X'.
LOOP AT SCREEN.
IF ( screen-group1 = 'PLD' OR screen-group1 = 'PRD' ).
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF pldord = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'PLD'.
screen-intensified = 1.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'PRD'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF prdord = 'X'.
LOOP AT SCREEN.
IF ( screen-group1 = 'PLD' OR screen-group1 = 'PRD' ).
screen-intensified = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF ( cb_so = ' ' AND cb_sto = ' ' AND cb_pir = ' ' ).
LOOP AT SCREEN.
IF ( screen-group1 = 'GEN'
OR screen-group1 = 'RSO'
OR screen-group1 = 'RST'
OR screen-group1 = 'RPI' ).
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF cb_so = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'RSO'.
screen-active = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
IF cb_sto = ' '.
LOOP AT SCREEN.
IF screen-group1 = 'RST'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF cb_pir = ' '.
LOOP AT SCREEN.
IF screen-group1 = 'RPI'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ELSEIF cb_sto = 'X'.
IF cb_so = ' '.
LOOP AT SCREEN.
IF screen-group1 = 'RSO'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF cb_pir = ' '.
LOOP AT SCREEN.
IF screen-group1 = 'RPI'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ELSEIF cb_pir = 'X'.
IF cb_so = ' '.
LOOP AT SCREEN.
IF screen-group1 = 'RSO'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF cb_sto = ' '.
LOOP AT SCREEN.
IF screen-group1 = 'RST'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
*& Include ZPPR_CONVSTAT_START_SELECTION
*& Event START-OF-SELECTION
IF mrpntdn = 'X'.
PERFORM start_of_selection_mrpntdn.
ELSEIF pldord = 'X'.
PERFORM start_of_selection_pldord.
ELSEIF prdord = 'X'.
PERFORM start_of_selection_prdord.
ENDIF.
*& Include ZPPR_CONVSTAT_F_START_OF_SEL
*& Form START_OF_SELECTION
Subroutine for MRP NOT DONE
FORM start_of_selection_mrpntdn.
SELECT mdkey INTO TABLE it_mdvm FROM mdvm
WHERE GSAEN = 'X'
AND AKKEN = 'X'.
IF sy-subrc = 0.
LOOP AT it_mdvm INTO wa_mdvm.
wa_mdvm-disst = wa_mdvm-mdkey(3).
wa_mdvm-matnr = wa_mdvm-mdkey+3(18).
wa_mdvm-plwrk = wa_mdvm-mdkey+21(4).
MODIFY it_mdvm FROM wa_mdvm INDEX sy-index TRANSPORTING disst matnr plwrk.
ENDLOOP.
ENDIF.
ENDFORM.
*& Form START_OF_SELECTION
Subroutine for PLAN ORDER CREATED
FORM start_of_selection_pldord.
ENDFORM.
*& Form START_OF_SELECTION for PRODUCTION ORDER CREATED
Subroutine for PRODUCTION ORDER CREATED
FORM start_of_selection_prdord.
ENDFORM.You need to mention START-OF-SELECTION explicitly in your code.
Change your code as below:
*& Event START-OF-SELECTION
START-OF-SELECTION.
IF mrpntdn = 'X'. -
Dynamic SELECT with FOR ALL ENTRIES IN: take 2
Hello Xperts,
we are now having a bit of new trouble with the following SELECT ... special thanks to Raul and Suhas for their previous contributions.
FIELD-SYMBOLS:
<itab1> TYPE standard table.
ASSIGN ATTR_T_I->* TO <itab1>.
select
FIELD1
FIELD2
from DBTAB1
into CORRESPONDING FIELDS OF table <itab1>
FOR ALL ENTRIES IN <itab1>
where
(condition).
ATTR_T_I is a static attibute of type table containing 10 records where all records have FIELD1 and FIELD2 empty.
The select finds in DBTAB1 entries fulfilling the 'condition' for 8 of the above 10 records in ATTR_T_I.
Hence, after the select 8 of the 10 records in ATTR_T_I have the fields FIELD1 and FIELD2 filled (ie not empty).
So far so good!
BUT: the 2 remaining records (i.e. those without entries in DBTAB1 fullfilling 'condition') have been deleted! Why? This is not what we want nor expected.
Any ideas out there how to fix this?
Thanx!Martin Helmstein wrote:
> Yes, 'condition' contains all the key fields of DBTAB1.
Hi Martin,
It's not the Where condition fields i was talking about. I was referring to the Select fields, you have to SELECT all the keyfields when using FAE. Something like this:
SELECT key1 key2 ... keyn "all the key fields of the table
field1 field2 ... fieldn
FROM table
INTO CORRESPONDING FIELDS OF it_data
FOR ALL ENTRIES IN <itab>
WHERE (condition).
You can search in the forums for further details. It has been discussed many a times.
BR,
Suhas -
How Can i SEt Dynamic Variant For WEEK on SELECTION Screen.pls help me..
<b>Hi ALL..
Pls Help Me for this Problem..i am very confused how can i do that...plese tell me proper process..
i want set Dynamice Varient for WEEK on Selection screen..
I have ALrady SET Dynamice Varient for DATE on Selection Screen.ther isd option is D...but in case of WEEK there is a no option...
Plese help me..
thaks in advance..
pls help me..</b>Hello,
Define your select-option in TVARV (assume Z_THISWEEK). And use a program like:
DATA:
zlv_week TYPE KWEEK.
call function 'DATE_GET_WEEK'
exporting date = syst-datum
importing week = zlv_week.
SELECT SINGLE *
FROM tvarvc
WHERE name = 'Z_THISWEEK'
AND type = 'S'
AND numb = '0000'.
tvarvc-low = zlv_week.
IF syst-subrc <> 0.
tvarvc-name = 'Z_THISWEEK'.
tvarvc-type = 'S'.
tvarvc-opti = 'EQ'.
tvarvc-sign = 'I'.
tvarvc-numb = '0000'.
insert tvarvc.
ELSE.
update tvarc.
ENDIF.
Regards,
John. -
DYNP_VALUES_READ Limitations for multiple lines select options
Hi all !
First post here, but a tough one I think. Here is my inquiry :
I have worked on an specific abap function used in many long abap list reports. Theses reports are launched in background processing. The aim of this routine is to stop the report execution if a background job with the same selection parameters is already launched for the current user (to Prevent useless several launch of a time-expensive program).
Because this routine is dynamic, I read the selection screen of the current report with the function 'DYNP_VALUES_READ'. And I compare the result with the variant of the backgroung job (read with function 'RS_VARIANT_CONTENTS').
The real problem is that function "DYNP_VALUES_READ" only extract the first line of select-options. I found an alternative solution to extract the select options values (a dynamic assign with field symbols), but external conversions (for WBS elements for example ) are lost, so the comparison detects differences between the background job's variant values and the current selection screen values.
Does anybody know a way to get entire select options values from a selection screen just as they are displayed on screen ?
Thanks for reading my message
Message was edited by: Thomas BRICOUTThomas,
Perhaps the following code will help you. A function module in the code captures everything on the selection screen into an internal table. It doesn't actually capture the information the way you want it, but I believe you will be able to work with it to achieve your desired result. If it doesn't meet your needs, it is still useful for printing selection screen fields and their values.
Bruce
report zybttes2.
tables: zf137, " 137 General Ledger Document Details Table
zf137a. " 137 General Ledger Document Details Table, Archive
selection-screen begin of block b1 with frame title text-004." BCT003
parameters: p_zf137 radiobutton group xxx, " BCT003
p_zf137a radiobutton group xxx. " BCT003
selection-screen end of block b1. " BCT003
selection-screen begin of block parameter with frame title text-001.
selection-screen skip 1.
select-options: s_date for zf137-zzpostdat.
selection-screen skip 1.
selection-screen begin of line.
selection-screen comment 3(6) text-002.
selection-screen end of line.
selection-screen skip 1.
select-options: s_loan for zf137-zzloan.
selection-screen skip 1.
selection-screen begin of line.
selection-screen comment 3(6) text-003.
selection-screen end of line.
selection-screen skip 1.
select-options: s_ccentr for zf137-zzcostctr.
selection-screen skip 1.
selection-screen end of block parameter.
data: ww(3) type n.
data: zz(3) type c.
data: c1(1) type c value '0'.
do 2 times.
ww = ww + 1.
zz = ww. shift zz left deleting leading c1.
write: / zz.
enddo.
Capture and then print the selection screen fields and their values
data: begin of i_info occurs 20,
flag,
olength type x,
line like raldb-infoline,
end of i_info.
call function 'PRINT_SELECTIONS'
exporting
mode = 'TABLE'
rname = sy-cprog
rvariante = sy-slset
tables
infotab = i_info.
loop at i_info.
write: / i_info-line.
endloop.
write: / 'end'. -
How to add a checkbox to dynamic itab so that i can select some records
How to add a checkbox to dynamic itab so that i can select some records in the alv and can display them in another alv using a button
I have requirement where i have to display the dynamic itab records in an alv ....Some records from this alv output has to be selected through checkbox provided in the first column .( I will get to know the structure of the itab only at runtime ,so iam using dynamic itab)Hi,
I tried and finally i got it , Just try for it.
type-pools : slis.
PARAMETERS : p_tab type dd02l-tabname.
data : ref_tabletype type REF TO cl_abap_tabledescr,
ref_rowtype TYPE REF TO cl_abap_structdescr.
field-symbols : <lt_table> type standard TABLE ,
<fwa> type any,
<field> type abap_compdescr.
data : lt_fcat type lvc_t_fcat,
ls_fcat type lvc_s_fcat,
lt_fldcat type SLIS_T_FIELDCAT_ALV,
ls_fldcat like line of lt_fldcat.
data : ref_data type REF TO data,
ref_wa type ref to data.
ref_rowtype ?= cl_abap_typedescr=>DESCRIBE_BY_name( p_name = p_tab ).
TRY.
CALL METHOD cl_abap_tabledescr=>create
EXPORTING
p_line_type = ref_rowtype
receiving
p_result = ref_tabletype.
CATCH cx_sy_table_creation .
write : / 'Object Not Found'.
ENDTRY.
*creating object.
create data ref_data type handle ref_tabletype.
create data ref_wa type handle ref_rowtype.
*value assignment.
ASSIGN ref_data->* to <lt_table>.
assign ref_wa->* to <fwa>.
loop at ref_rowtype->components ASSIGNING <field>.
ls_fcat-fieldname = <field>-name.
ls_fcat-ref_table = p_tab.
append ls_fcat to lt_fcat.
if lt_fldcat[] is INITIAL.
ls_fldcat-fieldname = 'CHECKBOX'.
ls_fldcat-checkbox = 'X'.
ls_fldcat-edit = 'X'.
ls_fldcat-seltext_m = 'Checkbox'.
append ls_fldcat to lt_fldcat.
endif.
clear ls_fldcat.
ls_fldcat-fieldname = <field>-name.
ls_fldcat-ref_tabname = p_tab.
append ls_fldcat to lt_fldcat.
endloop.
loop at lt_fldcat into ls_fldcat.
if sy-tabix = 1.
ls_fldcat-checkbox = 'X'.
ls_fldcat-edit = 'X'.
modify lt_fldcat FROM ls_fldcat
TRANSPORTING checkbox edit.
endif.
endloop.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_fcat[]
IMPORTING
ep_table = ref_data.
assign ref_data->* to <lt_table>.
select * FROM (p_tab) into table <lt_table>.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT = lt_fldcat[]
TABLES
t_outtab = <lt_table>.
Thanks & Regards,
Raghunadh .K -
How can i set dynamice for week on Selection screen..pls help me..Urgent
Hi..All
please Help me .. i am very confused..
i need to set a varient for week which is dynamic on selection screen.
b) Week from current week to current week + 2. (<b>Dynamic selection)</b>how can i set dynamice for week on Selection screen,,
how can i do this..i am alrady set dynamice variant for Date.. there is option for D.. but in case of week there is a no option.
pls help me..urgent
thamks in advance.
mayukhHi,
I think the way out is use the dynamic select option while setting up the varinat and use sy-datum to sy-datum+9 which should essentially serve the purpose.
While saving the variant, for that particular date field check the Selection variable checkbox, then Choose D
option and then choose current days + or - option from there.
Rgds,
HR -
Steps to create tabstrip for subscreen in selection screen
hi,
can let me know the steps taken to create subscreen in selection screen and put in tabstrip?
i need to have 3 screens. 1000 being the tabstrip, 2000 being first subscreen and 3000 being the second subscreen.
i have the abap code but i do not know the steps to create especially 1000 screen.
for 2000 and 3000, once i activated the program, these 2 screens added but i do not know where can i create the 1000 screen.
also, should i use wizard to create tabstrip?
please advise. thanks
SELECTION-SCREEN BEGIN OF SCREEN 2000 AS SUBSCREEN. SELECTION-SCREEN BEGIN OF BLOCK x WITH FRAME TITLE text-001.
SELECT-OPTIONS: para1 FOR field1 ,
para2 FOR field2.
SELECTION-SCREEN END OF BLOCK x.
SELECTION-SCREEN END OF SCREEN 2000.
SELECTION-SCREEN BEGIN OF SCREEN 3000 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK y WITH FRAME TITLE text-002.
SELECT-OPTIONS: para3 FOR field3 ,
para4 FOR field4.
SELECTION-SCREEN END OF BLOCK y.
SELECTION-SCREEN:SKIP.
SELECTION-SCREEN END OF SCREEN 3000.e_l,
See the total doc.. with example.
Assigning a Subscreen Area to a Tab Title
You must assign a subscreen area to each tab title. There are two ways of doing this:
Paging in the SAPgui
You need to assign a separate subscreen area to each tab title, and define the function codes of the tab titles with type P (local GUI function). In the screen flow logic, you call all the subscreens in the PBO event. This means that all of the tab pages reside locally on the SAPgui.
When the user chooses a tab title, paging takes place within the SAPgui. In this respect, the tabstrip control behaves like a single screen. In particular, the PAI event is not triggered when the user chooses a tab title, and no data is transported. While this improves the performance of your tabstrip control, it also has the negative effect that when the user does trigger the PAI event, all of the input checks for all of the subscreens are performed. This means that when the user is working on one tab page, the input checks may jump to an unfilled mandatory field on another page.
Local paging at the SAPgui is therefore most appropriate for screens that display data rather than for input screens.
Paging on the Application Server
One subscreen area is shared by all tab titles and called in the PBO event. You define the function codes of the individual tab titles without a special function type. When the user chooses a tab page, the PAI event is triggered, and you must include a module in your flow logic that activates the appropriate tab page and assigns the correct subscreen to the subscreen area.
Since the PAI event is triggered each time the user chooses a tab title, this method is less economical for the application server, but the input checks that are performed only affect the current tab page.
Procedure in Either Case
You create the subscreen areas within the tabstrip area. You assign the subscreen areas to one or more tab titles in the Screen Painter by selecting one or more titles. You can also assign a subscreen area to a tab title in the tab title attributes by entering the name of the subscreen area in the Reference field attribute.
The procedure for the alphanumeric Screen Painter is described under Creating Tabstrip Controls.
If you are paging at the SAPgui, create a subscreen area for each tab title. If you are paging at the application server, select all tab titles and create a single subscreen area. The subscreen areas may not cover the top line of the tab area. However, within a tab area, more than one subscreen area can overlap.
Programming the Flow Logic
In the flow logic, all you have to do by hand is include the correct subscreens. The screen flow and data transport to the ABAP program is the same as for normal subscreens. There are two ways of programming the screen flow logic, depending on how you have decided to page through the tabstrip control.
Paging in the SAPgui
When you page in the SAPgui, you must include a subscreen for each subscreen area:
PROCESS BEFORE OUTPUT.
CALL SUBSCREEN: <area1> INCLUDING [<prog 1>] <dynp 1>,
<area2> INCLUDING [<prog 2>] <dynp 2>,
<area3> INCLUDING [<prog 3>] <dynp 3>,
PROCESS AFTER INPUT.
CALL SUBSCREEN: <area1>,
<area2>,
<area3>,
Paging on the Application Server
When you page on the application server, you only have to include a subscreen for the one subscreen area:
PROCESS BEFORE OUTPUT.
CALL SUBSCREEN <area> INCLUDING [<prog>] <dynp>.
PROCESS AFTER INPUT.
CALL SUBSCREEN <area>.
Handling in the ABAP Program
Before you can use a tabstrip control in your ABAP program, you must create a control for each control in the declaration part of your program using the following statement:
CONTROLS <ctrl> TYPE TABSTRIP.
where <ctrl> is the name of the tabstrip area on a screen in the ABAP program. The control allows the ABAP program to work with the tabstrip control. The statement declares a structure with the name <ctrl> . The only component of this structure that you need in your program is called ACTIVETAB.
Use in the PBO event
Before the screen is displayed, you use the control to set the tab page that is currently active. To do this, assign the function code of the corresponding tab title to the component ACTIVETAB:
<ctrl>-ACTIVETAB = <fcode>.
When you page at the SAPgui, you only need to do this once before the screen is displayed. This initializes the tabstrip control. The default active tab page is the first page. After this, the page activated when the user chooses a tab title is set within SAPgui.
When you page on the application server, you must assign the active page both before the screen is displayed for the first time, and each time the user pages. At the same time, you must set the required subscreen screen.
You can suppress a tab page dynamically by setting the ACTIVE field of table SCREEN to 0 for the corresponding tab title.
Use in the PAI event
In the PAI event, ACTIVETAB contains the function code of the last active tab title on the screen.
When you page in the SAPgui, this allows you to find out the page that the user can currently see. When you page at the application server, the active tab page is controlled by the ABAP program anyway.
The OK_CODE field behaves differently according to the paging method:
Paging in the SAPgui
When you page in the SAPgui, the PAI event is not triggered when the user chooses a tab title, and the OK_CODE field is not filled. The OK_CODE field is only filled by user actions in the GUI status or when the user chooses a pushbutton either outside the tabstrip control or on one of the subscreens.
Paging on the application server
If you are paging at the application server, the PAI event is triggered when the user chooses a tab title, and the OK_CODE field is filled with the corresponding function code.
To page through the tabstrip control, you must assign the function code to the ACTIVETAB component of the control:
<ctrl>-ACTIVETAB = <ok_code>.
This statement overwrites the function code of the last active tab page with that of the new tab title. At the same time, you must ensure that the correct subscreen is inserted in the subscreen area.
Otherwise, tabstrip controls are handled like normal subscrens in ABAP programs, that is, the ABAP program of a subscreen screen must contain the dialog modules called from the flow logic of the subscreen.
Examples
Tabstrip control, paging at SAPgui
REPORT DEMO_DYNPRO_TABSTRIP_LOCAL.
CONTROLS MYTABSTRIP TYPE TABSTRIP.
DATA: OK_CODE TYPE SY-UCOMM,
SAVE_OK TYPE SY-UCOMM.
MYTABSTRIP-ACTIVETAB = 'PUSH2'.
CALL SCREEN 100.
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
ENDMODULE.
MODULE CANCEL INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE USER_COMMAND INPUT.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
IF SAVE_OK = 'OK'.
MESSAGE I888(SABAPDOCU) WITH 'MYTABSTRIP-ACTIVETAB ='
MYTABSTRIP-ACTIVETAB.
ENDIF.
ENDMODULE.
The next screen (statically defined) for screen 100 is itself. It has the following layout:
The screen contains a tabstrip area called MYTABSTRIP with three tab titles PUSH1, PUSH2 and PUSH3. The function codes have the same name, and all have the function type P. One of the subscreen areas SUB1 to SUB3 is assigned to each tab title. The pushbutton has the name BUTTON and the function code OK.
In the same ABAP program, there are three subscreen screens 110 to 130. Each of these fits the subscreen area exactly. The layout is:
The screen flow logic for screen 100 is as follows:
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
CALL SUBSCREEN: SUB1 INCLUDING SY-REPID '0110',
SUB2 INCLUDING SY-REPID '0120',
SUB3 INCLUDING SY-REPID '0130'.
PROCESS AFTER INPUT.
MODULE CANCEL AT EXIT-COMMAND.
CALL SUBSCREEN: SUB1,
SUB2,
SUB3.
MODULE USER_COMMAND.
The screen flow logic of subscreens 110 to 130 does not contain any module calls.
When you run the program, a screen appears on which the second tab page is active, since the program sets the ACTIVETAB component of the structure MYTABSTRIP to PUSH2 before the screen is displayed. The user can page through the tabstrip control without the PAI event being triggered. One of the three subscreens is included on each tab page.
When the user chooses Continue, the PAI event is triggered, and an information message displays the function code of the tab title of the page that is currently active.
Tabstrip control with paging on the application server.
REPORT DEMO_DYNPRO_TABSTRIP_LOCAL.
CONTROLS MYTABSTRIP TYPE TABSTRIP.
DATA: OK_CODE TYPE SY-UCOMM,
SAVE_OK TYPE SY-UCOMM.
DATA NUMBER TYPE SY-DYNNR.
MYTABSTRIP-ACTIVETAB = 'PUSH2'.
NUMBER = '0120'.
CALL SCREEN 100.
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
ENDMODULE.
MODULE CANCEL INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE USER_COMMAND INPUT.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
IF SAVE_OK = 'OK'.
MESSAGE I888(SABAPDOCU) WITH 'MYTABSTRIP-ACTIVETAB ='
MYTABSTRIP-ACTIVETAB.
ELSE.
MYTABSTRIP-ACTIVETAB = SAVE_OK.
CASE SAVE_OK.
WHEN 'PUSH1'.
NUMBER = '0110'.
WHEN 'PUSH2'.
NUMBER = '0120'.
WHEN 'PUSH3'.
NUMBER = '0130'.
ENDCASE.
ENDIF.
ENDMODULE.
The statically-defined next screen for screen 100 is itself, and its layout is the same as in the above example. However, the function codes of the three tab titles have the function type <blank> and they all share a single subscreen area SUB.
The same subscreen screens 110 to 130 are defined as in the last example.
The screen flow logic for screen 100 is as follows:
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
CALL SUBSCREEN SUB INCLUDING SY-REPID NUMBER.
PROCESS AFTER INPUT.
MODULE CANCEL AT EXIT-COMMAND.
CALL SUBSCREEN SUB.
MODULE USER_COMMAND.
In this example, the program includes a subscreen screen in the subscreen area SUB dynamically during the PBO event.
The screen flow logic of subscreens 110 to 130 does not contain any module calls.
This example has the same function as the previous example, but the paging within the tabstrip control is implemented on the application server. Each time the user chooses a tab title, the function code from the OK_CODE field is assigned to the ACTIVETAB component of structure MYTABSTRIP. At the same time, the variable NUMBER is filled with the screen number of the subscreen that has to be displayed in the subscreen area SUB of the tabstrip control
Pls. reward if useful -
Change Layout in Selection Screen for OO ALV-Grid
Hello everyone,
I got a problem regarding layouts for objectoriented ALV Grid. I want to make it possible that user can take the layout for ALV he wants to on the selection screen. So far thats no problem and it works. But there are some little problems which I do not know how to fix them. But first the facts:
(1) I got my parameter for layout
PARAMETER: p_vari TYPE disvariant-variant.
(2) I fill my global layout structure in initialization
INITIALIZATION.
* Variante vorbelegen
gs_variant-username = sy-uname.
gs_variant-report = sy-repid.
* Layout holen
CALL FUNCTION 'LVC_VARIANT_DEFAULT_GET'
EXPORTING
i_save = 'A'
CHANGING
cs_variant = gs_variant
EXCEPTIONS
wrong_input = 1
not_found = 2
program_error = 3
OTHERS = 4.
IF sy-subrc = 0.
p_vari = gs_variant-variant.
ENDIF.
(3) I got my handling for F4-value help on variant parameter
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
CALL FUNCTION 'LVC_VARIANT_F4'
EXPORTING
is_variant = gs_variant
i_save = 'A'
IMPORTING
es_variant = gs_variant
EXCEPTIONS
not_found = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE text-m01 TYPE 'S'.
ELSE.
p_vari = gs_variant-variant.
ENDIF.
(4) I give back my parameters content into the variant structure at start of selection
START-OF-SELECTION.
gs_variant-username = sy-uname.
gs_variant-report = sy-repid.
gs_variant-variant = p_vari.
This works all fine but I got some problems when using default variants/layouts. For example I got a default variant only for me. When starting the selection screen it works fine that the default layout was written. It is displayed automatically in the variant parameter. But I want that if i I empty the content (blank it out) from my variant parameter, that report should start with "normal" layout how it was written in the report and NOT with default layout.
When I clear the gs_variant it works like I want it, but then the alv layout button looks like (without functions for layout), because I do not have the reference to my report.
So what to do? :-)
Regards
MichaelWow that was fast, works great, thanks :-)
I did not use this parameter in set table method but now I fill it dynamically.
Ok next problem, one step harder ;-)
Now I have one selection screen for one ALV-Grid, but four radio buttons which control with which data the ALV gets filled (four different fieldcats, data tables and so on). Each Grid got an own HANDLE so that the layouts can be separated in four categories.
Now I want that by changing the radio button the individual standard layout for the chosen alv grid is getting filled.
This works fine when using it in selection screen output.
AT SELECTION-SCREEN OUTPUT.
CLEAR gs_variant.
* Layout-Handles individuell für Klausel-Radiobuttons setzen
IF p_py IS NOT INITIAL.
gs_variant-username = sy-uname.
gs_variant-report = sy-repid.
gs_variant-handle = 'KLPY'.
ELSEIF p_rh IS NOT INITIAL.
gs_variant-username = sy-uname.
gs_variant-report = sy-repid.
gs_variant-handle = 'KLRH'.
ELSEIF p_aj IS NOT INITIAL.
gs_variant-username = sy-uname.
gs_variant-report = sy-repid.
gs_variant-handle = 'KLAJ'.
ELSEIF p_sr IS NOT INITIAL.
gs_variant-username = sy-uname.
gs_variant-report = sy-repid.
gs_variant-handle = 'KLSR'.
ENDIF.
* Layout holen
CALL FUNCTION 'LVC_VARIANT_DEFAULT_GET'
EXPORTING
i_save = 'A'
CHANGING
cs_variant = gs_variant
EXCEPTIONS
wrong_input = 1
not_found = 2
program_error = 3
OTHERS = 4.
IF sy-subrc = 0.
p_vari = gs_variant-variant.
ELSE.
CLEAR p_vari.
ENDIF.
But unfortunately selection screen output is getting passed by EACH changing in the selection screen. This means when I try to clear the default layout in my parameter field, it gets refilled automatically with default layout. If I do a condition around the filling (only if not initial) the default value filling does not work fine in every case, e.g. when clearing the parameters field and then change the radiobutton -> then it does not get filled automatically.
Maybe you are looking for
-
Finder crashes when I attach an external HD
Hi, since updating to 10.5.2 the Finder disappears whenever I attach my external HD (Time Machine HD)and the HD is not mounted. Relaunching the finder does not help. The finder just tries to start, the light below comes on for a second or so and then
-
I have a Java program to communicate with the server and when i click the close button in my program i get disconnected from the server . But i have to do the same thing when i click the close button in the server...... I dont have the server code. h
-
I need someones honest opinion about my classe's lab final
hello, my name is Professor John Mane, i am teaching AP java in a high school and would like to know if anyone thinks that this would be good for the lab final- i would like to know if anyone can do it and if can, how long it takes you to do it, than
-
SAP NetWeaver BI Connections - Xcelsius 2008 - XI 3.1 Enterprise
Dear Xcelsius experts, We would like to use "SAP NetWeaver BI Connections" connecting SAP BI Queries directly in Xcelsius 2008, we read in "Xcelsius2008_user_guide_en" that there is this new connection available. Our Xcelsius 2008 is connected in a
-
ESP scenario question!?
Hi all, I have the following scenario in mind, can someone tell me if ESP can support this scenario and which elements do I need to use in order to accomplish my scenario… I want to use an input-stream to receive a lot of twitter messages which I wan