2015 May 27 9:31 AM
My users use a customized program to print out label stickers whenever a GR for Purchase Order is done. The label contains information of the Material no., description, batch no. and date of expiry. The customized program has the following parameters on the selection screen: Label Type, copies to print, printer name, plant and batch no.
All along, GR is done using movement type 101. Recently, there was a free delivery from vendor due to faulty goods. The free delivery was GR with movement type 511 as there was no Purchase Order. After GR, user tried to print label using the customized program. Although spool request was created and sent to printer, the content was blank.
I debugged the program, 'ZRPRINT03', and found that it calls a customized FM, 'ZREPRINT', which finally calls the FM, 'WFMC_MESSAGE_SINGLE'. Both 'ZRPRINT03' and ZREPRINT' are simple programs that contain only 300+ and 200+ lines respectively. So I suspect the problem could be in the standard FM 'WFMC_MESSAGE_SINGLE' and used SE37 to debug it.
Similarly, I was able to execute 'WFMC_MESSAGE_SINGLE' successfully without errors, passing all data fields in NAST as per how it was passed on in the program 'ZRPRINT03'. However, the results were the same - spool request created but content was empty. In order to find out why the content was blank, I had to find out where the content gets populated and so used another GR document 51234 that has movement type 101.
Due to complexity of 'WFMC_MESSAGE_SINGLE', I wasn't able to trace where the content starts to get populated although I did come across a section of the code that access purchasing document tables. Anyway, I retried again with the GR document 41234 that has movement type 511. This time, there was content printed out and correctly.
I tried the same again but this time at FM 'ZREPRINT' level and the label gets printed out again. Finally, I went back to the program 'ZRPRINT03' and redo the same - run with batch A1234 with movement type 101 then run with batch B1234 with movement type 511. This time, it was not successful.
I came to the conclusion that I can print out successfully by first executing once with a GR document/batch with movement type 101 and then with the problematic GR document/batch with movement type 511, either in the customized FM 'ZREPRINT' or standard FM 'WFMC_MESSAGE_SINGLE' but not in the original customized program 'ZRPRINT03'
I have no idea why is this so and what caused this issue. The customized program 'ZRPRINT03' defines the selection screen which takes the batch no. and pass to the customized FM 'ZREPRINT'. The customized FM 'ZREPRINT' uses the batch no. to search for all the generated material documents and eventually passed it to the standard FM 'WFMC_MESSAGE_SINGLE' which done the printing via NAST table. There was no filtering based on movement type of any sort and no error encountered during debugging.
Now, I can only use this method as a work-a-round. If anyone has any idea what happened or encountered the same, please feel free to comment.
2015 Oct 21 1:08 PM
Hello Kwang,
you need to find the printing program where the data will be selected.
I guess you are talking about a Z-Message type.
So, try to find out the name of the message type and go to transaction nace
under application ME
there you will see all the Messages, that are possible for MM postings.
There you can see the printing program. Set a break-point in it and run the ZRPRINT03 program again. There you will see the data selection and you can find out what is the problem.
Regards,
Manuel