Assigning Data-Type Select-Option from Report to Method
Hi Specialists,
How can I solve the following task smart? Its a quiet simple task. In my Report Ive some Select-Option-Data-Types and I want to assign this data-type an Abpab-Object-Method. Is it possible to do this in a smart fashion. Ive fight with the Abap-Syntax und at the end Ive found a tricky way of assigning the Select-Option parameter to the Abap-Object-Method.
If somebody have a smart idea for this problem, pleas let me know.
Thankx.
Hallo Spezialisten,
ich hätte da eine Frage wie man folgende Aufgabe elegant lösen kann.
Es ist ganz einfach, ich möchte von einen Report einen Select-Option-Datentyp an eine Abapobject Methode übergeben. Ich hatte sehr lange gekämpft bis ich ein umständlichen weg gefunden habe die parameter vom reprot an die mehtode zu übergen.
Falls jemand da eine gut Idee hätte wäre mir das nächste mach sehr geholfen.
Danke
Hi
Here is the Program with Selection screen and the Class & Methods.
REPORT demo_abap_objects_methods NO STANDARD PAGE HEADING.
* Global Selection Screens
SELECTION-SCREEN BEGIN OF: SCREEN 100 TITLE tit1, LINE.
PARAMETERS members TYPE i DEFAULT 10.
SELECTION-SCREEN END OF: LINE, SCREEN 100.
SELECTION-SCREEN BEGIN OF: SCREEN 200 TITLE tit2.
PARAMETERS: drive RADIOBUTTON GROUP actn,
stop RADIOBUTTON GROUP actn,
gearup RADIOBUTTON GROUP actn,
geardown RADIOBUTTON GROUP actn.
SELECTION-SCREEN END OF: SCREEN 200.
* Class Definitions
CLASS: c_biker DEFINITION DEFERRED,
c_bicycle DEFINITION DEFERRED.
CLASS c_team DEFINITION.
PUBLIC SECTION.
TYPES: biker_ref TYPE REF TO c_biker,
biker_ref_tab TYPE STANDARD TABLE OF biker_ref
WITH DEFAULT KEY,
BEGIN OF status_line_type,
flag(1) TYPE c,
text1(5) TYPE c,
id TYPE i,
text2(7) TYPE c,
text3(6) TYPE c,
gear TYPE i,
text4(7) TYPE c,
speed TYPE i,
END OF status_line_type.
CLASS-METHODS: class_constructor.
METHODS: constructor,
create_team,
selection,
execution.
PRIVATE SECTION.
CLASS-DATA: team_members TYPE i,
counter TYPE i.
DATA: id TYPE i,
status_line TYPE status_line_type,
status_list TYPE SORTED TABLE OF status_line_type
WITH UNIQUE KEY id,
biker_tab TYPE biker_ref_tab,
biker_selection LIKE biker_tab,
biker LIKE LINE OF biker_tab.
METHODS: write_list.
ENDCLASS.
CLASS c_biker DEFINITION.
PUBLIC SECTION.
METHODS: constructor IMPORTING team_id TYPE i members TYPE i,
select_action,
status_line EXPORTING line TYPE c_team=>status_line_type.
PRIVATE SECTION.
CLASS-DATA counter TYPE i.
DATA: id TYPE i,
bike TYPE REF TO c_bicycle,
gear_status TYPE i VALUE 1,
speed_status TYPE i VALUE 0.
METHODS biker_action IMPORTING action TYPE i.
ENDCLASS.
CLASS c_bicycle DEFINITION.
PUBLIC SECTION.
METHODS: drive EXPORTING velocity TYPE i,
stop EXPORTING velocity TYPE i,
change_gear IMPORTING change TYPE i
RETURNING value(gear) TYPE i
EXCEPTIONS gear_min gear_max.
PRIVATE SECTION.
DATA: speed TYPE i,
gear TYPE i VALUE 1.
CONSTANTS: max_gear TYPE i VALUE 18,
min_gear TYPE i VALUE 1.
ENDCLASS.
* Class Implementations
CLASS c_team IMPLEMENTATION.
METHOD class_constructor.
tit1 = 'Team members ?'.
CALL SELECTION-SCREEN 100 STARTING AT 5 3.
IF sy-subrc NE 0.
LEAVE PROGRAM.
ELSE.
team_members = members.
ENDIF.
ENDMETHOD.
METHOD constructor.
counter = counter + 1.
id = counter.
ENDMETHOD.
METHOD create_team.
DO team_members TIMES.
CREATE OBJECT biker EXPORTING team_id = id members = team_members.
APPEND biker TO biker_tab.
CALL METHOD biker->status_line IMPORTING line = status_line.
APPEND status_line TO status_list.
ENDDO.
ENDMETHOD.
METHOD selection.
CLEAR biker_selection.
DO.
READ LINE sy-index.
IF sy-subrc <> 0. EXIT. ENDIF.
IF sy-lisel+0(1) = 'X'.
READ TABLE biker_tab INTO biker INDEX sy-index.
APPEND biker TO biker_selection.
ENDIF.
ENDDO.
CALL METHOD write_list.
ENDMETHOD.
METHOD execution.
CHECK NOT biker_selection IS INITIAL.
LOOP AT biker_selection INTO biker.
CALL METHOD biker->select_action.
CALL METHOD biker->status_line IMPORTING line = status_line.
MODIFY TABLE status_list FROM status_line.
ENDLOOP.
CALL METHOD write_list.
ENDMETHOD.
METHOD write_list.
SET TITLEBAR 'TIT'.
sy-lsind = 0.
SKIP TO LINE 1.
POSITION 1.
LOOP AT status_list INTO status_line.
WRITE: / status_line-flag AS CHECKBOX,
status_line-text1,
status_line-id,
status_line-text2,
status_line-text3,
status_line-gear,
status_line-text4,
status_line-speed.
ENDLOOP.
ENDMETHOD.
ENDCLASS.
CLASS c_biker IMPLEMENTATION.
METHOD constructor.
counter = counter + 1.
id = counter - members * ( team_id - 1 ).
CREATE OBJECT bike.
ENDMETHOD.
METHOD select_action.
DATA activity TYPE i.
tit2 = 'Select action for BIKE'.
tit2+24(3) = id.
CALL SELECTION-SCREEN 200 STARTING AT 5 15.
CHECK NOT sy-subrc GT 0.
IF gearup = 'X' OR geardown = 'X'.
IF gearup = 'X'.
activity = 1.
ELSEIF geardown = 'X'.
activity = -1.
ENDIF.
ELSEIF drive = 'X'.
activity = 2.
ELSEIF stop = 'X'.
activity = 3.
ENDIF.
CALL METHOD biker_action( activity ).
ENDMETHOD.
METHOD biker_action.
CASE action.
WHEN -1 OR 1.
CALL METHOD bike->change_gear
EXPORTING change = action
RECEIVING gear = gear_status
EXCEPTIONS gear_max = 1
gear_min = 2.
CASE sy-subrc.
WHEN 1.
MESSAGE i315(at) WITH 'BIKE' id
' is already at maximal gear!'.
WHEN 2.
MESSAGE i315(at) WITH 'BIKE' id
' is already at minimal gear!'.
ENDCASE.
WHEN 2.
CALL METHOD bike->drive IMPORTING velocity = speed_status.
WHEN 3.
CALL METHOD bike->stop IMPORTING velocity = speed_status.
ENDCASE.
ENDMETHOD.
METHOD status_line.
line-flag = space.
line-text1 = 'Biker'.
line-id = id.
line-text2 = 'Status:'.
line-text3 = 'Gear = '.
line-gear = gear_status.
line-text4 = 'Speed = '.
line-speed = speed_status.
ENDMETHOD.
ENDCLASS.
CLASS c_bicycle IMPLEMENTATION.
METHOD drive.
speed = speed + gear * 10.
velocity = speed.
ENDMETHOD.
METHOD stop.
speed = 0.
velocity = speed.
ENDMETHOD.
METHOD change_gear.
gear = me->gear.
gear = gear + change.
IF gear GT max_gear.
gear = max_gear.
RAISE gear_max.
ELSEIF gear LT min_gear.
gear = min_gear.
RAISE gear_min.
ENDIF.
me->gear = gear.
ENDMETHOD.
ENDCLASS.
* Global Program Data
TYPES team TYPE REF TO c_team.
DATA: team_blue TYPE team,
team_green TYPE team,
team_red TYPE team.
DATA color(5) TYPE c.
* Program events
START-OF-SELECTION.
CREATE OBJECT: team_blue,
team_green,
team_red.
CALL METHOD: team_blue->create_team,
team_green->create_team,
team_red->create_team.
SET PF-STATUS 'TEAMLIST'.
WRITE ' Select a team! ' COLOR = 2.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'TEAM_BLUE'.
color = 'BLUE '.
FORMAT COLOR = 1 INTENSIFIED ON INVERSE ON.
CALL METHOD team_blue->selection.
WHEN 'TEAM_GREEN'.
color = 'GREEN'.
FORMAT COLOR = 5 INTENSIFIED ON INVERSE ON.
CALL METHOD team_green->selection.
WHEN 'TEAM_RED'.
color = 'RED '.
FORMAT COLOR = 6 INTENSIFIED ON INVERSE ON.
CALL METHOD team_red->selection.
WHEN 'EXECUTION'.
CASE color.
WHEN 'BLUE '.
FORMAT COLOR = 1 INTENSIFIED ON INVERSE ON.
CALL METHOD team_blue->selection.
CALL METHOD team_blue->execution.
WHEN 'GREEN'.
FORMAT COLOR = 5 INTENSIFIED ON INVERSE ON.
CALL METHOD team_green->selection.
CALL METHOD team_green->execution.
WHEN 'RED '.
FORMAT COLOR = 6 INTENSIFIED ON INVERSE ON.
CALL METHOD team_red->selection.
CALL METHOD team_red->execution.
ENDCASE.
ENDCASE.
Reward points if it is usefull ....
Girish
Similar Messages
-
PS:Copy of MBBS report with Date(GR) selection option in selection screen.
Hi,
We are developing a report, which is Copy of MBBS report, addition as Date(GR) selection option in selection screen to view historical data {i.e.Project Stock(Q) on back dates}.
MBBS is showing Project Stock w.r.t. WBS. So pls suggest Table, which can fulfill the requirement to show the Project Stock from GR w.r.t. Purchase and Production order in back date w.r.t. that WBS.
Pls do the needful.
Thanks,
Amit Jain.Hi Amit ,
The Project Stock Table is MSPR , and the Project stock history table is MSPRH .
Though not through with your actual requirement , There is a standard Report MB5B -- Stock on Posting Date . In the selection screen , we can have the Special Stock Q (Project Stock ) .
If you can develop copying this report instead of MBBS , it would take care of receipts as well as issues ,and from the material Document you can build a relation to the account assignment WBS/Network Activity through MSEG Table .
Hope it helps .
thanks and regards
Kish -
Optional Prompt for Date type parameter in Crystal Report.
Hi Every One,
I have a date type parameter in crystal report.When I am convert it to optional prompt it is showing following message.
But the Type field is gray out when I was selecting list of values Dynamic.
Please suggest.
Thanks and Regards
DEVHi,
Please check SAP note:
1710595 - CR_Defining "Optional Prompt" as True for SAP Crystal
Reports Does Not Work
Thanks & Regards,
Nagarajan -
How to get the values of Select-options from the screen.
The value of parameter can be obtained by function module 'DYNP_VALUES_READ' but How to get the values of Select-options from the screen? I want the F4 help values of select-options B depending on the values in Select-option A.So I want to read the Select-option A's value.
Hi,
Refer this following code..this will solve your problem...
"Following code reads value entered in s_po select options and willprovide search
"help for s_item depending upon s_po value.
REPORT TEST.
TABLES : ekpo.
DATA: BEGIN OF itab OCCURS 0,
ebelp LIKE ekpo-ebelp,
END OF itab.
SELECT-OPTIONS s_po FOR ekpo-ebeln.
SELECT-OPTIONS s_item FOR ekpo-ebelp.
INITIALIZATION.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_item-low.
DATA:
dyn_field TYPE dynpread,
temp_fields TYPE TABLE OF dynpread,
zlv_dynpro TYPE syst-repid.
zlv_dynpro = syst-repid.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = zlv_dynpro
dynumb = syst-dynnr
request = 'A'
TABLES
dynpfields = temp_fields
EXCEPTIONS
OTHERS = 0.
LOOP AT temp_fields INTO dyn_field.
IF dyn_field-fieldname EQ 'S_PO-LOW'.
SELECT * INTO CORRESPONDING fields OF TABLE itab FROM ekpo
WHERE ebeln EQ dyn_field-fieldvalue.
EXIT.
ENDIF.
ENDLOOP. -
Relative date as selection option
Hi Experts,
could any of You pls help me to define a relative date as selection options?
I have a program about production order selection with a start date as selection option (AKFO-GSTRP). I would like to run this program daily as a background job with dynamic selection: ex. always select orders start date: -5 days form today up till +5 days from now.
So,I want to define a selection options, which will give possibilit to user define only the number of days, and based on this and sy-datum can calculate the actual value for the selection. But in so_xxx definition up till now I only referred to a real value, and I can not do it this time with FOR string. ( My selection field has data element CO_DAT_REL).
Could any of You pls help me - as being beginner at programming-, how to define this relative date selection option?
Thanks in advanceSome solutions (if I understood)
- define a variant for the report, use this variant in the transaction definition (define this variant as a [system variant|http://help.sap.com/saphelp_nw70/helpdata/en/c0/980389e58611d194cc00a0c94260a5/frameset.htm] (start with CUS& or SAP&) so it will be transported automatically, in this variant define the range of date as a selection variant of type D: Dynamic date calculation and select one of the available variable by F4
- define a parameter field of type integer, and build yourself the range by subtracting or adding this field to current date, you can define the result range as a select-options, just protect it in the PBO (AT SELECTION-SCREEN OUTPUT with a classical LOOP AT SCREEN/MODIFY SCREEN/ENDLOOP)
Regards,
Raymond -
Fill a "select options" from a direct input.
Hi there
my new need is this, into a report I call a transaction (FMMC) and I'd like to fill a multiple selection into a select option (belnr) , there is a way to do only an execution of this "batch" or I have to launch the transaction for every document I have to release ?
ThanksSee the sample code
*Code used to populate 'select-options' & execute report
DATA: seltab type table of rsparams,
seltab_wa like line of seltab.
seltab_wa-selname = 'PNPPERNR'.
seltab_wa-sign = 'I'.
seltab_wa-option = 'EQ'.
load each personnel number accessed from the structure into
parameters to be used in the report
loop at pnppernr.
seltab_wa-low = pnppernr-low.
append seltab_wa to seltab.
endloop.
SUBMIT zreport with selection-table seltab
via selection-screen.
*Code used to populate 'parameters' & execute report
SUBMIT zreport with p_param1 = 'value'
with p_param2 = 'value'.
http://www.sapdevelopment.co.uk/reporting/rep_submit.htm -
Update a select-option From Table
Hi,
I'm originally a C++ developer trying to learn ABAP.
I want to append values to a select-option from a table if another select-option is specified. I wrote some code that I believe will work but looks very inefficient to me. Any advice on how to streamline this process would appreciated.
The following is pseudo code and I left out some tweaks for simplicity and understanding but the basic idea is there. I want to add selection criteria to a select-option based upon a second select option (that may or may not be provided) table lookup.
Example:
DATA: groups TYPE table3.
SELECT-OPTIONS:
s_accountNo FOR table1-accountNo,
s_accountGroupNo FOR table2-accountGroupNo.
**** get the Account Groups that meet the selection criteria.
START-OF-SELECTION
SELECT * INTO TABLE groups
FROM table3
WHERE accountGroupNo IN s_accountGroupNo.
**** Remove duplicate accounts from the Account Groups
SORT groups BY accountNo.
DELETE ADJACENT DUPLICATES FROM groups COMPARING accountNo.
**** Append the account #'s onto the s_accountNo range/select-option
LOOP AT groups.
APPEND groups-accountNo TO s_accountNo.
ENDLOOP.
**** manually edit the s_accountNo to have the correct option/sign for use in further select statements.
LOOP AT s_accountNo.
s_accountNo-sign = 'I'.
s_accountNo-option = 'EQ'.
MODIFY s_accountNo.
ENDLOOP.
Thanks much,
-ChrisThe actual selection is fairly complicated from my point of view. I wrote the accountNo example to make things less confusing for me as much as anyone else, not to hide anything. I also didn't expect this amount of feedback, though it is appreciated.
The eventual select statement that is done is the following:
SELECT DISTINCT vttp~zseq_num
likp~vbeln
likp~lprio
likp~vstel
lips~werks
likp~lgnum
lips~posnr
lips~lgort
lips~vgbel
lips~vgpos
lips~sobkz
lips~lfimg
lips~vrkme
lips~matnr
lips~volum
mara~raube
vttk~dplbg
vttp~tknum
vttp~tpnum
likp~berot
likp~vkorg
likp~lfart
INTO TABLE temp_deliveries
FROM vttk
INNER JOIN vttp
ON vttk~tknum = vttp~tknum
INNER JOIN likpuk AS likp
ON vttp~vbeln = likp~vbeln
INNER JOIN lipsup AS lips
ON likp~vbeln = lips~vbeln
INNER JOIN mara
ON lips~matnr = mara~matnr
WHERE likp~vstel = p_vstel
AND lips~werks = p_werks
AND likp~lgnum IN s_lgnum
AND likp~vbeln IN s_vbeln
AND lips~vgbel IN s_vgbel
AND vttk~dplbg IN s_dplbg
AND vttk~tknum IN s_tknum
AND mara~raube = p_raube
AND likp~lfart IN ('ZLF', 'NL')
AND lips~kosta <> 'C'
AND lips~kosta <> ''
AND likp~kostk <> 'C'
AND likp~vbtyp = outbound.
and the structure it is put into is the following:
TYPES: BEGIN OF type_deliveries,
zseq_num TYPE vttp-zseq_num,
vbeln TYPE likp-vbeln,
lprio TYPE likp-lprio,
vstel TYPE likp-vstel,
werks TYPE likp-werks,
lgnum TYPE likp-lgnum,
posnr TYPE lips-posnr,
lgort TYPE lips-lgort,
vgbel TYPE lips-vgbel,
vgpos TYPE lips-vgpos,
sobkz TYPE lips-sobkz,
lfimg TYPE lips-lfimg,
vrkme TYPE lips-vrkme,
matnr TYPE lips-matnr,
volum TYPE lips-volum,
raube TYPE mara-raube,
dplbg TYPE vttk-dplbg,
tknum TYPE vttk-tknum,
tpnum TYPE vttp-tpnum,
berot TYPE likp-berot,
vkorg TYPE likp-vkorg,
lfart TYPE likp-lfart,
sdabw type likp-sdabw,
orig_lgort TYPE lips-zzorig_lgort,
selected TYPE flag,
counter(15) TYPE n,
END OF type_deliveries.
Currently there is a select option for tknum and I am attempting (successfully with my change shown above, though as many have pointed out I may be misusing the intended functionality) to add another select-option for s_pickno which is a field of a custom table that has pickno as one of it's unique keys and tknum as another of it's fields. The idea is to be able to take a pickno and use it to find all the tknum's associated and then use them in the select statement above as well as any tknum's provided as initial input by the user. If there is a better method than modifying the s_tknum selection I'm open to feedback.
Apologies that my initial example did not portray this, but being new I was a little overwhelmed myself and want something I can wrap my head around better. There's my wall of text -
How to get the data into select options if we have 10 select options
Hi Experts,
I facing problem to get the data from diffrent tables and different select options.
I have to pass different parameter ranges.
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: rb1 RADIOBUTTON GROUP g1. "Existing Key Accounts
PARAMETERS: rb2 RADIOBUTTON GROUP g1. "Potential Key Accounts
SELECT-OPTIONS: s_part FOR but000-partner."Business Partner Number
PARAMETERS: p_bpkind LIKE but000-bpkind. "Business Partner Type
PARAMETERS: p_but000 LIKE but000-partner. "Key Account Manager
SELECT-OPTIONS : s_vkont FOR fkkvkp-vkont. "Contract Account
SELECT-OPTIONS : s_ktokl FOR fkkvkp-ktokl. "Debtor Type
SELECT-OPTIONS : s_sparte FOR ever-sparte. "Division
SELECT-OPTIONS : s_vertra FOR ever-vertrag. "Contract
SELECT-OPTIONS : s_budat FOR erdk-budat. "Invoice Date
SELECT-OPTIONS : s_netto FOR dberchv-nettobtr."Billing Amount
SELECT-OPTIONS : s_abrm FOR abc. "Consumption Value
SELECTION-SCREEN: END OF BLOCK b1.
need response asap.
Thanking you.
Regards Surya RamireddyHI,
You can use as many Select-options in the select statment,
Select XXXX yyyy from TABLE where FIELD In S_FIELD1 and
FIELD2 In S_FIELD2.
Regards
Sudheer -
How we can assign the customised selection screen to report category
hai
gurus
how we can assign the customised selection screen to report categoryHi Naresh,
You can do like this.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN BEGIN OF BLOCK SELECTION WITH FRAME.
SELECT-OPTIONS: S_FKART FOR VBRK-FKART.
SELECT-OPTIONS: S_FKDAT FOR VBRK-FKDAT OBLIGATORY.
SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.
SELECT-OPTIONS: S_AUART FOR VBAK-AUART.
SELECTION-SCREEN END OF BLOCK SELECTION.
SELECTION-SCREEN END OF BLOCK B1.
if you give me brief i can help you out more.
Thank you .
Regards
Ram -
URGENT:data type declaration of container within the method
Hi
My requirement is when the user revceives mail to approve/reject invoice ,the user attaches an attachmnet in the workitem stating the reson for approval/rejection of invoice.The attached attachement should be uploaded to invoice as an attachment.
I have observed that the attachment attached by the user is stored in the container "office_document" and the type of the container is SOFM.
To capture the attachment and send it to invoice i have created new task and new method in ZBUS2081.
i created a container "office_doc_atta" in the workflow .the type of office_doc_atta is SOFM .
in the method as well as task i also declared parameter "office_doc_atta" of type sofm.
to fetch the data from Task to method i have declared following table
data:office_doc_atta type swc_object occurs 0 with header line.
swc_get_table container 'office_doc_atta' office_doc_atta.
I think that data type of "office_doc_atta" decalred within the method
is wrong and i am unable to fetch data from the container.
If anyone know what should be the data type of office_doc_atta within the method and how to fetch data from the task kindly let me know.
Points will be rewarded.Try using SWOTOBJID instead of SWC_OBJECT.
SWOTOBJID is the data type for a persistent object ID, while SWC_OBJECT is the data type for a runtime object ID (or reference or handle, if you are more familiar with any of those terms).
Normally, an object will be passed by the persistent object ID. As the name reveals, the ID is persistent, i.e. remains the same. Therefore it can be stored in a database, and passed to the next step in a workflow - even if this step is executed by a different person another day.
<i>Message was edited by Kjetil Kilhavn:</i>
Please don't use the word urgent in your subject (or in the question for that matter). There are many reasons for this, some of which are:
1) This is not a help desk or service organization, there are no response time guarantees based on how important a problem is for you.
2) Most people visit SDN when time permits.
3) Due to the previous 2 that particular word annoys more than it inspires.
4) It is specifically mentioned in the guidelines that you should not use that word.
5) It is a word with no accuracy. It would be better if you wrote (in the question, not the subject) that you need to solve this within 2 days - then we know your deadline.
6) If I'm in the right mood I will ignore all questions marked as urgent for at least one day. Just for the heck of it. -
Cant't get the data through SELECTION-OPTION
hi all,
i have created a REPORT in which i have two SELECTION-OPTION i-e one is ANLKL from TABLE ANLA and other is GJAHR from table ANLC.Problem which i m facing is that when i execute without giving my SELECTION-OPTION GJAHR.it gives me all data for example(2005,2007,2008),but when im defining it with by 2005 it gives blank fields even though there is data with GJAHR by 2005.
This is the coding of my report:
include zalsd_alv_incl.
TABLES:ANEP,ANLA,ANLC.
SELECT-OPTIONS:
S_ANLKL FOR ANLA-ANLKL DEFAULT '1100' to '2790',
S_GJAHR FOR ANLC-GJAHR.
DATA:BEGIN OF gi_anla OCCURS 0,
bukrs LIKE anla-bukrs,
ANLN1 LIKE anla-ANLN1,
ANLN2 LIKE anla-ANLN2,
AKTIV LIKE ANLA-AKTIV,"Asset capitalization date
ANLKL LIKE ANLA-ANLKL,"Asset Class
END OF gi_anla,
BEGIN OF GI_ANLC OCCURS 0,
bukrs LIKE anlc-bukrs,
NAFAP LIKE anlc-nafag,"Posted Depreciation
kansw LIKE anlc-kansw,"Asset Acquisation Value
ANLN2 LIKE anlc-anln2,"Asset Subnumber
ANLN1 LIKE anlc-ANLN1,"Main Asset Number
GJAHR LIKE ANLC-GJAHR,"Fiscal Year
AFABE LIKE ANLC-AFABE,"Real depreciation area
ANSWL LIKE ANLC-ANSWL,"Transactions for the year
END OF GI_ANLC,
BEGIN OF gi_main OCCURS 0,
sno type i, "S.No
bukrs LIKE anla-bukrs,"Company code
ANLN1 LIKE anlc-ANLN1,"Main Asset Number
anln2 LIKE anlc-anln2,"Asset Subnumber
AKTIV LIKE ANLA-AKTIV,"Asset capitalization date
ANLKL LIKE ANLA-ANLKL,"Asset Class
NAFAG LIKE anlc-nafag,"Ordinary Depreciation Posted
kansw LIKE anlc-kansw,"Asset Acquisation Value
GJAHR LIKE ANLC-GJAHR,"Fiscal Year
PSTEND LIKE anlc-PSTEND,"Posting depreciation up to period
AFABE LIKE ANLC-AFABE,"Real depreciation area
ANSWL LIKE ANLC-ANSWL,"Transactions for the year
END OF gi_main.
START-OF-SELECTION.
PERFORM get_data.
PERFORM organize_data.
PERFORM f_display_report.
END-OF-SELECTION.
form get_data.
SELECT anlc~bukrs anlc~anln1 ANLC~ANLN2 kansw nafaG PSTEND ANSWL ANLKL AKTIV
INTO CORRESPONDING FIELDS OF TABLE gi_main
FROM
ANLC
INNER JOIN ANLA ON
anlc~bukrs = anla~bukrs AND
anlc~anln1 = anla~anln1 AND
ANLC~ANLN2 = ANLA~ANLN2
WHERE AFABE eq '1'
AND GJAHR IN S_GJAHR
AND ANLA~ANLKL in S_ANLKL.
ENDFORM.
FORM organize_data.
data: lv_index type sy-tabix.
LOOP at gi_anla.
move sy-tabix to gi_main-sno.
READ TABLE gi_anla WITH KEY bukrs = gi_anla-bukrs
anln1 = gi_anla-anln1
anln2 = gi_anla-anln2.
MOVE-CORRESPONDING gi_anla to gi_main.
READ TABLE gi_anlc WITH KEY bukrs = gi_anlc-bukrs
anln1 = gi_anlc-anln1
anln2 = gi_anlc-anln2.
IF sy-subrc = 0.
MOVE-CORRESPONDING gi_anlc to gi_main.
ENDIF.
APPEND gi_main.
CLEAR gi_main.
ENDLOOP.
ENDFORM.
form f_display_report.
perform fill_fieldcat using 'SNO' 5 'S.No.' 'gi_main'.
perform fill_fieldcat using 'ANLKL' 20 'Asset Class' 'gi_main'.
perform fill_fieldcat using 'ANLN1' 20 'Asset Number' 'gi_main'.
perform fill_fieldcat using 'ANLN2' 20 'Asset Subnumber' 'gi_main'.
perform fill_fieldcat using 'AKTIV' 20 'Asset Capitalization Date' 'gi_main'.
perform fill_fieldcat using 'KANSW' 20 'Asset Acquisation Value' 'gi_main'.
perform fill_fieldcat using 'NAFAG' 20 'Posted Depreciation' 'gi_main'.
perform fill_fieldcat using 'PSTEND' 20 'Posting depreciation up to period' 'gi_main'.
perform fill_fieldcat using 'ANSWL' 20 'Transactions for the year' 'gi_main'.
perform add_heading_alv using c_alv_head_header '' 'Ghulam Farooq Group'.
perform display_alv using gi_main[].
endform.
Thankks,
abapfkHi,
I created a program with the 2 select-option and a structure for storage and a select statement.
REPORT Z_ANLA_ANLC_TEST.
TABLES:ANEP,ANLA,ANLC.
SELECT-OPTIONS:
S_ANLKL FOR ANLA-ANLKL DEFAULT '1100' to '2790',
S_GJAHR FOR ANLC-GJAHR.
DATA :
BEGIN OF gi_main OCCURS 0,
sno type i, "S.No
bukrs LIKE anla-bukrs,"Company code
ANLN1 LIKE anlc-ANLN1,"Main Asset Number
anln2 LIKE anlc-anln2,"Asset Subnumber
AKTIV LIKE ANLA-AKTIV,"Asset capitalization date
ANLKL LIKE ANLA-ANLKL,"Asset Class
NAFAG LIKE anlc-nafag,"Ordinary Depreciation Posted
kansw LIKE anlc-kansw,"Asset Acquisation Value
GJAHR LIKE ANLC-GJAHR,"Fiscal Year
PSTEND LIKE anlc-PSTEND,"Posting depreciation up to period
AFABE LIKE ANLC-AFABE,"Real depreciation area
ANSWL LIKE ANLC-ANSWL,"Transactions for the year
END OF gi_main.
START-OF-SELECTION.
SELECT anlcbukrs anlcanln1 ANLC~ANLN2 kansw nafaG PSTEND ANSWL ANLKL AKTIV
INTO CORRESPONDING FIELDS OF TABLE gi_main
FROM
ANLC
INNER JOIN ANLA ON
anlcbukrs = anlabukrs AND
anlcanln1 = anlaanln1 AND
ANLCANLN2 = ANLAANLN2
WHERE AFABE eq '1'
AND GJAHR IN S_GJAHR
AND ANLA~ANLKL in S_ANLKL.
BREAK-POINT.
Here is the result at the break point
GI_MAIN[] Standard Table[831x12(116)]
S_ANLKL[] Standard Table[0x4(38)]
S_GJAHR[] Standard Table[1x4(22)]
S_GJAHR-LOW 2009
S_GJAHR-HIGH 0000
I entered value only in GJAHR.
I see there is no problem with the JOIN and the selection, i assume there is a problem with the data.
Try creating a simple query using sqvi and check it.
Regards,
George. -
Move the data in select options to internal table
I have the code as in the fillowing
SELECT-OPTION:S_MATNR FOR MARA-MATNR.
DATA:BEGIN OF IT_MATNTR OCCURS 0,
MATNR LIKE MARA-MATNR,
END OF IT-MATNR.
NOW HOW CAN I ADD THE MATNER VALUES IN THE SELECT-OPTIONS IN INTERNAL TABLEHi Vamsikrishna,
Yes. You can move the values from S_MATNR to IT_MATNR.
you can try either it_matnr[] = s_matnr[].
if not then you can loop in to the select-options as follows.
Define LS_MATNR as a structure type of s_matnr.
Define LS_IT_MATNR as a structure type of it_matnr.
LOOP S_MATNR INTO LS_MATNR.
MOVE LS_MATNR to LS_IT_MATNR.
APPEND LS_IT_MATNR to IT_MATNR.
CLEAR: LS_MATNR, LS_IT_MATNR.
ENDLOOP.
<b>Reward points for helpful answers.</b>
Best Regards,
Ram. -
Empty selection options after report run
Hi,
After the execution of my abap report sap returns to the selection options screen in which all the selected values from the run are still mentioned. How can i refresh the selection screen (so no values in the selection options after the report run) ?
this is the code (all parameters as you can see) :
parameters : p_matnr like mara-matnr default ''.
parameters : p_werks like mard-werks default 'XYZ',
p_lgort like mard-lgort default ''.
selection-screen skip 1.
parameters : p_qty like sy-tabix default 1.
selection-screen skip 1.
parameters : p_file like RLGRAP-FILENAME memory id GXD.
with regardshi
i tried for select-options try for parameters
at selection-screen .
if sy-ucomm = 'ONLI'. " Only when execute is pressed
v_low = s_kunnr-low.
v_high = s_kunnr-high . " Hang on to this for select statement
clear s_kunnr[].
clear s_kunnr. " Clear the screen parameter
endif.
for your program
data : matnr like mara-matnr, " variables are taken so that we can have the values for further operations
werks like mard-werks,
lgort like mard-lgort,
qty like sy-tabix,
file like RLGRAP-FILENAME.
at selection-screen.
if sy-ucomm = 'ONLI'. " Only when execute is pressed
matnr = p_matnr.
clear p_matnr.
werks = p_werks.
clear p_werks.
lgort = p_lgort.
clear p_lgort.
qty = p_qty.
clear p_qty.
file = p_file.
clear p_file.
endif.
start-of-selection. " write what ever code you have for the start-of-selection
NOTE "Remove the memory id for p_file otherwise it will not be cleared
regards
prasanth -
F4 help for date in select options..
Hi Gurus,
I want a search help for date field which belongs to select options.
I know if it is a parameter we directly map the attribute value to that data element.
Can some help me with this..
Best Regards,
Navin Fernandes.Hi Gurus,
The select options works for date.. I got the solution.
It directly relates to the default data dcitionary help.
Got it from this example: WDR_TEST_SELECT_OPTIONS
Best Regards,
Navin Fernandes. -
Problems with Custom Data Types when converting from TS 1.0 to 3.0.
I am currently involved in the process of converting a test environment from TestStand 1.0, LabVIEW 5.1, and Windows NT to TestStand 3.0, LabVIEW 7.0, and Windows XP. We use a custom Operator Interface developed in LV. Based on the entered Model and Serial number, the appropriate Test Sequence is called. We also use a custom Process Model. The steps in the Test Sequence are either LV code modules or DLLs created in C++. We have LV SubVIs and C++ API functions that allow the developers of the test steps to add data to various Custom Data Types. For example, a developer may set up a test to add a note (Step.Result.Notes[x].String) when the test fails. Step.Result.Notes is a container for an array of strings. The attempt to set a note first attempts to use SetDimensions to redimension the array, then SetValString to set the value. These notes are added to the report. On the old system, everything worked fine. A note could be added to any result. On the new system, if a note is added to say the 5th result, but results 1-4 do not have a note, the test sequence ends and the Operator Interface returns to waiting for data entry (as if no test ever happened). No report is generated. The LabVIEW libraries have been modified to solve this problem by calling SetDimensions to incrementally increase the array size by one, and populating the unused TestStand array elements with an empty array of LabVIEW strings using the SetValString call . In other words, based on the previous example, if the user wants to set a note for the 5th result, the notes for results 1-4 must first be sent an empty array of strings. The report will only display the note for Result 5 (as desired). In addition to this being cumbersome, attempting to implement the same workaround in the C++ API has been unsuccessful because even though the note arrays for unwanted notes (1-4) is initialized with nothing, it is still displayed as a note (empty) on the report. If anybody knows what is wrong and what the solution is, it will be appreciated.
Aaron,
Thanks for your reply. I will attempt to clarify. I am working with a single step. The step calls a DLL. The DLL performs many 'checks' on the UUT (e.g. Model Number Check, Serial Number Check, Calibration Constants Check, etc.). Under the Type Palette - MyTypes.ini, we have a Step Type called TEST_DLL with a container in it called Results. In the Results container are a number of things, but I will only list the important ones:
Notes (Array of Type 'Notes'; Type 'Notes' is a Custom Data Type (container, Type Definition)containing an array of strings called 'String')
-Notes are generally set when on of the checks fails, otherwise no Note is set for the check.
Val (Array of Type 'Val'; Type 'Val' is Custom Data Type (container, Type Definition) containing a Boolean called 'Boolean')
-Val indicates whether the check passed of failed
Pseudocode example:
//Model Number Check
check# = 0;
resultBOOL = ModelNumberCheck();
SetDimensions("Step.Result.Val", 0, "[0]", check#);
SetValBoolean("Step.Result.Val[check#].Boolean", 0, resultBOOL);
if(resultBOOL == FAIL)
Note# = 0;
SetDimensions("Step.Result.Notes", 0, "[0]", check#);
SetDimensions(Step.Result.Notes[check#].String, 0, "[0]", Note#);
SetValString("Step.Result.Notes[check#].String[Note#]", 0, "Model Number Check failed");
Note# = 1;
SetDimensions(Step.Result.Notes[check#].String, 0, "[0]", Note#);
SetValString("Step.Result.Notes[check#].String[Note#]", 0, "Model Number = 1234");
//Serial Number Check
check# = 1;
resultBOOL = SerialNumberCheck();
SetDimensions("Step.Result.Val", 0, "[0]", check#);
SetValBoolean("Step.Result.Val[check#].Boolean", 0, resultBOOL);
if(resultBOOL == FAIL)
Note# = 0;
SetDimensions("Step.Result.Notes", 0, "[0]", check#);
SetDimensions(Step.Result.Notes[check#].String, 0, "[0]", Note#);
SetValString("Step.Result.Notes[check#].String[Note#]", 0, "Serial Number does not match expected");
More Checks
As you can see above, the "Step.Result.Val" array is redimensioned for every check. The "Step.Result.Notes" array is only redimensioned when a note needs to be added for a failing check. If the entire step executes and no check adds a note, the sequence is fine. If every check fails and therefore every check adds a note, the sequence is fine. However, if there are any gaps (e.g. check 0 adds a note, check 1 does not add a note, and check 2 tries to add a note), the sequence will stop. If I add blank notes for every check that would otherwise not have a note, the sequence completes, but the report shows the blank note.
Also, the exact code that is causing these problems runs fine on our old systems (TestStand 1.0). I hope that I clarified the problem and thanks again for the help.
Maybe you are looking for
-
Report to Mail in eps format want to change
Hi Friends, When i am running a report and want the report should go directly to email i select email option , report gets generated in eps format which I want in pdf format how to do this ?? regds.sanjay pathak
-
Firewire 400 port??
Why don't the new MacBook Pro's have a firewire 400 port??
-
How to create a sequence in oracle forms6i
Oracle forms 6i Hai All I am working in leave application entry so i need to create a sequence for giving a unique number for each entry Pls tell me the steps how to created and how to call the sequence from database Thanks in Advance Srikkanth.m
-
Swf does not load completely in browsers
Hello, It looks like other people are having issues with uploading/viewing, but I can't seem to find an answer to my problem. There are pieces missing from my home page. When I go back to the home page from the other pages (by clicking on "Lindsey So
-
What is this status icon?
At the top of the iphone screen are the bars, time, battery indicator and also a phone receiver with about 10 dots underneath of it. What is this phone receiver icon representing? I could not find the symbol in the User manual. Thanks