cancel
Showing results for 
Search instead for 
Did you mean: 

how to get adress dynamically in script

Former Member
0 Kudos

Hello sir ,

I want to get adress of compnies dynamically based on the company code.

If we have only company code we can write in adress window .

but here if 3 companies how we ll get 3 different adress based on the company code in script ??

where we have to write the program? should we have to create new program? r else can continue with ?

Please let me know the procedure ... step by step

Thankyou

Regards

Reddy

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Use subroutine to get the ADDRESSNUMBER of the company code in your script.

Like this:


PERFORM GET_ADDRESS USING <company_code> CHANGING <address_no> IN PROGRAM <driver program>
ENDPERFORM

Define the subroutine GET_ADDRESS in your driver program.

Fetch the ADDRESSNO(ADRNR) from table T001 by providing the COMPANY CODE.

Then use the <address_no> to print the address of the company.

Regards

Dillip Sahoo

Former Member
0 Kudos

Thankyou....

actually in my selection screen there filed called Excise group ...if we give exicse group as 52 it should call the one company code . and if give other it should call the other ...

Please let me step by step wt have to be done .

THis is standard sap script .. i just copied and made changes to my requirement . i didnt changed the driver program.

Please tell where should i write the subrountine as well as in script .

Thankyou,

Regards

Former Member
0 Kudos

Hi,

No need to change the standard driver program.

First you create a Subroutine Pool program by choosing the type of the program as Subroutine Pool instead of Executable Program. Suppose the name of the program is Z_FORMS_EXIT.


/: PERFORM GET_ADDRESS IN PROGRAM Z_FORMS_EXIT
/: USING <excise_group> 
/: CHANGING <address_no> 
/: ENDPERFORM

Then put the logic in subroutine GET_ADDRESS of your Subroutine Pool program Z_FORMS_EXIT.

You know the company code based on the Excise group.

Fetch the ADDRESSNO(ADRNR) from table T001 by providing the COMPANY CODE and pass it to the variable <address_no>.


/: ADDRESS PARAGRAPH AS
/: ADDRESSNUMBER &<address_no>(K)&
/: ENDADDRESS

For more details

[Calling ABAP Subroutines: PERFORM |http://help.sap.com/erp2005_ehp_04/helpdata/EN/d1/803279454211d189710000e8322d00/frameset.htm]

Regards

Dillip Sahoo

Former Member
0 Kudos

Please close the thread, if your issue is solved.

Regards

Dillip Sahoo

Former Member
0 Kudos

hi,

You can use PERFORM.. END PERFORM in script to get the address based n company code. To fetch the address you need to put your logic in driver program.

PERFORM GET_address IN PROGRAM ' Ur driver program'

Using...

changing....

ENDPREFORM