‎2010 May 26 9:27 AM
I have the following code:
IF &PAGE& EQ 1
ADDRESSNUMBER &EKKO-ADRNR(K)&
FROMCOUNTRY &T001-LAND1&
ELSE
TITLE &LFA1-ANRED&
NAME &LFA1-NAME1&, &LFA1-NAME2&, &LFA1-NAME3&, &LFA1-NAME4&
ENDIF
In this code ' If' statement is executed, i dont understand in if block , we are displaying only 'addressnumber' and 'from country', then how come entire address is printed in the sapscript.
‎2010 May 26 12:32 PM
Hi Reshma,
Before code, First check table - ADRC
Here U find the link how with only address no., address prints in o/p.
If you want to work on few fields go for following code (Make changes according to your req.)
SELECT SINGLE adrnr INTO twlad-adrnr FROM twlad WHERE werks = lips-werks AND
lgort = lips-lgort.
IF sy-subrc = 0.
CALL FUNCTION 'ADDRESS_INTO_PRINTFORM'
EXPORTING
address_type = '1'
address_number = twlad-adrnr
IMPORTING
address_printform_table = lt_address.
CLEAR : tel_no,fax_no,email.
SELECT SINGLE tel_number fax_number INTO (tel_no,fax_no) FROM adrc WHERE addrnumber = twlad-adrnr.
SELECT SINGLE smtp_addr INTO email FROM adr6 WHERE addrnumber = twlad-adrnr.
ENDIF.
Reply, if want other info regarding it.
‎2010 May 26 9:38 AM
hi,
I think this code in the script is under ADDRESS & ENDADDRESS statements. So, here the addressnumber is used to read the address from database and displayed in the output. Please check.
‎2010 May 26 11:44 AM
Yes the actual code is as follows:
IF &EKKO-ADRNR(K)& EQ ' '
ADDRESS PARAGRAPH AS
TITLE &LFA1-ANRED&
NAME &LFA1-NAME1&, &LFA1-NAME2&, &LFA1-NAME3&, &LFA1-NAME4&
IF &PAGE& EQ 1.
STREET &LFA1-STRAS&
POBOX &LFA1-PFACH& CODE &LFA1-PSTL2&
CITY &LFA1-ORT01&, &LFA1-ORT02&
POSTCODE &LFA1-PSTLZ&
COUNTRY &LFA1-LAND1&
REGION &LFA1-REGIO&
FROMCOUNTRY &T001-LAND1&
ENDIF.
ENDADDRESS
ELSE
ADDRESS PARAGRAPH AS
IF &PAGE& EQ 1
ADDRESSNUMBER &EKKO-ADRNR(K)&
FROMCOUNTRY &T001-LAND1&
ELSE
TITLE &LFA1-ANRED&
NAME &LFA1-NAME1&, &LFA1-NAME2&, &LFA1-NAME3&, &LFA1-NAME4&
ENDIF
ENDADDRESS
Now in the above code there is this 'if' block
IF &PAGE& EQ 1
ADDRESSNUMBER &EKKO-ADRNR(K)&
FROMCOUNTRY &T001-LAND1&
ELSE
So in this 'if' block , using the address number , entire address is displayed in Final output of the sap script. When I debug the sapscript, i m able to see only the addres number and not the address. My actual requirement is to display only some fields in the address and not the entire address, how can i do that???
‎2010 May 26 9:48 AM
Hi,
You have to put the code between ADDRESS & ENDADDRESS
Like this
/: IF &PAGE& EQ 1
/: ADDRESS PARAGRAPH AS
/: ADDRESSNUMBER &EKKO-ADRNR(K)&
/: FROMCOUNTRY &T001-LAND1&
/: ENDADDRESS
/: ELSE
/: TITLE &LFA1-ANRED&
/: NAME &LFA1-NAME1&, &LFA1-NAME2&, &LFA1-NAME3&, &LFA1-NAME4&
/: ENDIF
Regards
Dillip
‎2010 May 26 11:56 AM
Hi reshma,
If u take address number it displays the entire address.
if u want only some parts of the address then u should not use address number.
u can use title , street n other commands between address and end address.
‎2010 May 26 12:14 PM
‎2010 May 26 12:32 PM
Hi Reshma,
Before code, First check table - ADRC
Here U find the link how with only address no., address prints in o/p.
If you want to work on few fields go for following code (Make changes according to your req.)
SELECT SINGLE adrnr INTO twlad-adrnr FROM twlad WHERE werks = lips-werks AND
lgort = lips-lgort.
IF sy-subrc = 0.
CALL FUNCTION 'ADDRESS_INTO_PRINTFORM'
EXPORTING
address_type = '1'
address_number = twlad-adrnr
IMPORTING
address_printform_table = lt_address.
CLEAR : tel_no,fax_no,email.
SELECT SINGLE tel_number fax_number INTO (tel_no,fax_no) FROM adrc WHERE addrnumber = twlad-adrnr.
SELECT SINGLE smtp_addr INTO email FROM adr6 WHERE addrnumber = twlad-adrnr.
ENDIF.
Reply, if want other info regarding it.
‎2010 May 26 1:21 PM
STREET &LFA1-STRAS&
POBOX &LFA1-PFACH& CODE &LFA1-PSTL2&
CITY &LFA1-ORT01&, &LFA1-ORT02&
POSTCODE &LFA1-PSTLZ&
COUNTRY &LFA1-LAND1&
REGION &LFA1-REGIO&
U can use any of the above command.
if u want street n country then write as
Address
STREET &LFA1-STRAS&
COUNTRY &LFA1-LAND1&
End address