Application Development 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: 

Script

Former Member
0 Kudos

Hi Experts,

i have a standard script . i need to modify it. am new to script. i don't how to write in

FORM TABLE TABLES in_par STRUCTURE itcsy

out_par STRUCTURE itcsy.

and how to call in the layout.

i have 5 fields which i need .

Invoice Date -


REGUH u2013 VBLNR-REGUP-VBLNR, go to BSAK table, REGUH-VBLNR=BSAK-AUGBL, take BSAK-BLDAT

Invoice number--- BSAK-BELNR

Purchase Order-- BSAK u2013 EBELN

Description--BSAK u2013 SGTXT

Amount --BSAK-WRBTR

these are the fields which i need to write in the se38 part and call them to the layout.

can any 1 please help me .

Correct answers will be fully appriciated.

Regards,

Sunita.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Sunita,

In SE38 you can write your perform as

FORM get_details TABLES in_tab STRUCTURE itcsy

out_tab STRUCTURE itcsy.

----


  • Workareas and Variables Declaration

----


DATA : wa_namp1 LIKE t001s,

wa_telf1 LIKE fsabe,

l_bukrs LIKE mhnk-bukrs,

l_kunnr LIKE mhnk-kunnr,

l_busab LIKE knb1-busab.

----


  • Reading Data From Sapscript

----


READ TABLE in_tab WITH KEY name = 'MHNK-BUKRS'.

IF sy-subrc = 0 .

MOVE in_tab-value TO l_bukrs.

ENDIF.

READ TABLE in_tab WITH KEY name = 'MHNK-KUNNR'.

IF sy-subrc = 0 .

MOVE in_tab-value TO l_kunnr.

ENDIF.

----


  • FM to Convert Data From Sapscript

----


CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = l_kunnr

IMPORTING

output = l_kunnr.

----


  • Fetching the Clerk Number

----


SELECT busab

FROM knb1 UP TO 1 ROWS

INTO l_busab

WHERE kunnr = l_kunnr AND bukrs = l_bukrs.

ENDSELECT.

----


  • FM for getting Credit Analyst Name,phone and email.

----


CALL FUNCTION 'CORRESPONDENCE_DATA_BUSAB'

EXPORTING

i_bukrs = l_bukrs

i_busab = l_busab

IMPORTING

e_t001s = wa_namp1

e_fsabe = wa_telf1.

----


  • Read subroutine parameters and store in variables.

----


READ TABLE out_tab WITH KEY name = 'L_SNAME'.

IF sy-subrc = 0 .

MOVE wa_namp1-sname TO out_tab-value.

MODIFY out_tab INDEX sy-tabix.

ENDIF.

READ TABLE out_tab WITH KEY name = 'L_TELF1'.

IF sy-subrc = 0 .

MOVE wa_telf1-telf1 TO out_tab-value.

MODIFY out_tab INDEX sy-tabix.

ENDIF.

ENDFORM. "get_details.

whereas in SAP script SE71 you can write

/:perform get_details in program "Program name in SE38"

/: Using &MHNK-BUKRS&

/: Using &MHNK-KUNNR&

/: Changing &L_SNAME&

/: Changing &L_TELF1&

/:endform.

Thanks

Ankur

Edited by: Ankur Sharma on Jul 23, 2008 7:03 AM

4 REPLIES 4

Former Member
0 Kudos

Hi,

To call the external subroutine in the layout use the below syntax:

/: PERFORM <perform name> in program <program name>

/: using &field-name1&

/: using &field-name2&

/: changing &field-name&

/: ENDPERFORM

the ITCSY input structure will have the values passed from the USING parameters of the layout. And based on these values you can write logic in the print program and the pass the required value to the layout throogh the OUTPUT structure of the ITCSY.

Thanks.

0 Kudos

hi sanath,

thnx for the reply. can you give me some example. how to write in se38 and in the layout.with my firlds.

Regards

sunita

Former Member
0 Kudos

Hi,

Please go thruogh these links

http://help.sap.com/saphelp_40b/helpdata/en/d1/803279454211d189710000e8322d00/content.htm

and

http://www.allinterview.com/showanswers/37425.html

Hope you understand now.

Thanks,

Phani Diwakar.

Edited by: MVPhani Diwakar on Jul 23, 2008 4:47 AM

Former Member
0 Kudos

Hi Sunita,

In SE38 you can write your perform as

FORM get_details TABLES in_tab STRUCTURE itcsy

out_tab STRUCTURE itcsy.

----


  • Workareas and Variables Declaration

----


DATA : wa_namp1 LIKE t001s,

wa_telf1 LIKE fsabe,

l_bukrs LIKE mhnk-bukrs,

l_kunnr LIKE mhnk-kunnr,

l_busab LIKE knb1-busab.

----


  • Reading Data From Sapscript

----


READ TABLE in_tab WITH KEY name = 'MHNK-BUKRS'.

IF sy-subrc = 0 .

MOVE in_tab-value TO l_bukrs.

ENDIF.

READ TABLE in_tab WITH KEY name = 'MHNK-KUNNR'.

IF sy-subrc = 0 .

MOVE in_tab-value TO l_kunnr.

ENDIF.

----


  • FM to Convert Data From Sapscript

----


CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = l_kunnr

IMPORTING

output = l_kunnr.

----


  • Fetching the Clerk Number

----


SELECT busab

FROM knb1 UP TO 1 ROWS

INTO l_busab

WHERE kunnr = l_kunnr AND bukrs = l_bukrs.

ENDSELECT.

----


  • FM for getting Credit Analyst Name,phone and email.

----


CALL FUNCTION 'CORRESPONDENCE_DATA_BUSAB'

EXPORTING

i_bukrs = l_bukrs

i_busab = l_busab

IMPORTING

e_t001s = wa_namp1

e_fsabe = wa_telf1.

----


  • Read subroutine parameters and store in variables.

----


READ TABLE out_tab WITH KEY name = 'L_SNAME'.

IF sy-subrc = 0 .

MOVE wa_namp1-sname TO out_tab-value.

MODIFY out_tab INDEX sy-tabix.

ENDIF.

READ TABLE out_tab WITH KEY name = 'L_TELF1'.

IF sy-subrc = 0 .

MOVE wa_telf1-telf1 TO out_tab-value.

MODIFY out_tab INDEX sy-tabix.

ENDIF.

ENDFORM. "get_details.

whereas in SAP script SE71 you can write

/:perform get_details in program "Program name in SE38"

/: Using &MHNK-BUKRS&

/: Using &MHNK-KUNNR&

/: Changing &L_SNAME&

/: Changing &L_TELF1&

/:endform.

Thanks

Ankur

Edited by: Ankur Sharma on Jul 23, 2008 7:03 AM