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

SAP Script ( SE71) - Change

Former Member
0 Likes
1,417

On each line where the Material Authorization Group (MARC-QMATA) of the material is equal to Z0001 or Z0002 Add free line into the form to allow the storekeeper to fill in batch number.

Mean I have to change the form (Script - Se71) - where I have to read the database table( Select statement for MARC table ) and then getting data i have to use if statement for the above to add the free line,Can you all please help me. I realy appreciate.

Edited by: ABAP Developer on Jan 15, 2009 6:02 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
999

Hi

Plz do this way. It will work.

Say if you have your material no. & plant in variable v_matnr & v_werks.

If your routine program is available for the script already & its ZABC001. Plz create a routine program if you don't have one already.

In the script in watever window you have to display the auth grps,

Plz write the following:

/: DEFINE v_qmata

/: PERFORM get_auth_grp IN PROGRAM ZABC001

/: USING v_matnr

/: USING v_werks

/: CHANGING v_qmata

/: IF v_qmata EQ 'Z0001' OR v_qmata EQ 'Z0002'

S

/: ENDIF

'S' can be any paragraph format. not necessarily S. Plz use anything that exists in ur script.

In the routine program ZABC001, Code should be written as below:

*********************************************************************************

FORM get_auth_grp TABLES in_taba STRUCTURE itcsy

in_tabb STRUCTURE itcsy

out_tab STRUCTURE itcsy.

DATA: p_qmata LIKE marc-qmata,

p_matnr LIKE marc-matnr,

p_werks LIKE marc-werks.

READ TABLE in_taba INDEX 1.

CHECK sy-subrc EQ 0.

MOVE in_taba-value TO p_matnr.

READ TABLE in_tabb INDEX 1.

CHECK sy-subrc EQ 0.

MOVE in_tabb-value TO p_werks.

SELECT SINGLE qmata FROM marc INTO p_qmata WHERE matnr = p_matnr

AND werks = p_werks.

READ TABLE out_tab INDEX 1.

CHECK sy-subrc EQ 0.

MOVE p_qmata TO out_tab-value.

MODIFY out_tab INDEX sy-tabix TRANSPORTING value.

ENDFORM.

*************************************************************************************************

Plz let me know if you need further info.

Thanks

Geetha

Hi

Plz do this way. It will work.

Say if you have your material no. & plant in variable v_matnr & v_werks.

If your routine program is available for the script already & its ZABC001. Plz create a routine program if you don't have one already.

In the script in watever window you have to display the auth grps,

Plz write the following:

/: DEFINE v_qmata

/: PERFORM get_auth_grp IN PROGRAM ZABC001

/: USING v_matnr

/: USING v_werks

/: CHANGING v_qmata

/: IF v_qmata EQ 'Z0001' OR v_qmata EQ 'Z0002'

S

/: ENDIF

'S' can be any paragraph format. not necessarily S. Plz use anything that exists in ur script.

In the routine program ZABC001, Code should be written as below:

*********************************************************************************

FORM get_auth_grp TABLES in_taba STRUCTURE itcsy

in_tabb STRUCTURE itcsy

out_tab STRUCTURE itcsy.

DATA: p_qmata LIKE marc-qmata,

p_matnr LIKE marc-matnr,

p_werks LIKE marc-werks.

READ TABLE in_taba INDEX 1.

CHECK sy-subrc EQ 0.

MOVE in_taba-value TO p_matnr.

READ TABLE in_tabb INDEX 1.

CHECK sy-subrc EQ 0.

MOVE in_tabb-value TO p_werks.

SELECT SINGLE qmata FROM marc INTO p_qmata WHERE matnr = p_matnr

AND werks = p_werks.

READ TABLE out_tab INDEX 1.

CHECK sy-subrc EQ 0.

MOVE p_qmata TO out_tab-value.

MODIFY out_tab INDEX sy-tabix TRANSPORTING value.

ENDFORM.

*************************************************************************************************

Plz let me know if you need further info.

Thanks

Geetha

5 REPLIES 5
Read only

Former Member
0 Likes
999

Use select statement in the driver program to fill in data for the field MARC-QMATA.

in the script editor,

😕 if marc-qmata eq 'Z0001' or marc-qmata eq 'Z0002'.

E

😕 endif.

E is any paragraph format .

Read only

Former Member
0 Likes
999

Hi u can write ur select statement inside a subroutine and call it in ur script,

See this wiki on how to use subroutines for scripts.

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/external%2bsubroutines%2bin%2bsap%2bscrip...

кu03B1ятu03B9к

Read only

Former Member
0 Likes
999

Hi,

Simply go to Change Editor of ur zform.

Call Subroutine.

Perform.......

End Perform.

You need to create a separate Print Progrm there you have to create a FORM body of the routine u have created in change editor. Then, Write your code in that Form.. End Form.

Remember, You have to maintain the structure ITCSY in Ur Subroutine. above.

Vikas.

Read only

Former Member
0 Likes
1,000

Hi

Plz do this way. It will work.

Say if you have your material no. & plant in variable v_matnr & v_werks.

If your routine program is available for the script already & its ZABC001. Plz create a routine program if you don't have one already.

In the script in watever window you have to display the auth grps,

Plz write the following:

/: DEFINE v_qmata

/: PERFORM get_auth_grp IN PROGRAM ZABC001

/: USING v_matnr

/: USING v_werks

/: CHANGING v_qmata

/: IF v_qmata EQ 'Z0001' OR v_qmata EQ 'Z0002'

S

/: ENDIF

'S' can be any paragraph format. not necessarily S. Plz use anything that exists in ur script.

In the routine program ZABC001, Code should be written as below:

*********************************************************************************

FORM get_auth_grp TABLES in_taba STRUCTURE itcsy

in_tabb STRUCTURE itcsy

out_tab STRUCTURE itcsy.

DATA: p_qmata LIKE marc-qmata,

p_matnr LIKE marc-matnr,

p_werks LIKE marc-werks.

READ TABLE in_taba INDEX 1.

CHECK sy-subrc EQ 0.

MOVE in_taba-value TO p_matnr.

READ TABLE in_tabb INDEX 1.

CHECK sy-subrc EQ 0.

MOVE in_tabb-value TO p_werks.

SELECT SINGLE qmata FROM marc INTO p_qmata WHERE matnr = p_matnr

AND werks = p_werks.

READ TABLE out_tab INDEX 1.

CHECK sy-subrc EQ 0.

MOVE p_qmata TO out_tab-value.

MODIFY out_tab INDEX sy-tabix TRANSPORTING value.

ENDFORM.

*************************************************************************************************

Plz let me know if you need further info.

Thanks

Geetha

Read only

0 Likes
999

hi tried the way you suggested but when I check the form it is giving me below error.

Code in script:

/: DEFINE V_QMATA.

/: PERFORM GET_QMATA IN PROGRAM ZRVADEK01 USING &VBLKP-MATNR&

/: USING &VBLKP-WERKS&

/: CHANGING &V_QMATA&.

/: ENDPERFORM.

/: IF &V_QMATA& EQ 'Z0001'.

/E

/: ENDIF.

Error:

( Check by Go to text -> check)

/: DEFINE V_QMATA.

Symbol expected

/: PERFORM GET_QMATA IN PROGRAM ZRVADEK01 USING &VBLKP-MATNR&

Too many parameters

/: USING &VBLKP-WERKS&

/: CHANGING &V_QMATA&.

/: ENDPERFORM.

/: IF &V_QMATA& EQ 'Z0001'.

/: ENDIF.

/E CHARGE

IL ,,,,&VBLKP-CHARG&

/E ITEM_LINE_SERIAL_NO_HEADER

IS Serial nr.:,,&KOMSER-SNRLN(50)&

/E ITEM_LINE_SERIAL_NO

IS ,,&KOMSER-SNRLN(50)&

Code in Calling program ( This program is my printing program)

form get_qmata TABLES fp_it_intab STRUCTURE itcsy

fp_it_intabb structure itcsy

fp_it_outtab STRUCTURE itcsy.

data : v_matnr like marc-matnr,

v_werks like marc-werks,

v_qmata like marc-qmata.

READ TABLE fp_it_intab INDEX 1.

CHECK sy-subrc EQ 0.

MOVE fp_it_intab-value TO v_matnr.

READ TABLE fp_it_intabb INDEX 1.

CHECK sy-subrc EQ 0.

MOVE fp_it_intabb-value TO v_werks.

select single qmata from marc into v_qmata where matnr = v_matnr

and werks = v_werks. .

READ TABLE fp_it_outtab INDEX 1.

CHECK sy-subrc EQ 0.

  • READ TABLE fp_it_outtab INTO wa_outtab WITH KEY name = 'I_QMATA'

  • BINARY SEARCH.

  • IF sy-subrc EQ 0.

  • wa_outtab-value = v_qmata.

move v_qmata to fp_it_outtab-value.

MODIFY fp_it_outtab INDEX sy-tabix transporting value.

  • ENDIF.

  • endif.

endform.