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

how to call two in smartforms through one coding

Former Member
0 Likes
1,006

hi all,

I have made a smart form which is being used by SAP SCRIPT.In my coding i have change the necessary requirement for calling the SAP SCRIPT in SMART FORMS.I am calling for two Movement Type which is 101 and 105.The code are as follows:

int_mseg-bwart = '101'.
 int_mseg-bwart = '105'.

SELECT SINGLE * FROM  mkpf  INTO int_mkpf
                              

WHERE mblnr = nast_key-mblnr

AND mjahr = nast_key-mjahr.



   

MOVE-CORRESPONDING mkpf TO traptab. "note 205937

zaehler_m = 1.



  

SELECT * FROM mseg INTO int_mseg

WHERE mblnr = nast_key-mblnr

AND mjahr = nast_key-mjahr

and zeile = nast_key-zeile

and ( bwart = '101' or

bwart = '105').



    

MOVE-CORRESPONDING mseg TO traptab.

append int_mseg.



    

IF sy-subrc ne 0.

retco = sy-subrc.

EXIT.

ENDIF.


    

IF zaehler_m = 1.

CLEAR zaehler_m.

PERFORM tab001w_lesen.

ENDIF.


    

MOVE-CORRESPONDING mseg TO traptab.

APPEND traptab.

ENDSELECT.



  

read table int_mseg index 1.



   

SELECT SINGLE * from lfa1 INTO int_lfa1

WHERE lifnr = int_mseg-lifnr.



   

SELECT SINGLE * from ekko into int_ekko

WHERE ebeln = int_mseg-EBELN.




**** For Movement Type  101 & 105

 

data: fname(30) type c.



 

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZCCCL_GOODS_RECEIPT'



 

IMPORTING

FM_NAME = fname

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

OTHERS = 3.



IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.



call function fname

Exporting

MKPF = int_mkpf

ekko = int_ekko

lfa1 = int_lfa1

TABLES

MSEG = INT_MSEG




  

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 4

OTHERS = 5.




 

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.



After execute this program Through MB90 i get my smart forms which i have made,but now i have to use *IF* or *ELSE* condition
for calling another SMART FORMS with same coding. For this i have made this coding:

if

int_mseg-bwart = '122'.

int_mseg-bwart = '124'.



  

SELECT * FROM mseg INTO int_mseg

WHERE mblnr = nast_key-mblnr

AND mjahr = nast_key-mjahr

and zeile = nast_key-zeile

and ( bwart = '122' or

bwart = '124').



    

MOVE-CORRESPONDING mseg TO traptab.

append int_mseg.

ENDIF.



    

IF sy-subrc ne 0.

retco = sy-subrc.

EXIT.

ENDIF.



    

IF zaehler_m = 1.

CLEAR zaehler_m.

PERFORM tab001w_lesen.

ENDIF.


   

MOVE-CORRESPONDING mseg TO traptab.

APPEND traptab.



  read table int_mseg index 1.

   

SELECT SINGLE * from lfa1 INTO int_lfa1

WHERE lifnr = int_mseg-lifnr.



   

SELECT SINGLE * from ekko into int_ekko

WHERE ebeln = int_mseg-EBELN.

ENDSELECT.



*** For Movement Type 122 & 124


 

data: flname(30) type c.



 

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZCCCL_RETURN_VENDOR

'

 

IMPORTING

FM_NAME = flname

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

OTHERS = 3.





IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.



call function flname

Exporting

MKPF = int_mkpf

ekko = int_ekko

lfa1 = int_lfa1

TABLES

MSEG = INT_MSEG




  

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 4

OTHERS = 5.

endif.



 

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.



  

IF NOT lgortsplit IS INITIAL. "431555

SORT traptab BY werks lgort zeile. "431555

ELSE. "431555

SORT traptab BY werks zeile. "431555

ENDIF.


                                                "431555
  

LOOP AT traptab.

MOVE-CORRESPONDING traptab TO mkpf.

MOVE-CORRESPONDING traptab TO mseg.

PERFORM tab156_lesen.

CHECK not t156-kzdru is initial.

xskkz = t156-rstyp.

IF not mseg-evers is initial. "Versandvorschriften lesen.

PERFORM t027_lesen.

ENDIF.

PERFORM bestellung_lesen.

IF not ekpo-knttp is initial and not

ekpo-weunb is initial.

PERFORM kontierung_lesen. "Für WE unbewertet

ENDIF.

IF not mseg-ematn is initial.

PERFORM lesen_htn.

ELSE. "111277/PH

CLEAR am07m-mfrpn. "111277/PH

ENDIF.

IF mseg-matnr is initial.

mseg-menge = mseg-bpmng.

mseg-meins = mseg-bprme.

PERFORM bestelltext_lesen.

CLEAR mabdr.

ELSE.

PERFORM material_lesen.

ENDIF.

PERFORM tab024_lesen.

PERFORM t064b_lesen.

PERFORM tab001w_lesen_2.

PERFORM ladr_lesen.

PERFORM helpdata1.

PERFORM we03_ausgabe USING lgortsplit.

PERFORM helpdata2.

ENDLOOP.

ENDFORM.

When i execute with it's Document Material it gaves me SAP SCRIPT instead of SMART FORMS.I can't understand what

is the problem in coding becaues the coding for first is given me my smart forms but in second it gaves me SAP SCRIPT.

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
906

Try something like this.

1 ) Populate all the relevant data in the internal tables before calling the smartforms.

2 ) Move the movement types into two global variables.

3 ) Now Try the following code.


 if   v_bwart1 = '101'.
 or  v_bwart2 = '105'  " Move the movement types into a global variables. 

* call smartform  ZCCCL_GOODS_RECEIPT.

ELSEIF  v_bwart1 = '122'.
       or   v_bwart2 = '124'.

* Call smartform  'ZCCCL_RETURN_VENDOR.
ENDIF.

Fine tune the above logic for your requirement.

Regrads

Mishra.

7 REPLIES 7
Read only

Former Member
0 Likes
906

Could you please post the readable format

Read only

Former Member
0 Likes
907

Try something like this.

1 ) Populate all the relevant data in the internal tables before calling the smartforms.

2 ) Move the movement types into two global variables.

3 ) Now Try the following code.


 if   v_bwart1 = '101'.
 or  v_bwart2 = '105'  " Move the movement types into a global variables. 

* call smartform  ZCCCL_GOODS_RECEIPT.

ELSEIF  v_bwart1 = '122'.
       or   v_bwart2 = '124'.

* Call smartform  'ZCCCL_RETURN_VENDOR.
ENDIF.

Fine tune the above logic for your requirement.

Regrads

Mishra.

Read only

0 Likes
906

Dear Abhinab Mishra,

Thanks for your help with code,as i have try it but it's not working still it is calling SAP SCRIPT instead of SMARTFORMS.

Kindly if you any other solution please tell me.

Thanks & Regards.

Read only

0 Likes
906

Hi,

Can you be more clear about you requirement.

If you want to call 2 smartforms in one program without any condition one after the other.

Then you need to do the below way.

(code)

First smartform

call function 'SSF_OPEN'

call your first smartform here

call function 'SSF_CLOSE'

Second smartform

call function 'SSF_OPEN'

call your second smartform here

call function 'SSF_CLOSE'

(code)

Let me know if you find any further issues..

Regards

Satish Boguda

Read only

0 Likes
906

Thanks for yor reply Satish Boguda. I have tried your way but still i can't get the desired result mean SAP SCRIPT is been called instead of SMART FORMS.

if you any other solution,kindly tell me.

Thanks & Regards,

sappk25

Read only

0 Likes
906

You did have the config changed to point to your new program and form? Or, is this a stand-alone Y/Z program that calls the SmartForms?

Read only

0 Likes
906

Dear BreakPoint,

yes it is standard program and yes i have changed it 'Z' program.Do you have any solution?

Thanks & Regards,

sappk25