Skip to Content
-4

How to prevent a printing of Delivery Return for Spcecific Sales order Type

Aug 02, 2017 at 09:41 AM

107

avatar image

Hi All,

I have a requirement where Smartform needs to be created for delivery returns corresponding to few order types only (not for all order types). These few Sales Order ae saved in a Z-custom table.

I created a Routine 902 in VOFM under "Output Requirement" and based on the logic I am setting the SY-SUBRC field as 0 where the Output Type matches & setting SY-SUBRC = 4 where the Sales order types condition fails in the routine.

But still the Output types are getting saves for all Sales order types... even for those Sales order types that are not saved in the Z-custom table.

I have added the logic in both the subroutines available in the routine 902.

Kindly suggest where I am going wrong.

Logic.

READ TABLE t_constant WITH KEY value =lv_auart "Sales Order Type
BINARY SEARCH
TRANSPORTING NO FIELDS.
IF sy-subrc <> 0.
sy-subrc = 4.
ELSE.
sy-subrc = 0.
ENDIF.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
gopa kumar Aug 04, 2017 at 06:53 AM
-1

Hi All,

Thanks for the updates.

The logic which I wrote is correct. In the routine, based on the Sy-subrc value we can restrict the Output Type triggering. when I tested it with my FC, it was working properly. There was no issue, when the Delivery return is getting Created or Changes using VL01n & VL02N, this routine is getting called based on NACE configuration. In the routine I am checking the Sales Order type and based on our requirement I am setting the SY-SUBRC value. If SY-SUBRC = 0, Output Type is Triggered else it wont be triggered.

We don't need to debug NNAST or XNAST for this scenario.

Share
10 |10000 characters needed characters left characters exceeded
Veselina Peykova
Aug 02, 2017 at 10:42 AM
1

I am going to be really harsh here.

First, you have not explained the output type configuration. Initially, I thought that this is some delivery item output (V2), but after re-reading your question I wonder whether you are working on sales order output (V1).

Second - this cannot be your actual code, how do you expect that anyone without access to your system could tell you what you are doing wrong?

Third, since you are hardly sharing any details - what is preventing you from debugging the code (provided that the configuration and master data are correct, the routine is active and assigned)? Just place a break-point and start checking nnast, xnast, what is in the communication structures... It can't be that hard for a developer if functional consultants are capable of troubleshooting output determination.

Show 4 Share
10 |10000 characters needed characters left characters exceeded

Hi Veselina,

My apologies.. if my post is confusing you..

First->This is related to delivery item output (V2), we are using the VL02N to trigger the output Type.

Second-> In the code I am fetching the delivery number from KOMKBV2-VBELN and getting the Sales order type from VBAK-AUART into LV_AUART. The selected Sales Order Types is fetched from customer table into the T_CONSTANT internal table. Then we are adding the below logic by reading the AUART using LV_AUART.

READ TABLE t_constant WITH KEY value =lv_auart "Sales Order Type
BINARY SEARCH
TRANSPORTING NO FIELDS.
IF sy-subrc <> 0.
sy-subrc = 4.
ELSE.
sy-subrc = 0.
ENDIF.

0

If you have debugged the code I am surprised that you are unable to find the root cause.
Are you 100% sure that you are determining the correct sales order number and order type from the transactional data?
I am not a real developer, but the portions of your code do not make much sense to me (one reason could be my limited knowledge or that it is just a part of the actual logic).
What is the deal with this sy-subrc play? I don't see it used to update some variable that you use later for additional checks and if the documentation in notes (156230 - Requirements: What is permitted, what is not?) is correct, only sy-subrc = 0 as end result in a routine part (kobev, kobed) leads to proceeding with next steps (depends on where the routine is assigned), so why does it have to be set to 4 if it is not 0?
The decision by the functional consultant to use preceding document type to decide whether something needs to be printed for an item is rather strange - typically people use item categories or product groups to determine something like that.

1

I agree. This is a simple debugging task. Look at the data and run every step through to make sure you're getting the right results. It's not that hard and if you are indeed an ABAP developer (or a developer) you should be able to do this without asking a question on SCN. If you're not a developer then get one. SCN is also not a replacement for the qualified resources.

The piece of code repeated many times here is not the whole "logic". Although BINARY SEARCH here seems to make no sense, an error might be in many other places here that you have not shared with us. Kindly make an effort on your own to troubleshoot this before returning to SCN with the same question. And refer to this blog on how to ask better questions.

0

Hi Veselina,

My apologies.. if my post is confusing you..

First->This is related to delivery item output (V2), we are using the VL02N to trigger the output Type.

Second-> In the code I am fetching the delivery number from KOMKBV2-VBELN and getting the Sales order type from VBAK-AUART into LV_AUART. The selected Sales Order Types is fetched from customer table into the T_CONSTANT internal table. Then we are adding the below logic by reading the AUART using LV_AUART.

READ TABLE t_constant WITH KEY value =lv_auart "Sales Order Type
BINARY SEARCH
TRANSPORTING NO FIELDS.
IF sy-subrc <> 0.
sy-subrc = 4.
ELSE.
sy-subrc = 0.
ENDIF.

Third-> The Routine is up & active. I have debugged the code and even referred the SDN links.

0
Horst Keller
Aug 02, 2017 at 09:48 AM
0

Besides the fact that the above code makes no sense at all:

Never override system fields!!!

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Horst,

Thank you for the update. But how can I achieve my requirement?

0