SIH SOAP webservice x Stock issue lines creation

SUGGESTED

Hello,

When creating a Direct Sales invoice through SIH SOAP Webservice, the system returns the message below:

<message>Line Number 1 \ Product ITMMOB001 : The stock to issue has not been determined \ Document line quantity 1 Processed quantity 0</message>

How is possible to create an invoice and its stock line determination through SIH SOAP Webservice?

Based on some old posts and Sage KB's, there is a problem related to open another screen during a SOAP call, but in my case, when creating it manually there are no secondary screens in the process and the stock issue line is created automatically based on the settings. (Direct Invoice type, STK movement flags, Transaction with stock determination auto)

Sage X3 Version: V12.22

  • 0

    We have the same issue, did you find a solution for this?

  • 0 in reply to Sahem
    SUGGESTED

    Hello Sahem,

    I talked with Juliano directly suggesting a solution but my solution did not work for him. I am sharing the solution here with you because it worked for me and another person I know that had the issue.

    What happens: The "automatic stock issue" logic is done in an interactive field action that is not executed in webservice context.

    Here are the steps to bypass this problem:
    1. Add specific/custom field action for NBLIG in the screen SIH4. "After line" (the one that generates APRES_NBLIG). You can input it between DIVLINNUM and the STD action (order matters in field actions).

    2. Do not forget to validate the mask/screen, sales invoice transaction and republishing/restarting the webservice

    3. In the specific source/action compile the following code:

    Subprog APRES_NBLIG
    
    # [V]GWEBSERV       = 1 -> Webservice session
    # [V]GSLTSTKFLG     = 2 -> Automatic Stock issue
    # [M:SIH1]STOMVTFLG = 2 -> Stock movement for invoice enabled
    If GWEBSERV=1 & dim([V]GSLTSTKFLG)>0 and [V]GSLTSTKFLG=2 and [M:SIH1]STOMVTFLG = 2
        # Call standard action that is not executed in WS
        Gosub AAPRES_NBLIG From SUBSIH
    Endif
    
    End


    Regards,
    Roberto Nascimento

  • 0 in reply to RobertoMSNascimento

    Dear Robert thank you for the help,

    Can you please share with me how the actual action should look like?

  • 0 in reply to RobertoMSNascimento

    Thank you Robert for the follow-up, i have tried the suggested but did not work i don't know if i'm doing the action in the wrong way or not but it seems that its not finding AAPRES_NBLIG.

    do you have any idea?

  • 0 in reply to Sahem

    Hello.

    Did you validate the screen, then the webservice transaction and after did you republish and restarted the webservice? 

    Also, I am assuming you have the transaction with "automatic stock issue" flag active... Simply check if the action if being executed.

    Regards,
    Roberto

  • 0 in reply to RobertoMSNascimento

    Hi Roberto, followed the  solution you proposed but under Misc. Issues , am using import template SMO not web services. The import is creating an entry without asking me to specify a  lot  to issue which is what I need-my products are lot managed. However I have this challenge , the system is ignoring stock issue rules when importing ONLY (I need to issue lots from specific location). The below is the script I added: Could you have an idea how I can also work around this?

    Subprog APRES_NBLIG

    If [M:SMO0]STKFLG=2

    Gosub AAPRES_NBLIG From SUBSMO
    Endif

    End

  • 0 in reply to alie

    Hello,

    @Alie, since it it not really related to this, I think you should've oppened a new discussion/topic. Anyway...

    Generally SMO import is marked as a "special report" if you duplicate the standard and in this case, you do not need to call this action since the standard code generally simulates these actions by calling SAI_NBLIG subprogram from the screen code (source @ W0<screen>).

     Did you check your file structure/data?
    Try something like this:
    Header -> E;<header data...>
    Line      -> L;<ITMREF>;<STU>;<Total quantity>
    Stock detail/Stojou -> S;<STU>;<Negative Quantity!>;<LOT>;<LOC>;<STA>;...

    The detail here is to put a negative quantity in the STOJOU line (since the stock is going out). If you have 2 lots, simply add 2 different "S" lines below your main "L" line in the file...

    H;...
    L;ITEM1;PCS;2
    S;PCS;-1;LOT1;LOCATION_A;...
    S;PCS;-1;LOT2;LOCATION_B;...

    Regards,
    Roberto Nascimento

  • 0 in reply to RobertoMSNascimento

    Thanks Roberto had forgot to put negative . Let me check