cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding Sap-script.

Former Member
0 Kudos

Hello Gurus..

kindly help in this issue....

in my sap-script..

my country key is DE depending on this i have to get country name Germany...

how I will write subroutine in sap script...

kindly send code please....

Thanks and Regards

Nagaraju Chintam

Accepted Solutions (1)

Accepted Solutions (1)

h_senden2
Active Contributor
0 Kudos

there are 2 possible solutions:

- in your printprogram you will add a global variant, let's say G_COUNTRY_NAME, and you will determine it inside the program. After that you will add it to a window in the sapscript as &G_COUNTRY_NAME&

- you can also to a PERFORM directly from the sapscript to determine the country name.

regards,

Hans

Former Member
0 Kudos

kindly send example code for this ,...

Former Member
0 Kudos

Check the program :

You can write simple code :

Goto SE71 -> Window ( where you want to get the data).

/: PERFORM GET_COUNTRY IN PROGRAM ZGET_COUNTRY

/: USING &COUNTRY&

/: CHANGING &COUNTRY_NAME&

/: ENDPERFORM.

Goto SE38 -> create program (ZGET_COUNTRY)

FORM GET_COUNTRY

tables in_tab structure itcsy

out_tab structure itcsy.

tables : t005,

t005t.

data : LAND1 like t005-LAND1,

landx like t005t-landx.

clear :land1,

landx.

read table in_tab with key NAME = 'COUNTRY'.

if sy-subrc eq 0.

land1 = in_tab-value.

endif.

select single landx from t005t into landx

where land1 = land1

and spras = sy-langu.

read table out_tab with key NAME = 'COUNTRY_NAME'.

if sy-subrc eq 0.

out_tab-value = landx.

modify out_tab index sy-tabix.

endif.

ENDFORM.

Thanks

Seshu

Answers (1)

Answers (1)

former_member196280
Active Contributor
0 Kudos

Call external sub-routine as shown below....

select <b>landx</b> from<b> t005t</b> into landx

where land1 = land1

and spras = sy-langu.

Ex:

Go through this example

Ex.

/: PERFORM <Subroutine name> IN PROGRAM <subroutine prog name>

/:USING &<field name>&

/:CHANGING &<field name1&

/:ENDPERFORM

Then create subroutine pool program and you have to write the code.

FORM ><subroutine name> tables int_cond structure itcsy

outt_cond structure itcsy.

data : value(20), value1(20). "do your own declarations

Read int_cond table index 1.

value = int_cond-value.

value1 = value1 + value.

Read outt_cond table index 1.

outt_cond-value = value1.

Modify outt_cond index 1.

ENDFORM.

Just rough idea given above.

Regards,

SaiRam