12-03-2008 11:11 AM
HI all,
I'm printing address field in smartform header.
i'm using lfa1 table n fields like
name1, name2, nmae3, stras, ort01, ort02,pstlz,
land1, regio.
if some field is blank means in output i shouldn't get the blank space.
how to handle this condtion.
i'm coding in Smartform screen only..
Regards
Suprith
12-03-2008 11:17 AM
Hello,
I have done something like this before. Plz have a look.
DATA: L_V_ADRNR TYPE ADRNR,
L_V_LEN TYPE I.
CLEAR: L_V_ADRNR,
V_STCEG,
V_VAT,
V_NAME,
V_CITY,
V_CODE,
V_STREET.
CONSTANTS:L_C_NATION TYPE AD_NATION VALUE 'I'.
*Get the details of the receiving company.
SELECT SINGLE ADRNR
STCEG
FROM T001
INTO (L_V_ADRNR,V_STCEG)
WHERE BUKRS = IS_VPHEADER-BUKRS.
IF SY-SUBRC IS INITIAL.
V_VAT = V_STCEG+2(18).
SELECT NAME1
CITY1
POST_CODE1
STREET
UP TO 1 ROWS
FROM ADRC
INTO (V_NAME,V_CITY,V_CODE,V_STREET)
WHERE ADDRNUMBER = L_V_ADRNR
AND NATION = L_C_NATION.
ENDSELECT.
ENDIF.
IF V_CITY IS NOT INITIAL OR
V_CODE IS NOT INITIAL OR
V_STREET IS NOT INITIAL.
CONCATENATE V_CITY V_CODE V_STREET INTO V_ADDRESS SEPARATED BY ','.
CONDENSE V_ADDRESS.
DO 2 TIMES.
IF V_ADDRESS+0(1) = ','.
V_ADDRESS = V_ADDRESS+1.
ENDIF.
ENDDO.
ENDIF.
Please modify your code according to your requirement.
BR,
Suhas
12-03-2008 11:15 AM
Hi Suprith,
I think you would be using one TEXT to write all these fields. In this case, i dont think it is possible to avoid the blank lines if the value is not populated.
You can try using the syntax: &field(C)&.
(C) - This would help to condense any blank space available for that particular field.
Try this and see if it works.
Best Regards,
Ram.
12-03-2008 11:16 AM
Hi,
For all the fields like name1 ,name2 have u defined the text seperately then in the condition tab put the condition that if lfa1-name1 is not initial.....
If the condition satisfies then only the value will display and if not then it wont give the blank space in the output also..and for every field use the condense option also.
Hope this will help.
Regards,
Rohan.
Edited by: Rohan on Dec 3, 2008 12:17 PM
12-03-2008 11:17 AM
Hello,
I have done something like this before. Plz have a look.
DATA: L_V_ADRNR TYPE ADRNR,
L_V_LEN TYPE I.
CLEAR: L_V_ADRNR,
V_STCEG,
V_VAT,
V_NAME,
V_CITY,
V_CODE,
V_STREET.
CONSTANTS:L_C_NATION TYPE AD_NATION VALUE 'I'.
*Get the details of the receiving company.
SELECT SINGLE ADRNR
STCEG
FROM T001
INTO (L_V_ADRNR,V_STCEG)
WHERE BUKRS = IS_VPHEADER-BUKRS.
IF SY-SUBRC IS INITIAL.
V_VAT = V_STCEG+2(18).
SELECT NAME1
CITY1
POST_CODE1
STREET
UP TO 1 ROWS
FROM ADRC
INTO (V_NAME,V_CITY,V_CODE,V_STREET)
WHERE ADDRNUMBER = L_V_ADRNR
AND NATION = L_C_NATION.
ENDSELECT.
ENDIF.
IF V_CITY IS NOT INITIAL OR
V_CODE IS NOT INITIAL OR
V_STREET IS NOT INITIAL.
CONCATENATE V_CITY V_CODE V_STREET INTO V_ADDRESS SEPARATED BY ','.
CONDENSE V_ADDRESS.
DO 2 TIMES.
IF V_ADDRESS+0(1) = ','.
V_ADDRESS = V_ADDRESS+1.
ENDIF.
ENDDO.
ENDIF.
Please modify your code according to your requirement.
BR,
Suhas
12-03-2008 11:17 AM
HI
I hope if u use address window insted of normail window u can solve ur problem
Regards
12-03-2008 11:24 AM
Hi,
I have already done this before . the best way to do it is to have each and every field in SEPERATE text in your smartforms. and in the CONDITION tab give ITAB-NAME1 NE INITIAL.
If there is not value in NAME1, there wont be any space shown up.
Try this.
Vikki.