Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SCRIPT ADDRESS

Former Member
0 Likes
967

Hi experts,

I need to get address from T001E based on company code.I think I have to write perform statement.I need to get adddress number .How can I write perform statement.

Please explain me clearly.I am new to sap.

Thanks

nithin

7 REPLIES 7
Read only

Former Member
0 Likes
859

Use the following syntax

/: PERFORM ZCCADDRESS IN PROGRAM Zxxxxx

/: USING &VARIABLE1&

/: CHANGING &VARIABLE2&

/: ENDPERFORM

Then create a Z program Zxxxxx and do your coidng as follows. Below given is a sampel code . Change the syntax as per your requiremnt.

form ZCCADDRESS tables input_table structure itcsy

output_table structure itcsy.

data: zztermin(4) type c,

zzterm like bseg-zterm,

zvtext like tvzbt-vtext.

read table input_table index 1.

zztermin = input_table-value.

zzterm = zztermin.

select single vtext into zvtext from tvzbt where zterm = zzterm

and spras = sy-langu.

read table output_table index 1.

output_table-value = zvtext.

modify output_table index 1.

Read only

Former Member
0 Likes
859

Hi,

You can get the address number of the company code and call function Module ADDR_GET. By passing the address number to this Function module you can get the address data.

For displaying this data into SAP SCRIPT without doing any changes to print program you can write subroutine to be called from SAP.

Hope this helps.

Read only

Former Member
0 Likes
859

hi,

/:PERFORM get_date IN PROGRAM zreport

/:USING &SALESORDER&

/:CHANGING &S_DATE&

/:ENDPERFORM

Here you are passing salesorder value and getting the date by calling the subroutine get_date in the program zreport. Similary you can write the code that you want to (select teh address) in the form in the report and call this subroutine from the script.

Check out the link.

Hope this helps.

Regards,

Richa

Read only

Former Member
0 Likes
859

/: ADDRESS PARAGRAPH I2

/: NAME &X_SHIPTO-NAME1&

/: STREET &X_SHIPTO-STREET&

/: POSTCODE &X_SHIPTO-POST_CODE1&

/: CITY &X_SHIPTO-CITY1&

/: REGION &X_SHIPTO-REGION&

/: COUNTRY &X_SHIPTO-COUNTRY&

/: LANGUAGE &X_SHIPTO-LANGU&

/: FROMCOUNTRY &VBDKA-SLAND&

/: ENDADDRESS

This is the ADDRESS control command in script. to get the values you have to do like below. if you use this CONTROL command, then the output address format will be based on the country.

if you have company code value in the script layout,and you need to findout the address for that, then you have to write a FORM routine in a Zprogram & the same you have to call from the layout.

all the paramters you pass from SCRIPT with USING command will come into ITAB.

all parameters with CHANGING command will comes into OTAB

This form GET_ADRRESS will be in a Z program ZTEST

FORM GET_ADRRESS TABLES ITAB STRUCTURE ITCSY

OTAB STRUCTURE ITCSY.

data: v_ebeln type ekko-ebeln.

*--TO read the values from the ITAB you have to use this logic.

READ TABLE ITAB WITH KEY NAME = 'EBELN'

TRANSPORTING VALUE.

IF SY-SUBRC = 0.

CONDENSE ITAB-VALUE.

V_EBELN = ITAB-VALUE.

ENDIF.

*--to modify PACK value

*--write your logic to get the value into V_PACK_VALUE.

OTAB-VALUE = V_pack_value.

condense OTAB-VALUE>

MODIFY OTAB TRANSPORTING VALUE

WHERE NAME = 'PACK'.

ENDFORM.

In the SCRIPT layout,

/: PERROM GET_ADRRESS IN PROGRAM ZTEST

/: USING &COMPANY_CODE&

/: CHANGING &X_SHIPTO-NAME1&

/: CHANGING &X_SHIPTO-STREET&

/* Like this you have give all the fields here

/: ENDPERFORM

Regards

Srikanth

Message was edited by: Srikanth Kidambi

Read only

Former Member
0 Likes
859

Hi Nitin,

lets say you have the Address no and Company code with you in the SAP SCRIPT. and say the fields names are like Address no is <b>ADDR_NO</b> and the Company code is <b>BUKRS</b>

Use the following syntax

/: PERFORM ADDRESS IN PROGRAM ZGET_ADRESS

/: USING &ADDR_NO&

/: USING &BUKRS&

/: CHANGING &STREET&

/: CHANGING &CITY&

/: CHANGING &PINCODE&

/: ENDPERFORM

Then create a Z program ZGET_ADRESS and do your coding as follows. Below given is a sampel code for you.

form ADDRESS tables input_table structure itcsy

output_table structure itcsy.

data: ADDR_NO(10),

BUKRK type BUKRS

STREET(10) type c,

CITY(10) type c,

PINCODE(6).

read table input_table index 1.

ADDR_NO = input_table-value.

read table input_table index 2.

BUKRS = input_table-value.

select single STREET

CITY

PINCODE

into (STREET,CITY,PINCODE) from T001E

where ADDRESSNO = ADDR_NO and

BUKRS = BUKRS.

read table output_table index 1.

output_table-value = STREET.

modify output_table index 1.

read table output_table index 2.

output_table-value = CITY.

modify output_table index 1.

read table output_table index 3.

output_table-value = PINCODE.

modify output_table index 1.

then in your Script, you will get the values og Street, City and Pincode No's. write whcih fields you want in the Script

Hope you understand

Regards

Sudheer

Read only

0 Likes
859

I need to get address from t001e using bukrs.There are no fields like street ,city ,zcode in t001e table.

Thanks

Read only

0 Likes
859

Get T001E-ADRNR then take ADRNR to table ADRC to get the street, city, etc.