Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

sap script perform statement.

hi all,

i have a problem with modifying standard sap script form. i have added a field in the line item of my form using perform statement in sap script. but only the corresponding to last line item is getting displayed for all.please help me on this issue my code and sap script is as follows.

*&----


**& Form material_wt

*&----


**

*----


    • -->IN_TAB text

    • -->OUT_TAB text

*----


*

FORM MATERIAL_WT TABLES in_tab STRUCTURE itcsy

out_tab STRUCTURE itcsy.

DATA : BEGIN OF IT_MAT OCCURS 0,

ZEILE LIKE J_1IEXCDTL-ZEILE,

MENGE LIKE J_1IEXCDTL-MENGE,

MATNR LIKE J_1IEXCDTL-MATNR,

NTGEW TYPE MARA-NTGEW,

END OF IT_MAT.

DATA : V_DOCNO TYPE J_1IEXCDTL-DOCNO,

V_NTWT TYPE CHAR20.

READ TABLE in_tab WITH KEY name = 'J_1IEXCDTL-DOCNO'.

CHECK sy-subrc = c_zero.

V_DOCNO = in_tab-value.

SELECT ZEILE MATNR MENGE INTO CORRESPONDING FIELDS OF TABLE IT_MAT FROM J_1IEXCDTL

WHERE DOCNO = V_DOCNO AND TRNTYP = '57FC'.

LOOP AT IT_MAT.

SELECT SINGLE NTGEW INTO IT_MAT-NTGEW FROM MARA WHERE MATNR = IT_MAT-MATNR.

modify it_mat.

ENDLOOP.

loop at it_mat.

IF not it_mat[] IS INITIAL.

READ TABLE out_tab WITH KEY name = 'NETWT'.

IF sy-subrc = 0.

V_NTWT = IT_MAT-NTGEW * IT_MAT-MENGE.

CONDENSE:V_NTWT.

out_tab-value = V_NTWT.

MODIFY out_tab INDEX sy-tabix.

ENDIF.

ENDIF.

endloop.

endform.

and my perform statement is as follows,

/E ITEM_VALUES

/: PERFORM MATERIAL_WT IN PROGRAM ZMM_RPT_CHALLAN

/: USING &J_1IEXCDTL-DOCNO&

/: CHANGING &NETWT&

/: ENDPERFORM

I1 &J_1IEXCDTL-ZEILE&,,&J_1IEXCDTL-MATNR&,,&NETWT&

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question