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

sap script - using form-endform

Former Member
0 Likes
795

I have used follwing code in subroutine,but in quality control this is rejected because of "structure" keyword.

FORM GET_TKNUM TABLES CT_INTAB structure ITCSY

CT_OUTTAB structure ITCSY.

IF CT_INTAB[] IS NOT INITIAL.

  • LOOP AT CT_INTAB INTO LV_INTAB.

READ TABLE CT_INTAB INDEX 1.

CHECK SY-SUBRC = 0.

MOVE ct_INTAB-VALUE TO LV_REQNO.

CLEAR CT_INTAB.

  • ENDLOOP.

ENDIF.

Then i used following code but values are not coming from script.

FORM SHIP_INFO USING CT_INTAB TYPE TABLE ITCSY

CT_OUTTAB TYPE TABLE ITCSY.

IF CT_INTAB[] IS NOT INITIAL.

LOOP AT CT_INTAB INTO LV_INTAB.

READ TABLE CT_INTAB INTO LV_INTAB INDEX 1.

CHECK SY-SUBRC = 0.

MOVE LV_INTAB-VALUE TO LV_SHIPNO.

CLEAR LV_INTAB.

ENDLOOP.

ENDIF.

what is another way to define form?

6 REPLIES 6
Read only

Former Member
0 Likes
690

Hi,

It should work that way.

FORM xxxTABLES in_tab STRUCTURE itcsy out_tab
STRUCTURE itcsy.

What error are you getting.

Regards,

Gilberto Li

Read only

0 Likes
690

Hi ,

According Quality manager " structure" key word should not be used( it is obselete).

but in your code "structure" key word is there. is there any other way? Please infor me?

Read only

0 Likes
690

Hi

U can't decide how to write the form in according your quality control, but u need to respect the rules of calling tool, here the standard still uses the "obsolete" statament to call the routine, that means the standard expects a routine with STRUCTURE in the interface.

So in this case u can't respect the rule of your quality.

Max

Read only

0 Likes
690

Hi,

observe F1 help on FORM - parameters -> Obsolete Typing

Formal parameters typed with STRUCTURE can usually be replaced by formal parameters typed with TYPE or LIKE.

The reason that this is still used in SAP documentation for SAPScript is that SAPScript it self is considered obsolete.

You can use

FORM GET_TKNUM 
  TABLES CT_INTAB  LIKE ITCSY
         CT_OUTTAB LIKE ITCSY.

This is syntactically correct and equivalent to STRUCTURE.

Regards,

Clemens

Read only

Former Member
0 Likes
690

Try using 'LIKE'.

  • LOOP AT CT_INTAB INTO LV_INTAB.
  • ENDLOOP.
FORM GET_TKNUM TABLES CT_INTAB LIKE ITCSY[] CT_OUTTAB LIKE ITCSY[]. IF CT_INTAB[] IS NOT INITIAL. READ TABLE CT_INTAB INDEX 1. CHECK SY-SUBRC = 0. MOVE CT_INTAB-VALUE TO LV_REQNO. CLEAR CT_INTAB. ENDIF. ... ... ... ENDFORM

You may also refer to the below sample code from ABAP HELP. (I could not find a hyper link to it though)


TYPES: BEGIN OF FLIGHT_STRUC, 
         FLCARRID LIKE SFLIGHT-CARRID, 
         PRICE    LIKE  SFLIGHT-FLDATE, 
       END   OF FLIGHT_STRUC. 

DATA: MY_FLIGHT TYPE TABLE OF FLIGHT_STRUC, 
      IBOOK1    TYPE TABLE OF SBOOK, 
      IBOOK2    LIKE TABLE OF IBOOK1, 
      STRUC     TYPE SBOOK. 

PERFORM DISPLAY USING MY_FLIGHT IBOOK1 IBOOK2 STRUC. 

FORM DISPLAY USING  P_ITAB  LIKE      MY_FLIGHT[] 
                    P_BOOK1 LIKE      IBOOK1[] 
                    P_BOOK2 LIKE      IBOOK2[] 
                    P_STRU  LIKE      STRUC. 

  DATA: L_FLIGHT  LIKE LINE OF P_ITAB, 
        L_CARRID  LIKE L_FLIGHT-FLCARRID. 
  ... 
  WRITE: / P_STRU-CARRID, P_STRU-CONNID. 
  ... 
  LOOP AT P_ITAB INTO L_FLIGHT WHERE FLCARRID = L_CARRID. 
    ... 
  ENDLOOP. 
ENDFORM. 

Read only

Former Member
0 Likes
690

thank u