Skip to Content
-4

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

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 02, 2017 at 10:42 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • 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.

  • Aug 02, 2017 at 09:48 AM

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

    Never override system fields!!!

    Add comment
    10|10000 characters needed characters exceeded