cancel
Showing results for 
Search instead for 
Did you mean: 

Perform statement in SAP scripts

Former Member
0 Kudos

Hi experts,

My requirement is that I don't want to display line items for particular customer with a particular item category, For this purpose I was asked to create a Z table with fields customer number(KUNNR) and Item category(PSTYV) and I have to make changes only in layout but not in driver program. So how do i do it? How to write preform statement in form layout which satisfies my requirement. And also in this perform statement I have to check if that customer and item category exists in that Z table. If so then I should not display the line item in the output else the line item should be displayed.

Thanks in Adv.

Vasu

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

write this in script (Ex:Main Window)

/: PERFORM GET_COMM_CODE_DESC IN PROGRAM ZVPPACKL

/: USING &VBDPL-MATNR&

/: USING &VBDPL-WERKS&

/: USING &VBDPL-STAWN&

/: USING &VBDKL-ALAND&

/: CHANGING &STAWN&

/: CHANGING &TEXT1&

/* Begin of Insert -- PRAVIKAN -- DV2K933249 -- PR091808

/: CHANGING &W_COMMODITY_EU&

/: CHANGING &W_COMMODITY_DESC_EU&

/* End of Insert -- PRAVIKAN -- DV2K933249 -- PR091808

/: ENDPERFORM

Driver program (ZVPPACKL)

FORM get_comm_code_desc TABLES intab STRUCTURE itcsy

outtab STRUCTURE itcsy.

DATA: stawn LIKE t604t-stawn,

matnr LIKE marc-matnr, "CL060501

werks LIKE marc-werks, "CL060501

land1 LIKE t604t-land1,

text1 LIKE t604t-text1,

w_commodity_eu TYPE stawn, "PR092908

w_commodity_desc_eu TYPE bezei40. "PR092908

READ TABLE intab WITH KEY name = 'VBDPL-MATNR'. "CL060501

matnr = intab-value. "CL060501

READ TABLE intab WITH KEY name = 'VBDPL-WERKS'. "CL060501

werks = intab-value. "CL060501

land1 = intab-value.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = matnr

IMPORTING

output = matnr.

CLEAR: stawn,

text1.

SELECT SINGLE stawn

INTO stawn

FROM marc

WHERE matnr = matnr

AND werks = '3101'.

IF NOT stawn IS INITIAL.

SELECT SINGLE text1

INTO text1

FROM t604t

WHERE spras = 'EN'

AND land1 = 'US'

AND stawn = stawn.

ENDIF.

CLEAR: w_commodity_eu,

w_commodity_desc_eu.

SELECT SINGLE stawn

INTO w_commodity_eu

FROM marc

WHERE matnr = matnr

AND werks = '0010'.

IF NOT w_commodity_eu IS INITIAL.

SELECT SINGLE text1

INTO w_commodity_desc_eu

FROM t604t

WHERE spras = 'EN'

AND land1 = 'GB'

AND stawn = w_commodity_eu.

ENDIF.

READ TABLE outtab WITH KEY name = 'STAWN'. "CL060501

outtab-value = stawn. "CL060501

MODIFY outtab INDEX sy-tabix.

READ TABLE outtab WITH KEY name = 'TEXT1'.

outtab-value = text1.

MODIFY outtab INDEX sy-tabix.

READ TABLE outtab WITH KEY name = 'W_COMMODITY_EU'.

IF sy-subrc EQ 0.

outtab-value = w_commodity_eu.

MODIFY outtab INDEX sy-tabix.

ENDIF.

READ TABLE outtab WITH KEY name = 'W_COMMODITY_DESC_EU'.

IF sy-subrc EQ 0.

outtab-value = w_commodity_desc_eu.

MODIFY outtab INDEX sy-tabix.

ENDIF.

ENDFORM. "GET_COMM_CODE_DESC

Regards

Krishna

Former Member
0 Kudos

Hi

check this link

http://www.sapdev.co.uk/sapscript/sapscript_executeabap.htm

for more details u should search SCN.

Former Member
0 Kudos

To point you in the right direction try looking into the PERFORM..ENDPERFORM statement in SAPScripts.

i.e.


/E PRINT_LINE
/: PERFORM PRINT_LINE IN PROGRAM ZUTILS
/: USING &KUNNR&
/: USING &PSTYV&
/: CHANGING &PRINT_FLAG&
/: ENDPERFORM
/*
/: IF &PRINT_FLAG& EQ 'X'
AS Print the line
/: ENDIF

Former Member
0 Kudos

Hi,

You can find the lot of solved threads for your query. Do [search|https://www.sdn.sap.com/irj/scn/directforumsearch?threadid=&q=performinsapscript&objID=c42&dateRange=all&numResults=30&rankBy=10001] the SCN before posting the question.