2007 Oct 16 6:20 PM
hi,
i doing that perform and i wont to use table r_sel not only in the perform i try with perform tables but i have an erorr
this is my data and call perform
DATA: BEGIN OF rtab ,
sign(1) TYPE c,
option(2) TYPE c,
low TYPE datum,
high TYPE datum,
END OF rtab .
DATA: r_sel TYPE STANDARD TABLE OF rtab.
PERFORM define-periods USING date_from1 date_to1
date_from2 date_to2 TABLES r_sel.
"this is the form
*&---------------------------------------------------------------------*
*& Form define-periods
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_DATE_FROM1 text
* -->P_DATE_TO1 text
* -->P_DATE_FROM2 text
* -->P_DATE_TO2 text
* -->P_R_SEL text
*----------------------------------------------------------------------*
FORM define-periods USING p_date_from1
p_date_to1
p_date_from2
p_date_to2
TABLES p_r_sel . "i think the problem is here i i try with structre rtab buti have eroor to
RANGES: r_per1 FOR sy-datum .
RANGES: r_per2 FOR sy-datum .
MOVE 'I' TO r_per1-sign .
MOVE 'BT' TO r_per1-option .
CONCATENATE p_date_from1 '01' INTO r_per1-low .
IF p_date_to1 IS INITIAL .
PERFORM last-day
USING p_date_from1
CHANGING r_per1-high .
ELSE.
PERFORM last-day
USING p_date_to1
CHANGING r_per2-high.
ENDIF .
APPEND r_per1 .
MOVE 'I' TO r_per2-sign .
MOVE 'BT' TO r_per2-option .
CONCATENATE p_date_from2 '01' INTO r_per2-low .
IF p_date_to2 IS INITIAL .
PERFORM last-day
USING p_date_from2
CHANGING r_per2-high .
ELSE.
PERFORM last-day
USING p_date_to2
CHANGING r_per1-high.
ENDIF .
APPEND r_per2 .
"here i append r_sel
MOVE r_per1-sign TO r_sel-sign.
MOVE r_per1-option TO r_sel-option .
MOVE r_per1-low TO r_sel-low .
MOVE r_per1-high TO r_sel-high .
APPEND r_sel .
MOVE r_per2-sign TO r_sel-sign .
MOVE r_per2-option TO r_sel-option .
MOVE r_per2-low TO r_sel-low .
MOVE r_per2-high TO r_sel-high .
APPEND r_sel .
ENDFORM. " define-periods
the first erorr is:
The field "R_SEL" is unknown, but there is a field with the similar name "P_R_SEL". "P_R_SEL".
when i change it to p_r_sel
i get erorr
The data object "P_R_SEL" has no structure and therefore no component called "SIGN". called "SIGN".
Regards
2007 Oct 16 7:29 PM
Hi,
Well ... I thought you changed to these lines as I mentioned in the previous reply. I guess not.
TYPES: BEGIN OF rtab ,
sign(1) TYPE c,
option(2) TYPE c,
low TYPE datum,
high TYPE datum,
END OF rtab .
DATA: r_sel TYPE TABLE OF rtab,
wa_sel LIKE line of r_sel.
...
Regards,
Ferry Lianto
hi,
i doing that perform and i wont to use table r_sel not only in the perform i try with perform tables but i have an erorr
this is my data and call perform
DATA: BEGIN OF rtab ,
sign(1) TYPE c,
option(2) TYPE c,
low TYPE datum,
high TYPE datum,
END OF rtab .
DATA: r_sel TYPE STANDARD TABLE OF rtab.
PERFORM define-periods USING date_from1 date_to1
date_from2 date_to2 TABLES r_sel.
"this is the form
*&---------------------------------------------------------------------*
*& Form define-periods
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_DATE_FROM1 text
* -->P_DATE_TO1 text
* -->P_DATE_FROM2 text
* -->P_DATE_TO2 text
* -->P_R_SEL text
*----------------------------------------------------------------------*
FORM define-periods USING p_date_from1
p_date_to1
p_date_from2
p_date_to2
TABLES p_r_sel . "i think the problem is here i i try with structre rtab buti have eroor to
RANGES: r_per1 FOR sy-datum .
RANGES: r_per2 FOR sy-datum .
MOVE 'I' TO r_per1-sign .
MOVE 'BT' TO r_per1-option .
CONCATENATE p_date_from1 '01' INTO r_per1-low .
IF p_date_to1 IS INITIAL .
PERFORM last-day
USING p_date_from1
CHANGING r_per1-high .
ELSE.
PERFORM last-day
USING p_date_to1
CHANGING r_per2-high.
ENDIF .
APPEND r_per1 .
MOVE 'I' TO r_per2-sign .
MOVE 'BT' TO r_per2-option .
CONCATENATE p_date_from2 '01' INTO r_per2-low .
IF p_date_to2 IS INITIAL .
PERFORM last-day
USING p_date_from2
CHANGING r_per2-high .
ELSE.
PERFORM last-day
USING p_date_to2
CHANGING r_per1-high.
ENDIF .
APPEND r_per2 .
"here i append r_sel
MOVE r_per1-sign TO r_sel-sign.
MOVE r_per1-option TO r_sel-option .
MOVE r_per1-low TO r_sel-low .
MOVE r_per1-high TO r_sel-high .
APPEND r_sel .
MOVE r_per2-sign TO r_sel-sign .
MOVE r_per2-option TO r_sel-option .
MOVE r_per2-low TO r_sel-low .
MOVE r_per2-high TO r_sel-high .
APPEND r_sel .
ENDFORM. " define-periods
the first erorr is:
The field "R_SEL" is unknown, but there is a field with the similar name "P_R_SEL". "P_R_SEL".
when i change it to p_r_sel
i get erorr
The data object "P_R_SEL" has no structure and therefore no component called "SIGN". called "SIGN".
Regards
2007 Oct 16 6:23 PM
Hi,
Please try this.
DATA: BEGIN OF rtab ,
sign(1) TYPE c,
option(2) TYPE c,
low TYPE datum,
high TYPE datum,
END OF rtab .
DATA: r_sel TYPE STANDARD TABLE OF rtab.
DATA: wa_sel LIKE rtab.
PERFORM define-periods TABLES r_sel
USING date_from1 date_to1
date_from2 date_to2.
*&---------------------------------------------------------------------*
*& Form define-periods
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_DATE_FROM1 text
* -->P_DATE_TO1 text
* -->P_DATE_FROM2 text
* -->P_DATE_TO2 text
* -->P_R_SEL text
*----------------------------------------------------------------------*
FORM define-periods TABLES p_r_sel
USING p_date_from1
p_date_to1
p_date_from2
p_date_to2.
RANGES: r_per1 FOR sy-datum .
RANGES: r_per2 FOR sy-datum .
MOVE 'I' TO r_per1-sign .
MOVE 'BT' TO r_per1-option .
CONCATENATE p_date_from1 '01' INTO r_per1-low .
IF p_date_to1 IS INITIAL .
PERFORM last-day
USING p_date_from1
CHANGING r_per1-high .
ELSE.
PERFORM last-day
USING p_date_to1
CHANGING r_per2-high.
ENDIF .
APPEND r_per1 .
MOVE 'I' TO r_per2-sign .
MOVE 'BT' TO r_per2-option .
CONCATENATE p_date_from2 '01' INTO r_per2-low .
IF p_date_to2 IS INITIAL .
PERFORM last-day
USING p_date_from2
CHANGING r_per2-high .
ELSE.
PERFORM last-day
USING p_date_to2
CHANGING r_per1-high.
ENDIF .
APPEND r_per2 .
"here i append r_sel
MOVE r_per1-sign TO wa_sel-sign.
MOVE r_per1-option TO wa_sel-option .
MOVE r_per1-low TO wa_sel-low .
MOVE r_per1-high TO wa_sel-high .
APPEND wa_sel to p_r_sel .
MOVE r_per2-sign TO wa_sel-sign .
MOVE r_per2-option TO wa_sel-option .
MOVE r_per2-low TO wa_sel-low .
MOVE r_per2-high TO wa_sel-high .
APPEND wa_sel to p_r_sel .
ENDFORM. " define-periods
Regards,
Ferry Lianto
2007 Oct 16 6:27 PM
hi ferry
thankes for your replay
i cange it but i have erorr
The data object "R_SEL" has no structure and therefore no component
called "SIGN". called "SIGN".
Regards
2007 Oct 16 6:32 PM
You need to declare workarea explicitly for R_SEL.
And use this while inserting data to P_R_SEL.
DATA: r_sel TYPE STANDARD TABLE OF rtab,
wa_sel type rtab.
Later in FORM routine code -
append WA_SEL tp P_R_SEL.
This should solve your problem.
ashish
2007 Oct 16 6:37 PM
hi ashish
i try it but i have the erorr here
<b>MOVE r_per1-sign TO r_sel-sign.</b>
MOVE r_per1-option TO r_sel-option .
MOVE r_per1-low TO r_sel-low .
MOVE r_per1-high TO r_sel-high .
APPEND r_sel .
MOVE r_per2-sign TO r_sel-sign .
MOVE r_per2-option TO r_sel-option .
MOVE r_per2-low TO r_sel-low .
MOVE r_per2-high TO r_sel-high .
APPEND r_sel .
the erorr:
The field "R_SEL" is unknown, but there is a field with the similar name "P_R_SEL". "P_R_SEL".
and when i change it to
p_r_sel
i get this erorr
name "P_R_SEL". "P_R_SEL".
The data object "P_R_SEL" does not have a component called "SIGN".
Regards
2007 Oct 16 6:41 PM
You should do this.
Declare a work area in your data declaration -
data: wa_sel type rtab.
In your FORM code, you need to assign values to this work area.
CLEAR WA_SEL.
MOVE r_per1-sign TO WA_sel-sign.
MOVE r_per1-option TO WA_sel-option .
MOVE r_per1-low TO WA_sel-low .
MOVE r_per1-high TO WA_sel-high .
APPEND WA_sel TO P_R_SEL.
MOVE r_per2-sign TO AW_sel-sign .
MOVE r_per2-option TO WA_sel-option .
MOVE r_per2-low TO WA_sel-low .
MOVE r_per2-high TO WA_sel-high .
APPEND WA_sel TO P_R_SEL.
This should help you out.
REMEMBER, R_SEL is named as P_R_SEL in the FORM so you need to use P_R_SEL.
ashish
2007 Oct 16 6:43 PM
hi ferry
thankes
i try exactly like u write and i have this erorr
Field "WA_SEL-SIGN" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement.
maybe becouse i do that in FM
i have to declare the data in other place
regards
2007 Oct 16 6:26 PM
Check this out -
I have modified your code -
PERFORM define-periods <b>TABLES r_sel
uSING date_from1 date_to1
date_from2 date_to2</b> .
&----
*& Form define-periods
&----
text
----
-->P_DATE_FROM1 text
-->P_DATE_TO1 text
-->P_DATE_FROM2 text
-->P_DATE_TO2 text
-->P_R_SEL text
----
FORM define-periods <b>TABLES P_R_SEL STRUCTURE rtab
USING P_DATE_FROM1
P_DATE_TO1
P_DATE_FROM2
P_DATE_TO2</b>.
RANGES: r_per1 FOR sy-datum .
RANGES: r_per2 FOR sy-datum .
*
*
*
MOVE 'I' TO r_per1-sign .
MOVE 'BT' TO r_per1-option .
CONCATENATE p_date_from1 '01' INTO r_per1-low .
IF p_date_to1 IS INITIAL .
PERFORM last-day
USING p_date_from1
CHANGING r_per1-high .
ELSE.
PERFORM last-day
USING p_date_to1
CHANGING r_per2-high.
*
ENDIF .
APPEND r_per1 .
ENDFORM. " define-periods
Hope this helps. Check the sequence of TABLES and USING.
ashish
2007 Oct 16 6:32 PM
2007 Oct 16 6:28 PM
Hi,
you can use the TABLES addition in the FORM definition, but what i usually do is define a table type and add it to the CHANGING parameters.
FORM just_do_it USING a type c
CHANGING pi_tt type tt_table.
where tt_table is a table type.
regards,
Hans
2007 Oct 16 6:39 PM
Hi,
Please try this again.
DATA: BEGIN OF rtab ,
sign(1) TYPE c,
option(2) TYPE c,
low TYPE datum,
high TYPE datum,
END OF rtab .
DATA: r_sel TYPE STANDARD TABLE OF rtab.
DATA: wa_sel LIKE rtab. "Add here
PERFORM define-periods TABLES r_sel "Change here
USING date_from1 date_to1
date_from2 date_to2.
*&---------------------------------------------------------------------*
*& Form define-periods
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_DATE_FROM1 text
* -->P_DATE_TO1 text
* -->P_DATE_FROM2 text
* -->P_DATE_TO2 text
* -->P_R_SEL text
*----------------------------------------------------------------------*
FORM define-periods TABLES p_r_sel "Change here
USING p_date_from1
p_date_to1
p_date_from2
p_date_to2.
RANGES: r_per1 FOR sy-datum .
RANGES: r_per2 FOR sy-datum .
MOVE 'I' TO r_per1-sign .
MOVE 'BT' TO r_per1-option .
CONCATENATE p_date_from1 '01' INTO r_per1-low .
IF p_date_to1 IS INITIAL .
PERFORM last-day
USING p_date_from1
CHANGING r_per1-high .
ELSE.
PERFORM last-day
USING p_date_to1
CHANGING r_per2-high.
ENDIF .
APPEND r_per1 .
MOVE 'I' TO r_per2-sign .
MOVE 'BT' TO r_per2-option .
CONCATENATE p_date_from2 '01' INTO r_per2-low .
IF p_date_to2 IS INITIAL .
PERFORM last-day
USING p_date_from2
CHANGING r_per2-high .
ELSE.
PERFORM last-day
USING p_date_to2
CHANGING r_per1-high.
ENDIF .
APPEND r_per2 .
MOVE r_per1-sign TO wa_sel-sign. "Change here
MOVE r_per1-option TO wa_sel-option. "Change here
MOVE r_per1-low TO wa_sel-low. "Change here
MOVE r_per1-high TO wa_sel-high. "Change here
APPEND wa_sel to p_r_sel . "Change here
CLEAR wa_sel. "Add here
MOVE r_per2-sign TO wa_sel-sign . "Change here
MOVE r_per2-option TO wa_sel-option. "Change here
MOVE r_per2-low TO wa_sel-low. "Change here
MOVE r_per2-high TO wa_sel-high . "Change here
APPEND wa_sel to p_r_sel. "Change here
CLEAR wa_sel. "Add here
ENDFORM. " define-periods
Regards,
Ferry Lianto
2007 Oct 16 6:47 PM
Hi,
Did you declare this line? Please check my codes.
DATA: wa_sel LIKE rtab. "Add here
Regards,
Ferry Lianto
2007 Oct 16 6:50 PM
hi ferry
yes i do that this is my new code
DATA: BEGIN OF rtab ,
sign(1) TYPE c,
option(2) TYPE c,
low TYPE datum,
high TYPE datum,
END OF rtab .
DATA: r_sel TYPE TABLE OF rtab,
wa_sel LIKE rtab.
PERFORM define-period TABLES r_sel USING date_from1 date_to1
date_from2 date_to2 .
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_R_SEL text
* -->P_DATE_FROM1 text
* -->P_DATE_TO1 text
* -->P_DATE_FROM2 text
* -->P_DATE_TO2 text
*----------------------------------------------------------------------*
FORM define-period TABLES p_r_sel STRUCTURE rtab
USING p_date_from1
p_date_to1
p_date_from2
p_date_to2.
RANGES: r_per1 FOR sy-datum .
RANGES: r_per2 FOR sy-datum .
MOVE 'I' TO r_per1-sign .
MOVE 'BT' TO r_per1-option .
CONCATENATE p_date_from1 '01' INTO r_per1-low .
IF p_date_to1 IS INITIAL .
PERFORM last-day
USING p_date_from1
CHANGING r_per1-high .
ELSE.
PERFORM last-day
USING p_date_to1
CHANGING r_per2-high.
ENDIF .
APPEND r_per1 .
MOVE 'I' TO r_per2-sign .
MOVE 'BT' TO r_per2-option .
CONCATENATE p_date_from2 '01' INTO r_per2-low .
IF p_date_to2 IS INITIAL .
PERFORM last-day
USING p_date_from2
CHANGING r_per2-high .
ELSE.
PERFORM last-day
USING p_date_to2
CHANGING r_per1-high.
ENDIF .
APPEND r_per2 .
MOVE: r_per1-sign TO wa_sel-sign,
r_per1-option TO wa_sel-option ,
r_per1-low TO wa_sel-low ,
r_per1-high TO wa_sel-high .
APPEND wa_sel TO p_r_sel .
MOVE r_per2-sign TO wa_sel-sign .
MOVE r_per2-option TO wa_sel-option .
MOVE r_per2-low TO wa_sel-low .
MOVE r_per2-high TO wa_sel-high .
APPEND wa_sel TO p_r_sel .
Best regards
2007 Oct 16 6:54 PM
So after this change, are you still getting an error?
If yes, what is the error?
ashish
2007 Oct 16 6:55 PM
hi ashish
thankes for your time
i get this erorr:
Field "WA_SEL-SIGN" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement.
regards
2007 Oct 16 6:58 PM
2007 Oct 16 6:59 PM
Do one thing. Declare WA_SEL in your FORM.
As you are using this only in your FORM, let it be declared as Local work area and try again.
I check my program but it is not giving an error.
ashish
2007 Oct 16 7:03 PM
I think I see. Is this code part of a form:
DATA: BEGIN OF rtab ,
sign(1) TYPE c,
option(2) TYPE c,
low TYPE datum,
high TYPE datum,
END OF rtab .
DATA: r_sel TYPE TABLE OF rtab,
wa_sel LIKE rtab.
PERFORM define-period TABLES r_sel USING date_from1 date_to1
date_from2 date_to2 .
If so, move the data declaration out of the form to the global data decarations (probably at the top of the program).
Rob
2007 Oct 16 7:15 PM
hi rob
thankes
i move this declartion to the top and it help i dont have anymore erorr but when
i check in the debbuger table r_sel i get somethihng strange
table with 6 fields not in stuctre like rtab and all the data is in one string in the first field that call aprogname(char40)
IBT2007090120070930
the next field is empty name ddfield (char 30)
what is wrong?
regards
2007 Oct 16 7:24 PM
Unfortunately, there is a datadictionary table RTAB. So change RTAB to XTAB in your program:
types: BEGIN OF xtab ,
sign(1) TYPE c,
option(2) TYPE c,
low TYPE datum,
high TYPE datum,
END OF xtab .
DATA: r_sel TYPE TABLE OF xtab,
wa_sel type xtab.
DATA: date_from1 TYPE sy-datum,
date_to1 TYPE sy-datum,
date_from2 TYPE sy-datum,
date_to2 TYPE sy-datum.
PERFORM define-period TABLES r_sel USING date_from1 date_to1
date_from2 date_to2 .
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM define-period TABLES p_r_sel STRUCTURE wa_sel
USING p_date_from1
p_date_to1
p_date_from2
p_date_to2.
RANGES: r_per1 FOR sy-datum .
RANGES: r_per2 FOR sy-datum .
MOVE 'I' TO r_per1-sign .
MOVE 'BT' TO r_per1-option .
CONCATENATE p_date_from1 '01' INTO r_per1-low .
IF p_date_to1 IS INITIAL .
PERFORM last-day
USING p_date_from1
CHANGING r_per1-high .
ELSE.
PERFORM last-day
USING p_date_to1
CHANGING r_per2-high.
ENDIF .
APPEND r_per1 .
MOVE 'I' TO r_per2-sign .
MOVE 'BT' TO r_per2-option .
CONCATENATE p_date_from2 '01' INTO r_per2-low .
IF p_date_to2 IS INITIAL .
PERFORM last-day
USING p_date_from2
CHANGING r_per2-high .
ELSE.
PERFORM last-day
USING p_date_to2
CHANGING r_per1-high.
ENDIF .
APPEND r_per2 .
MOVE: r_per1-sign TO wa_sel-sign,
r_per1-option TO wa_sel-option ,
r_per1-low TO wa_sel-low ,
r_per1-high TO wa_sel-high .
APPEND wa_sel TO p_r_sel .
MOVE r_per2-sign TO wa_sel-sign .
MOVE r_per2-option TO wa_sel-option .
MOVE r_per2-low TO wa_sel-low .
MOVE r_per2-high TO wa_sel-high .
APPEND wa_sel TO p_r_sel .
ENDFORM. "define-period
Rob
2007 Oct 16 6:56 PM
Hi,
Please change to this.
TYPES: BEGIN OF rtab ,
sign(1) TYPE c,
option(2) TYPE c,
low TYPE datum,
high TYPE datum,
END OF rtab .
DATA: r_sel TYPE TABLE OF rtab,
wa_sel LIKE line of r_sel.
...
Regards,
Ferry Lianto
2007 Oct 16 6:58 PM
hi ferry
i try it myself but its not working.
maybe the erorr is becouse i use fm and i do that perform in top include?
Regards
2007 Oct 16 7:01 PM
Hi,
It is weird ... it is fine in my program.
Try to declare in top include. Then check and generate from main program.
Regards,
Ferry Lianto
2007 Oct 16 7:29 PM
Hi,
Well ... I thought you changed to these lines as I mentioned in the previous reply. I guess not.
TYPES: BEGIN OF rtab ,
sign(1) TYPE c,
option(2) TYPE c,
low TYPE datum,
high TYPE datum,
END OF rtab .
DATA: r_sel TYPE TABLE OF rtab,
wa_sel LIKE line of r_sel.
...
Regards,
Ferry Lianto
2007 Oct 16 7:45 PM
Ferry - when I tried his code, it incorporated your changes, but still got the error he mentioned. I think it was due to the fact that RTAB is a data dictionary object. In:
FORM define-period TABLES p_r_sel STRUCTURE RTAB
I think it picks up the data dictionary structure, not the one in the program. To avoid confusion, I suggested he not use that name at all and go with something like XTAB.
Rob
2007 Oct 16 7:52 PM
Hi Rob,
Please try to remove STRUCTURE RTAB.
It works fine in my program.
FORM define-period TABLES p_r_sel
USING ....
Regards,
Ferry Lianto
2007 Oct 16 8:05 PM
thankes rob & ferry
both u solved my problem u a great
sorry that i cant put 10 points to u both.
Best regards
2007 Oct 16 8:12 PM
Glad to help - I think it was Ferry that did most of the work.
Rob
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |