Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Calling a driver program by submit in user exit for PGI

Suryaji26
Participant
0 Likes
2,591

Hi Gurus,

I have a question regarding post goods issue (PGI) for transaction vl01n,vl02n and vl06g.

earlier i have created a smartofrm and a driver program for sending the form output attachment in a mail after delivery posting manually.


for this i have created a smartform and driver program in which all the logic to attach and mail send is written on delivery posting.


but now customer want this fucntionality on Post goods issue (PGI), when user go to trasaction vl01n ,vl02n and vlo6g and pressing PGI button,

then mail should be sent automatically with for output attachment.


i have found a user exit which is being triggerd on PGI press MV50AFZ1 in which implemented the implecit enhancement in perform

user_exit_save_document_prepeare with below code.


ENHANCEMENT 1  ZPGI_MAIL_SEND.    "active version
DATA c_zlf TYPE likp-lfart.
IF sy-ucomm = 'WABU_T' and xlikp-lfart = c_zlf.
SUBMIT ZSD_DECLARATION_CONFORMITY AND RETURN.
ENDIF.
ENDENHANCEMENT.


After going to transaction vl02n i am putting unposted delivery number and clicking on PGI button.

in debugging its going to condition check for ucomm for PGI buttion and delivery type.


if condtion is fullfiled and curser going further on submit statement, but without executing the driver program ZSD_DECLARATION_CONFORMITY it coming out of enhancement.


its not performing the task which is develped in the driver program.


Please help me with the submit statement structure if i am missing any or other solution for my problem.


Br,

Surya



1 ACCEPTED SOLUTION
Read only

Suryaji26
Participant
0 Likes
1,790

Hi Team,

I have used the perform.

ENHANCEMENT 1  ZPGI_MAIL_SEND.    "active version
DATA c_zlf TYPE likp-lfart.
IF sy-ucomm = 'WABU_T' and xlikp-lfart = c_zlf.
Perform entry( ZSD_DECLARATION_CONFORMITY )using return screen.
ENDIF.
ENDENHANCEMENT.


Now i am able to communicate with my program.


Thanks,

surya

Hi Gurus,

I have a question regarding post goods issue (PGI) for transaction vl01n,vl02n and vl06g.

earlier i have created a smartofrm and a driver program for sending the form output attachment in a mail after delivery posting manually.


for this i have created a smartform and driver program in which all the logic to attach and mail send is written on delivery posting.


but now customer want this fucntionality on Post goods issue (PGI), when user go to trasaction vl01n ,vl02n and vlo6g and pressing PGI button,

then mail should be sent automatically with for output attachment.


i have found a user exit which is being triggerd on PGI press MV50AFZ1 in which implemented the implecit enhancement in perform

user_exit_save_document_prepeare with below code.


ENHANCEMENT 1  ZPGI_MAIL_SEND.    "active version
DATA c_zlf TYPE likp-lfart.
IF sy-ucomm = 'WABU_T' and xlikp-lfart = c_zlf.
SUBMIT ZSD_DECLARATION_CONFORMITY AND RETURN.
ENDIF.
ENDENHANCEMENT.


After going to transaction vl02n i am putting unposted delivery number and clicking on PGI button.

in debugging its going to condition check for ucomm for PGI buttion and delivery type.


if condtion is fullfiled and curser going further on submit statement, but without executing the driver program ZSD_DECLARATION_CONFORMITY it coming out of enhancement.


its not performing the task which is develped in the driver program.


Please help me with the submit statement structure if i am missing any or other solution for my problem.


Br,

Surya



7 REPLIES 7
Read only

Former Member
0 Likes
1,790


Hello Surya,

You made the enhancement in the  form: user_exit_save_document_prepeare

To my opinion you should do this in

 

*---------------------------------------------------------------------*

* FORM USEREXIT_SAVE_DOCUMENT *
*---------------------------------------------------------------------*
* This userexit can be used to save data in additional tables *
* when a document is saved. *
* *
* If field T180-TRTYP contents 'H', the document will be *
* created, else it will be changed. *
* *
* This form is called at from form BELEG_SICHERN, before COMMIT *
* *

*---------------------------------------------------------------------*

Read only

0 Likes
1,790

Thanks Kees,

i tried with your suggesion but still the same problem.

not going into program  ZSD_DECLARATION_CONFORMITY.

Read only

0 Likes
1,790

Hi Surya

Saw your post on linkedin.

Does it have to be a program? Maybe try call it in a RFC as a separate process

CALL FUNCTION 'ZSD_DECLARATION_CONFORMITY' IN BACKGROUND TASK AS SEPARATE UNIT

Secondly I would put in a endless loop.

DATA: lv_flag.

WHILE lv_flag = space.

"Do nothing

endwhile.

See if the process is running in SM50 then you can debug this application. Change lv_flag to X and you can continue to step through and debug.

Hope this helps.

CHeers

Brad

Read only

Suryaji26
Participant
0 Likes
1,791

Hi Team,

I have used the perform.

ENHANCEMENT 1  ZPGI_MAIL_SEND.    "active version
DATA c_zlf TYPE likp-lfart.
IF sy-ucomm = 'WABU_T' and xlikp-lfart = c_zlf.
Perform entry( ZSD_DECLARATION_CONFORMITY )using return screen.
ENDIF.
ENDENHANCEMENT.


Now i am able to communicate with my program.


Thanks,

surya

Read only

0 Likes
1,790

Hi Surya,

I have requirement same kind of. At time of Delivery Creation - VL01N. Before save option it should check field 'Distribution-chain-specific material status' - MVKE-VMSTA for Material - MATNR. I have used same perform suggested by you. But I am getting error.  The RETURN filed is unknown.

Perform Statement is not working.

Please find below code.

IF sy-tcode EQ 'VL01N' AND fcode EQ 'SICH_T'.

     TYPES : BEGIN OF ty_mvke,

                    matnr TYPE matnr,

                    vkorg TYPE vkorg,

                    vmsta TYPE vmsta,

                  END OF ty_mvke.

     DATA : lt_mvke TYPE STANDARD TABLE OF ty_mvke,

                lw_mvke TYPE                   ty_mvke.

     CONSTANTS : lc_ma   TYPE vmsta VALUE 'MA',

                            lc_a100 TYPE vkorg VALUE 'A100'.

     IF likp-vkorg EQ lc_a100 AND xlips[] IS NOT INITIAL.

       SELECT matnr

                    vkorg

                    vmsta

                    FROM mvke

                    INTO TABLE lt_mvke

              FOR ALL ENTRIES IN xlips

              WHERE matnr EQ xlips-matnr AND

                    vmsta EQ lc_ma.

       IF sy-subrc EQ 0.

    Perform entry(zsd_delivery_save) USING return screen.

       ENDIF.

     ENDIF.

   ENDIF.

Please help. Thanks in advance.

Regards,

Darshan

Read only

former_member219850
Participant
0 Likes
1,790

Hi Surya,

I have requirement same kind of. At time of Delivery Creation - VL01N. Before save option it should check field 'Distribution-chain-specific material status' - MVKE-VMSTA for Material - MATNR. I have used same perform suggested by you. But I am getting error.  The RETURN field is unknown.

Perform Statement is not working.

Please find below code.

IF sy-tcode EQ 'VL01N' AND fcode EQ 'SICH_T'.

     TYPES : BEGIN OF ty_mvke,

                    matnr TYPE matnr,

                    vkorg TYPE vkorg,

                    vmsta TYPE vmsta,

                  END OF ty_mvke.

     DATA : lt_mvke TYPE STANDARD TABLE OF ty_mvke,

                lw_mvke TYPE                   ty_mvke.

     CONSTANTS : lc_ma   TYPE vmsta VALUE 'MA',

                            lc_a100 TYPE vkorg VALUE 'A100'.

     IF likp-vkorg EQ lc_a100 AND xlips[] IS NOT INITIAL.

       SELECT matnr

                    vkorg

                    vmsta

                    FROM mvke

                    INTO TABLE lt_mvke

              FOR ALL ENTRIES IN xlips

              WHERE matnr EQ xlips-matnr AND

                    vmsta EQ lc_ma.

       IF sy-subrc EQ 0.

    Perform entry(zsd_delivery_save) USING return screen.

       ENDIF.

     ENDIF.

   ENDIF.

Please help. Thanks in advance.

Regards,

Darshan

Read only

0 Likes
1,790

Sorry Darshan ,

But for now i do not have any idea what i have done for return,

Please post here what you are going to do for the same.

Br,

Surya