12-21-2006 9:02 AM
Hallow I wont to do a string dynamic that when I wont to ask for relation 027 and 034 the string bring me both of relation my problem is that didnt work what wrong.
DATA ceck_str TYPE string.
IF switch_history = 'X' .
ceck_str = 'relat EQ ''027'''.
ELSE.
<b>ceck_str = 'relat EQ ''027'' OR relat EQ ''034'''.</b> ENDIF.
3----select the employee who register to course--
SELECT objid sobid priox istat endda begda
FROM hrp1001
INTO CORRESPONDING FIELDS OF TABLE d_itab
FOR ALL ENTRIES IN z_course_table
WHERE otype = 'D'
AND objid = z_course_table-objid
AND sclas = 'P'
<b>AND (ceck_str).</b>
regards
12-21-2006 9:21 AM
I am not sure why are you using a string but the best option is to use ranges.
Ranges : r_relat like hrp1001-relat.
If switch_history = 'X'.
r_relat-low = '027'.
r_relat-sign = 'EQ'.
r_relat-option = 'I'.
append r_relat.
else.
r_relat-low = '027'.
r_relat-sign = 'EQ'.
r_relat-option = 'I'.
append r_relat.
r_relat-low = '034'.
r_relat-sign = 'EQ'.
r_relat-option = 'I'.
append r_relat.
endif.
SELECT objid sobid priox istat endda begda
FROM hrp1001
INTO CORRESPONDING FIELDS OF TABLE d_itab
FOR ALL ENTRIES IN z_course_table
WHERE otype = 'D'
AND objid = z_course_table-objid
AND sclas = 'P'
AND relat in r_relat.
12-21-2006 9:10 AM
i think u have to right code as -
DATA ceck_str TYPE string.
IF switch_history = 'X' .
SELECT objid sobid priox istat endda begda
FROM hrp1001
INTO CORRESPONDING FIELDS OF TABLE d_itab
FOR ALL ENTRIES IN z_course_table
WHERE otype = 'D'
AND objid = z_course_table-objid
AND sclas = 'P'
AND subty cp '*027'.
ELSE.
SELECT objid sobid priox istat endda begda
FROM hrp1001
INTO CORRESPONDING FIELDS OF TABLE d_itab
FOR ALL ENTRIES IN z_course_table
WHERE otype = 'D'
AND objid = z_course_table-objid
AND sclas = 'P'
AND ( subty cp '27' or subty cp '34' ).
endif.
12-21-2006 9:16 AM
hi amit what is AND subty cp '027'.or AND subty cp '027'. i dont understand
12-21-2006 9:26 AM
Hi!
I found it in the ABAP HELP of the keyword WHERE:
PARAMETERS: airline(2) TYPE C,
date TYPE D.
DATA: where_clause TYPE STRING,
connid TYPE sflight-connid.
CONCATENATE 'carrid = ''' airline '''' "<-only apostrofes
' AND fldate = ''' date '''' INTO where_clause.
SELECT connid FROM sflight INTO connid
WHERE (where_clause).
WRITE: / date, airline, connid.
ENDSELECT.
You can mix static (variants 1 and 2) and dynamic conditions (variant 3) any way you like in WHERE clauses.
Regards
Tamá
12-21-2006 9:21 AM
I am not sure why are you using a string but the best option is to use ranges.
Ranges : r_relat like hrp1001-relat.
If switch_history = 'X'.
r_relat-low = '027'.
r_relat-sign = 'EQ'.
r_relat-option = 'I'.
append r_relat.
else.
r_relat-low = '027'.
r_relat-sign = 'EQ'.
r_relat-option = 'I'.
append r_relat.
r_relat-low = '034'.
r_relat-sign = 'EQ'.
r_relat-option = 'I'.
append r_relat.
endif.
SELECT objid sobid priox istat endda begda
FROM hrp1001
INTO CORRESPONDING FIELDS OF TABLE d_itab
FOR ALL ENTRIES IN z_course_table
WHERE otype = 'D'
AND objid = z_course_table-objid
AND sclas = 'P'
AND relat in r_relat.
12-21-2006 11:07 AM
hi anurag i try your soltion but it bring me a 2 errors like that u have any soltion
thankes men.
The current ABAP/4 program attempted to execute an ABAP/4 Open SQL
statement in which the WHERE condition contains an IN itab operator.
The IN itab operator is used with internal tables which
have the following structure:
SIGN(1) OPTION(2) LOW LIKE db_field HIGH LIKE db_field
The OPTION column should contain only one of the following values:
"EQ LE GE CP BT NE LT GT NP NB"
The value "I " is not allowed here.
AND WHEN I *ASTRICK r_relat-option = 'I'. THIS IS MY ERROR
The IN itab operator is used with internal tables which
have the following structure:
SIGN(1) OPTION(2) LOW LIKE db_field HIGH LIKE db_field
The OPTION column should contain only one of the following values:
"EQ LE GE CP BT NE LT GT NP NB"
The value " " is not allowed here
REGARDS
12-21-2006 11:10 AM
Sorry my mistake ...please check the change in bold.
If switch_history = 'X'.
r_relat-low = '027'.
<b>r_relat-sign = 'I'.
r_relat-option = 'EQ'.</b>
append r_relat.
else.
r_relat-low = '027'.
<b>r_relat-sign = 'I'.
r_relat-option = 'EQ'.</b>append r_relat.
r_relat-low = '034'.
r_relat-sign = 'EQ'.
r_relat-option = 'I'.
append r_relat.
endif.
12-21-2006 9:49 AM
hi
good
go through this link which ll give you detail idea about the dynamic screen
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbab1c35c111d1829f0000e829fbfe/content.htm
thanks
mrutyun^
12-21-2006 9:53 AM
Hi Tal
Duplicate thread...
Please close one of the thread and continue with the other...
Request you not to open duplicate threads on same topic...
Regards
Eswar
12-21-2006 11:44 AM
hi try this
IF switch_history = 'X' .
ceck_str = 'relat EQ ''027'''.
ELSE.
ceck_str = 'relat in ( ''027'' , ''034'' )'. ENDIF.
or
IF switch_history = 'X' .
ceck_str = 'relat EQ ''027'''.
ELSE.
ceck_str = ' ( relat EQ ''027'' OR relat EQ ''034'' )'. ENDIF.
regards
shiba dutta
regards