cancel
Showing results for 
Search instead for 
Did you mean: 

where to do the abap sql statement in sapscript (PO)

Former Member
0 Kudos

Hi, all.

Hope anybody can guide me to find a solution.

My situation now is i have to do a purchase order in SAPSCRIPT starting from a standard po. I already found out all the related details as below:

Program SAPFM06P

FORM routine ENTRY_NEU

Form MEDRUCK

So, now the problem now is I have to add some more data on my print out PO. After figure out for some time, I don't know where to do my abap sql statement. Like example, I want to retriece some data from the ADRC table. I opened the standard program SAPFM06P to add in the some sql statement, but i dun know where should i add in. Bcz if we straight away put the related ADRC field in our sapscript, it is useless, right?

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

alejandro_bindi
Active Contributor
0 Kudos

You can create a separate program where you put all the FORM subroutines you need. Suppose that program is called Z_SCRP_FORMS, you would place this coding in the SAPscript window:


/:PERFORM ROUTINE1 IN PROGRAM Z_SCRP_FORMS
/:USING &IN_PAR1&
/:CHANGING &OUT_PAR1&
/:ENDPERFORM

Then, in the program Z_SCRP_FORMS this should be the coding:


REPORT Z_SCRP_FORMS.

FORM ROUTINE1
          TABLES    in_tab STRUCTURE itcsy
                           out_tab STRUCTURE itcsy.

" Inside the IN_TAB there's an entry which VALUE field has the value from variable IN_PAR1 (and the NAME field has 'IN_PAR1' as contents), you take it using READ statement.
" Similarly, in OUT_TAB there's an entry in which VALUE field you must put the value you want for variable OUT_PAR1, which you do by READ and MODIFY over the table.

ENDFORM.

This form could be put on the standard program in case it was copied to a Z program, otherwise there's no point in modifying the standard.

Edited by: Alejandro Bindi on Sep 14, 2008 10:13 PM

Answers (1)

Answers (1)

former_member181995
Active Contributor
0 Kudos

You can use the perform routine in script for fetching the data frm ADRC.

for more help yu can search with term 'Subroutine pools in script' you will get many info on same in SDN with code :-).

PS:but you need to copy standard script to zscript and assign zscript to NACE for perticuler output type so that your changes can be reflect.

Former Member
0 Kudos

Thanks a lot.

So, how should i add in code in order to fetch the data frm ADRC by using that routine. Because i only the codes like below. I don't where should i start add in.

Form entry_neu using ent_retco ent_screen.

data: l_druvo like t166k-druvo,

l_nast like nast,

l_from_memory,

l_doc type meein_purchase_doc_print.

clear ent_retco.

if nast-aende eq space.

l_druvo = '1'.

else.

l_druvo = '2'.

endif.

call function 'ME_READ_PO_FOR_PRINTING'

exporting

ix_nast = nast

ix_screen = ent_screen

importing

ex_retco = ent_retco

ex_nast = l_nast

doc = l_doc

changing

cx_druvo = l_druvo

cx_from_memory = l_from_memory.

check ent_retco eq 0.

call function 'ME_PRINT_PO'

exporting

ix_nast = l_nast

ix_druvo = l_druvo

doc = l_doc

ix_screen = ent_screen

ix_from_memory = l_from_memory

ix_toa_dara = toa_dara

ix_arc_params = arc_params

ix_fonam = tnapr-fonam "HW 214570

importing

ex_retco = ent_retco.

endform.

Or i come wrong place to add in any coding. Plz guide me.

Thanks in advance.

Former Member
0 Kudos

anybody know about the solution ?