2013 Feb 23 2:09 AM
Hello gurus,
I have an issue with the routine when I am writing at the info package level. I need to restrict the vales with X in deletion indicator ( field in structure)
The field is from the table PLMK
The ABAP which I wrote a code the deletion indicator is throwing errors I request you to let me know what changes I can do in the code. Please help me out with possible solutions.
I have written the code as follows
| *$*$ begin of routine - insert your code only below this line | *-* |
data: l_idx like sy-tabix.
data:it_LOEKZ like table of /BIO/PLOEKZ
data: it_loekz_wa type /BIO/PLOEKZ
read table l_t_range with key
| fieldname = 'LOEKZ'. |
l_idx = sy-tabix.
select* from /BIO/PLOEKZ into table it_loekz where
LOEKZ NE 'X'.
LOOP at it_loekz into it_loekz_wa
1_t_range-low = it_loekz_wa-LOEKZ
l_t_range-SIGN = 'I'.
l_t_range-OPTION = 'EQ'.
append l_t_range.
ENDLOOP.
modify l_t_range index l_idx.
2013 Feb 23 5:05 AM
Hello,
What error it is throwing?.Can you paste the snapshot of error here?
Regards
Katrice
2013 Feb 23 5:09 AM
Hi Harsha
It seems like typing mistake in this line
1_t_range-low = it_loekz_wa-LOEKZ
this should be
l_t_range-low = it_loekz_wa-LOEKZ
If not this.Please post the exact error which your are getting at syntax check.
Thanks,
Siva
2013 Feb 23 5:22 AM
Hi Harsha,
Please check you code as...the MODIFY statement that you have used.
I think it should be like:
MODIFY internal_table FROM work_area INDEX v_index TRANSPORTING fields_name.
Though I am not clear with your requirement but I felt you need to check the syntax of your code as per your requiremnt.
With regards,
Bishwajit.
2013 Feb 23 7:17 AM
Dear Sri,
Check modify statement.
modify l_t_range index l_idx from l_t_range_wa.
Regards,
Amol
2013 Feb 25 2:53 AM
Thank you Katricw, siva, Bishwajit, Amol. Actually the modify statements are predefined by the SAP the only code I have included was
Data: l_idx like sy-tabix.
it_LOEKZ like PLMK-LOEKZ.
it_loekz_wa type /BIO/PLOEKZ.
select * from PLMK into table it_loekz where
LOEKZ NE 'X'.
LOOP at it_loekz into it_loekz_wa
1_t_range-low = it_loekz_wa-LOEKZ.
l_t_range-SIGN = 'I'.
l_t_range-OPTION = 'EQ'.
append l_t_range.
ENDLOOP.
There is something wrong with the code I request you to suggest me if my code is right. I need to restrict the values 'X' for the field LOKEZ which is in table PLMK.
2013 Feb 25 4:05 AM
Hi Harsha,
The declaration of IT_LOEKZ should be changed, it is incorrect.
In the above code, IT_LOEKZ is declared as a field and you are trying to get values into a field and loop at a field. PLMK-LOEKZ is a field and not a structure or a table.
You need to declare it as below:
DATA : IT_LOEKZ TYPE STANDARD TABLE OF PLMK.
Also if you know what fields you need from PLMK, please declare TYPES structure with only those fields and select only those fields into the table.
Also please check if /BIO/PLOEKZ is a structure else please declare the work area as below.
DATA : WA_LOEKZ TYPE PLMK
as the work area should be compatible with the table you are looping at.
Let me know if this works for you and if you have any doubts. Also I would suggest you to add a sy-subrc check after Select statement and add the loop code within this check.
YOU CAN TRY THIS...
DATA : IT_LOEKZ TYPE STANDARD TABLE OF PLMK,
WA_LOEKZ TYPE PLMK,
L_T_RANGE TYPE RANGE OF LOEKZ.
W_T_RANGE LIKE LINE OF L_T_RANGE.
SELECT * FROM PLMK
INTO TABLE IT_LOEKZ
WHERE LOEKZ NE 'X'.
IF SY_SUBRC = 0.
LOOP AT IT_LOEKZ INTO WA_LOEKZ.
W_T_RANGE-LOW = WA_LOEKZ-LOEKZ.
W_T_RANGE-SIGN = 'I'.
W_T_RANGE-OPTION = 'EQ'.
APPEND W_T_RANGE TO L_T_RANGE.
CLEAR : W_T_RANGE,WA_LOEKZ.
ENDIF.