2008 Nov 13 8:53 PM
HI all,
DATA: BEGIN OF I_MARD OCCURS 0,
MATNR LIKE MARD-MATNR, "18
WERKS LIKE MARD-WERKS, "4
LGORT LIKE MARD-LGORT, "4
LABST LIKE MARD-LABST, "18
END OF I_MARD.
SELECT MATNR
WERKS
LGORT
LABST
INTO TABLE I_MARD
FROM MARD.
LOOP AT I_MARD.
WRITE: / I_MARD(22).
IF NOT I_MARD+22 IS INITIAL.
WRITE:/ I_MARD+22.
ELSE.
WRITE:/20 '-'.
ENDIF.
ENDLOOP.
Here i am having total field legth is 42. In that i an writing first 22 char. after that i checking about the remaing data.
But it is not allowing me to activate..please check it & let know your inputs..
ok now ur req is clear:
here is the modified code>>>
REPORT zj_test.
DATA: BEGIN OF i_mard OCCURS 0,
matnr LIKE mard-matnr, "18
werks LIKE mard-werks, "4
lgort LIKE mard-lgort, "4
labst LIKE mard-labst, "18
END OF i_mard.
SELECT matnr
werks
lgort
labst
INTO TABLE i_mard
FROM mard.
LOOP AT i_mard.
WRITE: / i_mard(22).
IF NOT i_mard+0(22) IS INITIAL.
WRITE:/10 i_mard-lgort, i_mard-labst.
ELSE.
WRITE:/20 '-'.
ENDIF.
ENDLOOP.
2008 Nov 13 8:57 PM
Hi
you were missing +0(22)
DATA: BEGIN OF i_mard OCCURS 0,
matnr LIKE mard-matnr, "18
werks LIKE mard-werks, "4
lgort LIKE mard-lgort, "4
labst LIKE mard-labst, "18
END OF i_mard.
SELECT matnr
werks
lgort
labst
INTO TABLE i_mard
FROM mard.
LOOP AT i_mard.
WRITE: / i_mard(22).
IF NOT i_mard+0(22) IS INITIAL.
WRITE:/ i_mard+0(22).
ELSE.
WRITE:/20 '-'.
ENDIF.
ENDLOOP.
2008 Nov 13 9:09 PM
HI J@y,
As per your suggestion I have modified the code and activated. But it is not displaying full data.
Here in I_mard table I am having the below data.
Row MATNR WERKS LGORT LABST
1 20000901 1039 09B1 10.23
2 20000902 1039 911 10.25
3 20000902 1039 912 10.56
4 20000902 1039 913 10.56
5 20000902 1039 919 10.56
6 20000902 1039 921 10.56
7 20000902 1039 922 10.56
But in the output iam getting the only 2 fields of data so what about remaining LGORT and LABST.
20000901 1039
20000901 1039
20000902 1039
20000902 1039
20000902 1039
20000902 1039
20000902 1039
Here in my condition is;
1st MATNR and WERKS will be written and by using this statement: WRITE: / I_MARD(22).
and then by using the other condition iam checking the data of remaing 2 fileds.
IF NOT I_MARD+0(22) IS INITIAL.
WRITE:/ I_MARD+0(22).
ELSE.
WRITE:/20 '-'.
ENDIF.
if we dont have the date for next 3 fields '-' will be displayed.
Please check it. this is important for me..
Edited by: Mahaboob on Nov 13, 2008 10:10 PM
2008 Nov 13 9:20 PM
ok now ur req is clear:
here is the modified code>>>
REPORT zj_test.
DATA: BEGIN OF i_mard OCCURS 0,
matnr LIKE mard-matnr, "18
werks LIKE mard-werks, "4
lgort LIKE mard-lgort, "4
labst LIKE mard-labst, "18
END OF i_mard.
SELECT matnr
werks
lgort
labst
INTO TABLE i_mard
FROM mard.
LOOP AT i_mard.
WRITE: / i_mard(22).
IF NOT i_mard+0(22) IS INITIAL.
WRITE:/10 i_mard-lgort, i_mard-labst.
ELSE.
WRITE:/20 '-'.
ENDIF.
ENDLOOP.
2008 Nov 13 9:58 PM
HI J@y,
Asper your logic agian your checking 1st 2 fields. bUt my requirement is i need to check 3rd and 4th field of data. if no data in 3rd and 4th field i need to pass '-'
LOOP AT i_mard.
WRITE: / i_mard(22).
IF NOT i_mard+0(22) IS INITIAL.
WRITE:/10 i_mard-lgort, i_mard-labst.
ELSE.
WRITE:/20 '-'.
ENDIF.
ENDLOOP.
please check it once..
2008 Nov 13 10:04 PM
oh man!!!!
LOOP AT i_mard.
WRITE: / i_mard(22).
IF NOT i_mard-lgort IS INITIAL AND i_mard-labst IS INITIAL. " check if you need *and* or *OR*
WRITE:/10 i_mard-lgort, i_mard-labst.
ELSE.
WRITE:/20 '-'.
ENDIF.
ENDLOOP.
2008 Nov 17 11:34 AM
2008 Nov 13 9:06 PM
assuming you want to write the last 20 bytes use
IF NOT I_MARD+22(20) IS INITIAL.
WRITE:/ I_MARD+22(20).
2008 Nov 13 9:17 PM
HI MxG,
getting this error.
The sum of the offset and length (=44) exceeds the length of the start
(=26) of the structure. - not allowed in Unicode programs. -
Program Y_TEST1234
The sum of the offset and length (=44) exceeds the length of the start
(=26) of the structure. - not allowed in Unicode programs. -
NOt activatiing..
2008 Nov 13 9:41 PM
any issue in using direct field names in write
write: / i_mard-MATNR , i_mard-WERKS ,i_mard-LGORT , i_mard-LABST .
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |