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
5,855

Hello experts,

I need to get domestic and international address fron t001e using company code.How can I write select statements in Scripts.I am using standard print program

YFKORD11.

Please suggest me.

Thanks

9 REPLIES 9
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
5,804

You can not write select statement directly in the script. You can write then in the print program, or you can put them in PERFORMs and call the PERFORM from the script.

Regards

Rich Heilman

Read only

0 Likes
5,804

Hi Rich,

I am using standard print program .How can I call PERFORM from script for standard program.

please guide me

Thanks

Read only

0 Likes
5,804

Right, all you need to do is create a "Z" program which will house all of your FORM(subroutines), then you can simple call them from the sapscript. You specify what program the FORM is in, when you call it.

There is a specific interface for calling FORMs from sapscripts.

Please see this link.

http://help.sap.com/saphelp_nw2004s/helpdata/en/d1/803279454211d189710000e8322d00/frameset.htm

Please remember to award points for any helpful answers. Thanks.

Regards

Rich Heilman

Read only

Former Member
0 Likes
5,804

Hey u can do one thing here

write an executable program, in that declare the logic in subroutines with form-endform then call this program or routine in scipt with perform statement

put the perform statement in the window where u want to execute this select statement navigation

window-edit-elements-goto change mode

after endif write the perform statement

Naveen

Read only

0 Likes
5,804

I can write exe program.But my out put has been assigned to standard program.In that case how can I do that.

Thanks

Read only

0 Likes
5,804

it does not matter with the print program

just write the logic in executable program seperatly

n then call this routine in script

is it ok for u

if u need any further info let me know

naveen

Read only

0 Likes
5,804

Hi Rich and naveen,

Thanks for your reply.I am checking it now.Any how I am awarding points for ur help.

I write code in 'Z' as

REPORT ZE_FI_F0031.

TABLES: T001E, ADRC,BKPF.

FORM GET_ADDRESS.

Select single * from t001e where bukrs = BKPF-BUKRS.

if sy-subrc eq 0.

select single * from adrc where addrnumber = t001e-adrid.

endif.

ENDFORM. " FORM GET_ADDRESS

How can I can this perform.

suggest me.

Regards

rahul

Read only

0 Likes
5,804

Again, you need to use the specifiy signature(interface) as describe in the help document above, this is how you will pass your value back and forth.

Regards

Rich Heilman

Read only

0 Likes
5,804

Something more along these lines.



*---------------------------------------------------------------------*
*       FORM GET_ADDRESS                                              *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
form get_address tables in_tab structure itcsy
                        out_tab structure itcsy..

  data: bukrs type bkpf-bukrs.

  read table in_tab with key name = 'BKPF-BUKRS'.
  if sy-subrc  = 0.
    bukrs = in_tab-value.
  endif.


  select single * from t001e
              where bukrs = bukrs.
  if sy-subrc eq 0.
    select single * from adrc
             where addrnumber = t001e-adrid.
    if sy-subrc  = 0.

* Get the record for CITY1 in the output and modify the value.
      read table out_tab with key name = 'CITY1'.
      if sy-subrc  = 0.
        out_tab-value = adrc-city1.
        modify out_tab index sy-tabix.
      endif.
    endif.
  endif.

endform. " FORM GET_ADDRESS

Regards,

Rich Heilman