‎2006 Feb 08 3:54 AM
Hi all,
Can you clarify my Doubt.
My problem is , i have 10 Columns in Report Output.
Iam displaying the Last 9th and 10th Column basing on the Selction-screen Date Range.
If no Date Range is given in Selection Screen, i need to Hide these 9th,10th Columns.
But the Problem is , Iam displaying the Output through "WRITE" Statements.
Can you Help me on this.
Thanks & Regards,
N.L.
‎2006 Feb 08 3:57 AM
You can use this:
IF selection IS INITIAL.
WRITE col1 col2 ... col8.
ELSE.
WRITE col1 col2 ... col8 col9 col10.
ENDIF.
‎2006 Feb 08 4:00 AM
try
write: / WRITE col1 col2 ... col8.
if not s_date[] is initial.
write: col9 col10.
endif.
Regards,
Suresh Datti
‎2006 Feb 08 4:02 AM
Hi
I already used this statment,if not s_date[] is initial.
But still getting the Last 2 columns.
Regards,
N.L.
‎2006 Feb 08 4:07 AM
‎2006 Feb 08 4:02 AM
Hi,
Code like...
write: / col1,
10 col2,
20 col3,
30 col4,
40 col5.
50 col6,
60 col7,
70 col8.
if condition.
80 col9.
90 col10.
endif.
Regards,
Uma
‎2006 Feb 08 4:07 AM
Hi,
IF Selction-screen in Date Range.
WRITE: / col1, vline,
.
col10.
ELSEIF.
WRITE: / col1, vline,
.
col8.
ENDIF.This will work. Just give the correct condition in the IF statement.
Similarly for specifying the headers do the same.
Hope this helps.
‎2006 Feb 08 4:49 AM
Hi,
U can directly check Select-option by
write 😕 col1..col8.
if s_date is not initial.
write : col9, col10.
endif.
U can also check condition for eg.
if s_date-low is not initial and s_date-high is not initial.
write : col9, col10.
endif.
Regards,
Digesh Panchal
‎2006 Feb 08 4:50 AM
Hi Nl,
1 Ideally,
If not dt[] is initial should work.
2. U can also try :
IF NOT ( dt-low IS INITIAL AND dt-high IS INITIAL ) .
ENDIF.
3. Secondly,
u are saying,
i need to Hide these 9th,10th Columns
Well, after writing 1,2,..10,
we cannot hide them.
4. So, we have to take care,
WHILE WRITING Only.
5. Hence write the column 9,10
based on the above conditions only.
regards,
amit m.
‎2006 Feb 08 5:06 AM
Hi,
in this code if s_Budat is entered.. the code writes an extra column.. else it writes only 3 columns
TABLES : BSEG , BKPF.
TABLES: sscrfields.
TYPE-POOLS : SLIS.
DATA: GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
CT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
G_REPID LIKE SY-REPID,
TEMP_CAT TYPE SLIS_FIELDCAT_ALV,
HEADER_ALV TYPE SLIS_T_LISTHEADER,
HEADER_ALV_WA TYPE SLIS_LISTHEADER.
************************************************************************
*INPUT SELECTION SCREEN .
************************************************************************
PARAMETERS : P_BUKRS LIKE BKPF-BUKRS OBLIGATORY.
"Company code
SELECT-OPTIONS : S_BELNR FOR BKPF-BELNR MODIF ID m01.
"Accounting Doc No
SELECT-OPTIONS: S_BLART FOR BKPF-BLART MODIF ID m02,
"Document type
S_BUDAT FOR BKPF-BUDAT MODIF ID m03.
"Posting date
PARAMETERS: P_GJAHR LIKE BKPF-GJAHR MODIF ID m04.
"Fiscal year
************************************************************************
*DATA DECLARATION.
************************************************************************
DATA :BEGIN OF ITAB_BKPF OCCURS 0,
BUKRS LIKE BKPF-BUKRS,
GJAHR LIKE BKPF-GJAHR,
BELNR LIKE BKPF-BELNR,
END OF ITAB_BKPF.
DATA :BEGIN OF ITAB_BSEG OCCURS 0,
BUKRS LIKE BSEG-BUKRS,
GJAHR LIKE BSEG-GJAHR,
BELNR LIKE BSEG-BELNR,
BUZEI LIKE BSEG-BUZEI,
BSCHL LIKE BSEG-BSCHL,
HKONT LIKE BSEG-HKONT,
NAME1 LIKE BSEG-NAME1,
DMBTR LIKE BSEG-DMBTR,
MWSKZ LIKE BSEG-MWSKZ,
ZUONR LIKE BSEG-ZUONR,
KOSTL LIKE BSEG-KOSTL,
FISTL LIKE BSEG-FISTL,
FIPOS LIKE BSEG-FIPOS,
SGTXT LIKE BSEG-SGTXT,
END OF ITAB_BSEG.
DATA :BEGIN OF ITAB_BKPF_BSEG OCCURS 0,
BUKRS LIKE BKPF-BUKRS,
GJAHR LIKE BKPF-GJAHR,
BELNR LIKE BKPF-BELNR,
BUZEI LIKE BSEG-BUZEI,
BSCHL LIKE BSEG-BSCHL,
HKONT LIKE BSEG-HKONT,
NAME1 LIKE BSEG-NAME1,
DMBTR LIKE BSEG-DMBTR,
MWSKZ LIKE BSEG-MWSKZ,
ZUONR LIKE BSEG-ZUONR,
KOSTL LIKE BSEG-KOSTL,
FISTL LIKE BSEG-FISTL,
FIPOS LIKE BSEG-FIPOS,
SGTXT LIKE BSEG-SGTXT,
END OF ITAB_BKPF_BSEG.
************************************************************************
SELECTION SCREEN VALIDATION. *
************************************************************************
AT SELECTION-SCREEN on S_BELNR.
IF s_belnr IS NOT INITIAL.
LOOP AT SCREEN .
IF screen-group1 = 'M04' . "always use uppercase"
screen-required = '1'.
MODIFY SCREEN .
ENDIF.
ENDLOOP.
endif.
************************************************************************
*START-OF-SELECTION.
************************************************************************
SELECT
BUKRS
GJAHR
BELNR
INTO TABLE ITAB_BKPF
FROM BKPF
WHERE BUKRS EQ P_BUKRS
AND BELNR IN S_BELNR
AND GJAHR EQ P_GJAHR
.
IF SY-SUBRC NE 0.
MESSAGE E001(ZPROJ) WITH 'No records found'.
ENDIF.
SELECT
BUKRS
GJAHR
BELNR
BUZEI
BSCHL
HKONT
DMBTR
MWSKZ
ZUONR
KOSTL
FISTL
FIPOS
SGTXT
FROM BSEG
INTO TABLE ITAB_BSEG
FOR ALL ENTRIES IN ITAB_BKPF
WHERE
BUKRS EQ ITAB_BKPF-BUKRS AND
GJAHR EQ ITAB_BKPF-GJAHR AND
BELNR EQ ITAB_BKPF-BELNR AND
BUKRS EQ P_BUKRSLOOP AT ITAB_BKPF.
LOOP AT ITAB_BSEG WHERE BUKRS EQ ITAB_BKPF-BUKRS AND
GJAHR EQ ITAB_BKPF-GJAHR AND
BELNR EQ ITAB_BKPF-BELNR.
MOVE-CORRESPONDING ITAB_BSEG TO ITAB_BKPF_BSEG.
MOVE-CORRESPONDING ITAB_BKPF TO ITAB_BKPF_BSEG.
APPEND ITAB_BKPF_BSEG.
ENDLOOP.
ENDLOOP.
end-of-selection.
LOOP AT ITAB_BKPF_BSEG.
WRITE : / ITAB_BKPF_BSEG-BUKRS, ITAB_BKPF_BSEG-GJAHR,
ITAB_BKPF_BSEG-BELNR.
if s_budat is not initial.
write : 'extra:',itab_bkpf_bseg-buzei.
endif.
ENDLOOP.
regards
satesh