2006 Aug 14 11:55 AM
hi frnds,
im using a routine in my script.. im using the structure itcsy.... but the changed value is not getting reflected in the script. the test code is as below.
in Script :
PERFORM SAP_NAME IN PROGRAM ZMADAN_SAP_ROUTINE
USING &ITAB-MATNR&
USING &ITAB-MAKTX&
CHANGING &ITAB-MATNR&
CHANGING &ITAB-MAKTX&
ENDPERFORM
&itab-matnr&
&itab-matnr&
in program :
form sap_name tables in_par structure itcsy out_par structure itcsy .
read TABLE OUT_PAR with key name = 'ITAB-MATNR'.
out_par-value = 'MADAN'.
modify out_par index sy-tabix transporting value.
endform.
***********************************8
but the changed matnr is not getting reflected in my layout.
points assured to all replies.
regards,
Madan....
2006 Aug 14 12:06 PM
PERFORM SAP_NAME IN PROGRAM ZMADAN_SAP_ROUTINE
USING &ITAB-MATNR&
Changing &ITAB-MATNR&
Changing &ITAB-MAKTX&
ENDPERFORM
form sap_name tables in_par structure itcsy out_par structure itcsy .
READ TABLE IN_par WITH KEY 'ITAB-MATNR'.
IF SY-SUBRC = 0.
*---Get MAKTX
V_VBELN = IN_PAR-VALUE+0(18).
PERFORM GET_MAKTX USING ITAB-MATNR.
ENDIF.
read TABLE OUT_PAR with key name = 'ITAB-MATNR'.
IF SY-SUBRC = 0.
out_par-value = 'MADAN'.
modify out_par index sy-tabix .
endif.
endform.
Message was edited by: Ashok Parupalli
Hi again,
1. Try with some other variable name
2. eg. MYMATNR
3. No need to declare this variable in your sapscript.
4. Just pass it
PERFORM XYZ IN PROG XYZ
CHANGING &MYMATNR&
ENDPERFORM.
&MYMATNR&
regards,
amit m.
2006 Aug 14 11:57 AM
Hi Madan,
Use INDEX to read and modify the itab.
read TABLE OUT_PAR INDEX 1.
out_par-value = 'MADAN'.
modify out_par index 1 transporting value.
Cheers
VJ
2006 Aug 14 12:00 PM
hi,
that will not make much difference since by debugging i was able to find that the table is getting modified.
regards,
madan..
2006 Aug 14 12:02 PM
Your code looks ok to me.
Check you have activated everything or check you have commented som eparts of your code?
Regards,
ravi
2006 Aug 14 12:04 PM
Hi madan,
1. since your are changing the value subroutine,
2. just pass using CHANGING
thru your layout,
and not using USING.
USING &ITAB-MATNR& <==== remove
USING &ITAB-MAKTX& <===== remove
CHANGING &ITAB-MATNR&
CHANGING &ITAB-MAKTX
regards,
amit m.
2006 Aug 14 12:26 PM
Hi again,
1. Try with some other variable name
2. eg. MYMATNR
3. No need to declare this variable in your sapscript.
4. Just pass it
PERFORM XYZ IN PROG XYZ
CHANGING &MYMATNR&
ENDPERFORM.
&MYMATNR&
regards,
amit m.
2006 Aug 14 12:05 PM
Have a look at this
Passing Xblnr to prog Z_RED_PO_NO to get "PONUM"
In Form:
/: DEFINE &PONUM&
/: PERFORM GET_PO IN PROGRAM Z_READ_PO_NO
/: USING &MHND-XBLNR&
/: CHANGING &PONUM&
/: ENDPERFORM
&PONUM&
In prog:
REPORT z_read_po_no .
TABLES : itcsy.
&----
*& Form Get_PO
&----
Description : Subroutine to get PO Number for the Corresponding
Invoice Number
----
-->L_XBLNR Invoice Number
-->L_BSTNK PO Number
-->ITCSY Structure to hold Name and value
----
FORM get_po TABLES in_xblnr STRUCTURE itcsy
out_bstnk STRUCTURE itcsy.
DATA : l_xblnr LIKE mhnd-xblnr,
l_bstnk LIKE vbak-bstnk,
wa_bstnk LIKE itcsy,
l_aubel LIKE vbrp-aubel.
CLEAR : l_xblnr,
in_xblnr,
out_bstnk,
l_aubel,
l_bstnk,
wa_bstnk.
REFRESH : out_bstnk.
READ TABLE in_xblnr WITH KEY name = 'MHND-XBLNR'.
IF sy-subrc EQ 0.
l_xblnr = in_xblnr-value.
ENDIF.
SELECT SINGLE aubel
FROM vbrp
INTO l_aubel
WHERE vbeln EQ l_xblnr.
IF sy-subrc EQ 0.
SELECT SINGLE bstnk
FROM vbak
INTO l_bstnk
WHERE vbeln = l_aubel.
IF sy-subrc EQ 0.
wa_bstnk-name = 'PONUM'.
wa_bstnk-value = l_bstnk.
INSERT wa_bstnk INTO out_bstnk INDEX 1.
ELSE.
wa_bstnk-name = 'PONUM'.
wa_bstnk-value = space.
INSERT wa_bstnk INTO out_bstnk INDEX 1.
ENDIF.
ELSE.
wa_bstnk-name = 'PONUM'.
wa_bstnk-value = space.
INSERT wa_bstnk INTO out_bstnk INDEX 1.
ENDIF.
ENDFORM. "GET_PO
2006 Aug 14 12:06 PM
PERFORM SAP_NAME IN PROGRAM ZMADAN_SAP_ROUTINE
USING &ITAB-MATNR&
Changing &ITAB-MATNR&
Changing &ITAB-MAKTX&
ENDPERFORM
form sap_name tables in_par structure itcsy out_par structure itcsy .
READ TABLE IN_par WITH KEY 'ITAB-MATNR'.
IF SY-SUBRC = 0.
*---Get MAKTX
V_VBELN = IN_PAR-VALUE+0(18).
PERFORM GET_MAKTX USING ITAB-MATNR.
ENDIF.
read TABLE OUT_PAR with key name = 'ITAB-MATNR'.
IF SY-SUBRC = 0.
out_par-value = 'MADAN'.
modify out_par index sy-tabix .
endif.
endform.
Message was edited by: Ashok Parupalli
2006 Aug 14 12:17 PM
hi amit n ashok,
i did both the changes as suggested by you, but still the changes are not getting reflected ..
regads,
madan..
2006 Aug 14 12:21 PM
hi you do one thing declare one more matnr in itab like itab-matnr1 and do like this::
PERFORM SAP_NAME IN PROGRAM ZMADAN_SAP_ROUTINE
USING &ITAB-MATNR&
<b>Changing &ITAB-MATNR1&</b>
Changing &ITAB-MAKTX&
ENDPERFORM
form sap_name tables in_par structure itcsy out_par structure itcsy .
READ TABLE IN_par WITH KEY 'ITAB-MATNR'.
IF SY-SUBRC = 0.
*---Get MAKTX
V_VBELN = IN_PAR-VALUE+0(18).
PERFORM GET_MAKTX USING ITAB-MATNR.
ENDIF.
<b>read TABLE OUT_PAR with key name = 'ITAB-MATNR1'.</b>
IF SY-SUBRC = 0.
out_par-value = 'MADAN'.
modify out_par index sy-tabix .
endif.
endform.
2006 Aug 14 12:25 PM
2006 Aug 14 12:07 PM
Hi Madan,
Can check this code...
FORM get_delitot TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
CLEAR v_delitot.
retrieve document number from standard program RVADDN01
READ TABLE in_tab WITH KEY name = 'VBDPL-VBELN'.
IF sy-subrc EQ 0.
CONDENSE in_tab-value NO-GAPS.
l_vbeln = in_tab-value.
UNPACK l_vbeln TO l_vbeln.
ENDIF.
*Fetch the delivery from delivery header
SELECT vbeln FROM likp
INTO CORRESPONDING FIELDS OF TABLE it_likp
WHERE vbeln = l_vbeln.
Get delivery , item, material , net value, Qty delivered.
IF NOT it_likp[] IS INITIAL.
SELECT vbeln posnr pstyv matnr netwr lfimg vgbel vgpos
FROM lips
INTO CORRESPONDING FIELDS OF TABLE it_lips
FOR ALL ENTRIES IN it_likp
WHERE vbeln EQ it_likp-vbeln
AND pstyv NE 'ZKIT'.
ENDIF.
*Get sales order quantity based on the delivery.
IF NOT it_lips[] IS INITIAL.
SELECT vbeln posnr matnr kwmeng netwr waerk
FROM vbap
INTO CORRESPONDING FIELDS OF TABLE it_vbap
FOR ALL ENTRIES IN it_lips
WHERE vbeln = it_lips-vgbel.
ENDIF.
LOOP AT it_lips.
READ TABLE it_vbap WITH KEY vbeln = it_lips-vgbel
posnr = it_lips-vgpos.
IF sy-subrc EQ 0.
it_final-lfimg = it_lips-lfimg. " Delivery Quantity
it_final-vbeln = it_lips-vbeln. " delivery
it_final-matnr = it_lips-matnr. " material
it_final-kwmeng = it_vbap-kwmeng." Cuml order quantity
it_final-netwr = it_vbap-netwr. " Net value of the order items.
it_final-waerk = it_vbap-waerk. " Document currency
APPEND it_final.
CLEAR it_final.
ENDIF.
ENDLOOP.
LOOP AT it_final.
IF it_final-lfimg EQ it_final-kwmeng.
v_netwr1 = it_final-netwr.
ELSEIF it_final-lfimg NE it_final-kwmeng.
v_netwr1 = ( it_final-netwr * it_final-lfimg ) / it_final-kwmeng.
ENDIF.
v_delitot = v_delitot + v_netwr1.
v_curr = it_final-waerk.
ENDLOOP.
populate delivery total to out_tab
READ TABLE out_tab WITH KEY name = 'V_DELITOT'.
IF sy-subrc EQ 0.
MOVE v_delitot TO out_tab-value.
SHIFT out_tab-value LEFT DELETING LEADING space.
<b>MODIFY out_tab INDEX sy-tabix.</b>
ENDIF.
populate currency to out_tab
READ TABLE out_tab WITH KEY name = 'V_CURR'.
IF sy-subrc EQ 0.
MOVE v_curr TO out_tab-value.
<b>MODIFY out_tab INDEX sy-tabix.</b>
ENDIF.
ENDFORM. "GET_DELITOT
Regards,
Raj
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |