‎2009 Feb 10 10:33 AM
I want to export a field from program1 into selct-options of another program....i recieved some reply for this but they all have use of export and import statement. but I have to do this only by SUBMIT statement.please suggest me for this with vey clear concepts....as i have gone through help examples.(ONLY SUBMIT STATEMENT)
‎2009 Feb 10 10:36 AM
Hi,
Refer to this link..It is explained clearly with example..
http://help.sap.com/saphelp_nw70/helpdata/EN/9f/dba51a35c111d1829f0000e829fbfe/content.htm
Edited by: Avinash Kodarapu on Feb 10, 2009 4:14 PM
‎2009 Feb 10 10:38 AM
Hi,
Please refer to the code snippet (taken from sapdev.co.uk).
*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.
Thanks,
Sriram Ponna
‎2009 Feb 10 10:40 AM
‎2009 Feb 10 10:41 AM
Hi,
This example will resolves ur problem...
This program imports the other program fields into program 1(main)
*" Tables declarations.................................................
TABLES:
spfli.
*" Type declarations...................................................
"----
Type declaration of the structure to hold data from table SPFLI *
"----
TYPES:
BEGIN OF type_s_spfli,
carrid LIKE spfli-carrid, " Carrier Id
connid LIKE spfli-connid, " Connection Number
cityfrom LIKE spfli-cityfrom, " City from
cityto LIKE spfli-cityto, " City to
airpfrom LIKE spfli-airpfrom, " Airport from
airpto LIKE spfli-airpto, " Airport to
countryfr LIKE spfli-countryfr, " Country from
countryto LIKE spfli-countryto, " Country to
END OF type_s_spfli.
Data Declaration...................................................*
----
Field String To Hold Flight Details Record from SPFLI *
----
DATA
fs_spfli TYPE type_s_spfli.
Data Declaration...................................................*
----
Internal Table To Hold Flight Details Records from SPFLI *
----
DATA
t_spfli LIKE STANDARD TABLE OF fs_spfli.
TYPES:
BEGIN OF types_s_itab,
carrid LIKE sflight-carrid, " Carrier id
connid LIKE sflight-connid, " Connection number
fldate LIKE sflight-fldate, " Flight date
END OF types_s_itab.
Data Declaration...................................................*
----
Field String To Hold Flight Details Record from SFLIGHT *
----
DATA
fs_itab TYPE types_s_itab.
Data Declaration...................................................*
----
Internal Table To Hold Flight Details Records from SFLIGHT *
----
DATA
t_itab LIKE STANDARD TABLE OF fs_itab.
*" Type declarations...................................................
"----
Type declaration of the structure to hold data from table SBOOK *
"----
TYPES:
BEGIN OF type_s_sbook,
carrid LIKE sbook-carrid, " Carrier Id
connid LIKE sbook-connid, " Connection Number
fldate LIKE sbook-fldate, " Flight date
bookid LIKE sbook-bookid, " Booking number
loccuram LIKE sbook-loccuram, " Local currency
loccurkey LIKE sbook-loccurkey,
order_date LIKE sbook-order_date, " Booking date
END OF type_s_sbook.
Data Declaration...................................................*
----
Field String To Hold Flight Details Record from BOOK *
----
DATA
fs_sbook TYPE type_s_sbook.
Data Declaration...................................................*
----
Internal Table To Hold Flight Details Records from SBOOK *
----
DATA
t_sbook LIKE STANDARD TABLE OF fs_sbook.
DATA
w_checkbox. " Checkbox
SELECT-OPTIONS:
s_carr FOR spfli-carrid. " Carrier id range
"----
START-OF-SELECTION EVENT *
"----
START-OF-SELECTION.
PERFORM selectq.
"----
END-OF-SELECTION EVENT *
"----
END-OF-SELECTION.
SET PF-STATUS 'YH1315_030502'.
PERFORM display_basic.
AT USER-COMMAND.
PERFORM ucomm.
&----
*& Form selectq
&----
This subroutine retreive data from SPFLI table
----
There are no interface parameters to be passed to this subroutine.
----
FORM selectq .
SELECT carrid " Carrier id
connid " Connection number
cityfrom " City from
cityto " City to
airpfrom " Airport from
airpto " Airport to
countryfr " Country from
countryto " Country to
INTO CORRESPONDING FIELDS OF TABLE t_spfli
FROM spfli
WHERE carrid IN s_carr.
ENDFORM. " Selectq
&----
*& Form display_basic
&----
This subroutine displays data from internal table
----
There are no interface parameters to be passed to this subroutine.
----
FORM display_basic .
LOOP AT t_spfli INTO fs_spfli.
WRITE:
/ w_checkbox AS CHECKBOX,
fs_spfli-carrid,
fs_spfli-connid,
fs_spfli-cityfrom,
fs_spfli-cityto,
fs_spfli-airpfrom,
fs_spfli-airpto,
fs_spfli-countryfr,
fs_spfli-countryto.
ENDLOOP. " LOOP AT T-SPFLI INTO...
ENDFORM. " Display_basic
&----
*& Form UCOMM
&----
This subroutine for at user-command event
----
There are no interface parameters to be passed to this subroutine.
----
FORM ucomm .
RANGES :
r_carr FOR spfli-carrid,
r_conn FOR spfli-connid,
r_carrid FOR sflight-carrid,
r_connid FOR sflight-connid,
r_fldate FOR sflight-fldate.
CASE sy-ucomm.
WHEN 'DISPLAY'.
DATA:
lw_lines TYPE i,
lw_lineno TYPE i VALUE 3.
DESCRIBE TABLE t_spfli LINES lw_lines.
DO lw_lines TIMES.
READ LINE lw_lineno FIELD
VALUE w_checkbox INTO w_checkbox
fs_spfli-carrid INTO fs_spfli-carrid
fs_spfli-connid INTO fs_spfli-connid.
IF sy-subrc = 0.
IF w_checkbox = 'X'.
r_carr-sign = 'I'.
r_carr-option = 'EQ'.
r_carr-low = fs_spfli-carrid.
APPEND r_carr.
r_conn-sign = 'I'.
r_conn-option = 'EQ'.
r_conn-low = fs_spfli-connid.
APPEND r_conn.
ENDIF. " IF W_CHECKBOX = 'X'
ENDIF. " IF SY-SUBRC = 0
ADD 1 TO lw_lineno.
ENDDO. " DO LW_LINES TIMES
SUBMIT yh1314_030502_call
WITH s_carr IN r_carr
WITH s_conn IN r_conn
AND RETURN.
IMPORT t_itab FROM MEMORY ID 'YH1315'.
LOOP AT t_itab INTO fs_itab.
r_carrid-sign = 'I'.
r_carrid-option = 'EQ'.
r_carrid-low = fs_itab-carrid.
APPEND r_carrid.
r_connid-sign = 'I'.
r_connid-option = 'EQ'.
r_connid-low = fs_itab-connid.
APPEND r_connid.
r_fldate-sign = 'I'.
r_fldate-option = 'EQ'.
r_fldate-low = fs_itab-fldate.
APPEND r_fldate.
ENDLOOP. " LOOP AT T_ITAB INTO.....
SELECT carrid " Carriee Id
connid " Connection number
fldate " Flight date
bookid " Booking number
loccuram " Local Currency
order_date " Booking date
INTO CORRESPONDING FIELDS OF TABLE t_sbook
FROM sbook
WHERE carrid IN r_carrid AND
connid IN r_connid AND
fldate IN r_fldate.
IF SY-SUBRC NE 0.
MESSAGE 'NO RECORDS FOUND'(006) TYPE 'S'.
ENDIF. " IF SY-SUBRC NE 0
LOOP AT t_sbook INTO fs_sbook.
AT FIRST.
WRITE: /5 'Carrier Id'(001),
20 'Conn Id'(002),
35 'Flight date'(003),
50 'Book Id'(004),
65 'Local Currency'(005).
ENDAT. " AT FIRST
WRITE: /5 fs_sbook-carrid,
20 fs_sbook-connid,
35 fs_sbook-fldate,
50 fs_sbook-bookid,
65 fs_sbook-loccuram CURRENCY fs_sbook-loccurkey.
ENDLOOP. " LOOP AT T_SBOOK INTO.....
ENDCASE. " CASE SY-UCOMM
ENDFORM. " UCOMM
Edited by: Kiran Saka on Feb 10, 2009 11:42 AM
‎2009 Feb 10 1:02 PM
Hi Pankaj,
Here is an example for u , to fill the select-options of called program..
works perfectly....
REPORT CHK7SELSCRN.
TABLES:
spfli. " Flight Schedule
RANGES: seltab1 FOR spfli-carrid,
seltab2 FOR spfli-connid.
*" Data declarations...................................................
*"--------------------------------------------------------------------*
* Work Variables *
*"--------------------------------------------------------------------*
DATA:
w_checkbox, " CheckBox
w_lines TYPE i, " no. of lines in t_spfli
w_carrid TYPE spfli-carrid, " Carrier
w_connid TYPE spfli-connid. " ConnectionID
*" Screen Elements...................................................
*"--------------------------------------------------------------------*
* Declaration of Select-Options *
*"--------------------------------------------------------------------*
SELECT-OPTIONS: s_carier FOR w_carrid. " Carrier
*" Data declarations...................................................
*"--------------------------------------------------------------------*
* Declaration of Internal Table t_spfli *
*"--------------------------------------------------------------------*
DATA:
t_spfli LIKE
STANDARD TABLE
OF spfli.
*"--------------------------------------------------------------------*
* START OF SELECTION *
*"--------------------------------------------------------------------*
START-OF-SELECTION.
SET PF-STATUS 'FLDETAILS'.
SELECT carrid " Carrier
connid " ConnectionID
cityfrom " Departure City
cityto " Destination City
airpfrom " Departure Airport
airpto " Destination Airport
countryfr " Departure Country
countryto " Destination Country
FROM spfli
INTO CORRESPONDING FIELDS OF TABLE t_spfli
WHERE carrid IN s_carier.
* perform display_header.
LOOP AT t_spfli INTO spfli.
WRITE:/ w_checkbox AS CHECKBOX,
spfli-carrid UNDER text-002,
spfli-connid UNDER text-003,
spfli-cityfrom UNDER text-004,
spfli-cityto UNDER text-005,
spfli-airpfrom UNDER text-006,
spfli-airpto UNDER text-007,
spfli-countryfr UNDER text-008,
spfli-countryto UNDER text-009.
ENDLOOP. " LOOP AT T_SPFLI
*"--------------------------------------------------------------------*
* AT USER COMMAND *
*"--------------------------------------------------------------------*
AT USER-COMMAND.
DESCRIBE TABLE t_spfli LINES w_lines.
CASE sy-ucomm.
WHEN 'DISPLAY'.
DO w_lines TIMES.
READ LINE sy-index
FIELD VALUE w_checkbox
spfli-carrid
spfli-connid.
IF w_checkbox EQ 'X'.
seltab1-sign = 'I'.
seltab1-option = 'EQ'.
seltab1-low = spfli-carrid.
APPEND seltab1.
seltab2-sign = 'I'.
seltab2-option = 'EQ'.
seltab2-low = spfli-connid.
APPEND seltab2.
ENDIF.
ENDDO.
SUBMIT CHK7SELSCRN1 VIA SELECTION-SCREEN
WITH s_carrid IN seltab1
WITH s_connid IN seltab2
AND RETURN.
"where s_carrid,s_connid are select-options of reportCHK7SELSCRN1
ENDCASE.
u201Ccalled programu2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026..
REPORT CHK7SELSCRN1.
TABLES:
sflight.
SELECT-OPTIONS: s_carrid FOR sflight-carrid,
s_connid FOR sflight-connid.
DATA:
t_sflight LIKE
STANDARD TABLE
OF sflight.
SELECT carrid
connid
fldate
seatsmax
seatsocc
FROM sflight
INTO CORRESPONDING FIELDS OF TABLE t_sflight
WHERE carrid IN s_carrid
AND connid IN s_connid.
LOOP AT t_sflight INTO sflight.
WRITE:/5
sflight-carrid, " Carrier
14 sflight-connid, " ConnectionID
28 sflight-fldate, " FlightDate
44 sflight-seatsmax, " Maximum Seats
58 sflight-seatsocc. " Seats Occupied
ENDLOOP.
in select-options of chk7selscrn1 only s_carrid-low and s_connid -low gets populated the remaining values get populated in multiple selection(arrow-extension)
Regards,
Mdi.Deeba
‎2009 Feb 10 1:11 PM
Hi ,
Check this.
Program1.
Submit program2 with s_carrid in r_carrid
s_connid in r_connid and return.
( s_carrid and s_connid are select options of program2 )
Program2.
Use select-options in select query
‎2009 Feb 10 1:21 PM
Hello Pankaj,
You can also do the same job via SET PARAMETER ID and GET PARAMETER ID, but the only difference between SET PARAMETER and SUBMIT.... is SET PARAMETER sets at SAP memory and SUBMIT...sets at ABAP memory.
In the sending program,
PARAMETERS:
p_field1 TYPE char20,
p_field2 TYPE char20.
SET PARAMETER ID 'FIELD1' FIELD p_field1.
SET PARAMETER ID 'FIELD2' FIELD p_field2.In the receiving program,
DATA:
w_carrid TYPE sflight-carrid,
w_field1 TYPE char20,
w_field2 TYPE char20.
SELECT-OPTIONS:
s_carrid FOR w_carrid.
GET PARAMETER ID 'FILED1' FIELD w_low.
GET PARAMETER ID 'FILED2' FIELD w_high.
s_carrid-low = w_low.
s_carrid-high = w_high.
s_carrid-sign = 'I'.
s_carrid-option = 'BT'.now select-options is ready to be used in any select query.
Thanks: Zahackson
‎2009 Feb 10 1:48 PM
Hi.
use memory id to get the value from the one program to another program.
PARAMETERS: date1 like sy-datum MEMORY ID datum.in memory id it will store the value of parameter in Memory ID datum when u execute the program.
Now use in second program just like this.
PARAMETERS: date2 like sy-datum MEMORY ID datum.