ABAP Program to create non-GUI tab strips
8320 단어 create
이 인형도 처음 사용해 봐요. SCRENTABSTRIP보다 속도가 빠르고 괜찮은 물건이에요.
REPORT YHISR_REPORT_TAB NO STANDARD PAGE HEADING.
INCLUDE ZHIZI_TAB_STRIP_TOP.
DATA: T_TAB1 TYPE TY_TAB_STRUC OCCURS 5 WITH HEADER LINE,
T_TAB2 TYPE TY_TAB_STRUC OCCURS 5 WITH HEADER LINE.
DATA: L_TAB1_MODE,
L_TAB2_MODE.
PERFORM FILL_TTAB.
PERFORM FILL_TTAB2.
PERFORM BUILD_TAB TABLES T_TAB1 USING 1 10 55 17 C_DEFAULT 'TestTab1'.
PERFORM BUILD_TAB TABLES T_TAB2 USING 1 1 45 9 C_DEFAULT 'TestTab2'.
AT LINE-SELECTION.
IF G_TAB_HIDE_TEXT(7) = 'TestTab'.
IF G_TAB_HIDE_TEXT = 'TestTab1'.
L_TAB1_MODE = C_USER_ACTION.
L_TAB2_MODE = C_DEFAULT.
ELSE.
L_TAB1_MODE = C_DEFAULT.
L_TAB2_MODE = C_USER_ACTION.
ENDIF.
PERFORM BUILD_TAB TABLES T_TAB1
USING 1 10 55 17 L_TAB1_MODE 'TestTab1'.
PERFORM BUILD_TAB TABLES T_TAB2
USING 1 1 45 9 L_TAB2_MODE 'TestTab2'.
SY-LSIND = 0.
SCROLL LIST INDEX SY-LSIND TO PAGE 1 LINE SY-STARO.
SCROLL LIST INDEX SY-LSIND TO COLUMN SY-STACO.
ENDIF.
FORM FIRST.
SKIP TO LINE 15. POSITION 20.
WRITE 'First Tab Contents Here.'.
ENDFORM.
FORM SECOND.
SKIP TO LINE 15. POSITION 20.
WRITE 'Second Tab Contents Here.'.
ENDFORM.
FORM THIRD.
SKIP TO LINE 15. POSITION 20.
WRITE 'Third Tab Contents Here.'.
ENDFORM.
FORM FOURTH.
SKIP TO LINE 15. POSITION 20.
WRITE 'Fourth Tab Contents Here.'.
ENDFORM.
FORM FIFTH.
SKIP TO LINE 15. POSITION 20.
WRITE 'Fifth Tab Contents Here.'.
ENDFORM.
FORM ADDRESS.
SKIP TO LINE 5. POSITION 5.
WRITE '12936 Meadow Glen Lane, #32'.
SKIP TO LINE 6. POSITION 5.
WRITE 'Houston, TX 77973'.
ENDFORM.
FORM INFO.
SKIP TO LINE 5. POSITION 5.
WRITE 'Home Ph: (713) 233-4545'.
SKIP TO LINE 6. POSITION 5.
WRITE 'Work Ph: (713) 433-2215'.
SKIP TO LINE 7. POSITION 5.
WRITE 'Pager : (713) 433-2216'.
ENDFORM.
INCLUDE ZHIZI_TAB_STRIP.
*&---------------------------------------------------------------------*
*& Form FILL_TTAB
*&---------------------------------------------------------------------*
FORM FILL_TTAB.
PERFORM FILL_TABLE TABLES T_TAB1 USING 'First' 'FIRST' ''.
PERFORM FILL_TABLE TABLES T_TAB1 USING 'Second' 'SECOND' ''.
PERFORM FILL_TABLE TABLES T_TAB1 USING 'Third' 'THIRD' ''.
PERFORM FILL_TABLE TABLES T_TAB1 USING 'Fourth One' 'FOURTH' 'X'.
PERFORM FILL_TABLE TABLES T_TAB1 USING 'Tab Five' 'FIFTH' ''.
ENDFORM. " FILL_TTAB
*&---------------------------------------------------------------------*
*& Form FILL_TTAB2
*&---------------------------------------------------------------------*
FORM FILL_TTAB2.
PERFORM FILL_TABLE TABLES T_TAB2 USING 'Customer Address' 'ADDRESS' ''.
PERFORM FILL_TABLE TABLES T_TAB2 USING 'Other Information' 'INFO' 'X'.
ENDFORM. " TILL_TTAB2
Include file: ZHIZI_TAB_STRIP_TOP
*----------------------------------------------------------------------*
* INCLUDE ZHIZI_TAB_STRIP_TOP *
*----------------------------------------------------------------------*
CONSTANTS: C_USER_ACTION TYPE C VALUE 'X',
C_DEFAULT TYPE C VALUE ' '.
TYPES: BEGIN OF TY_TAB_STRUC,
LABEL(32),
FORM(32),
SEL,
END OF TY_TAB_STRUC,
TY_TAB TYPE STANDARD TABLE OF TY_TAB_STRUC.
DATA: G_TAB_HIDE_TEXT(32).
Include file: ZHIZI_TAB_STRIP
*&---------------------------------------------------------------------*
*& Form BUILD_TAB
*&---------------------------------------------------------------------*
FORM BUILD_TAB TABLES P_T_TAB TYPE TY_TAB
USING VALUE(P_LEFT)
VALUE(P_TOP)
VALUE(P_RIGHT)
VALUE(P_BOTTOM)
VALUE(P_MODE)
VALUE(P_TABNAME).
DATA: L_LENGTH TYPE I VALUE 0,
L_V_POS TYPE I,
L_H_LINE(256),
L_FIRST_TL_END TYPE I,
L_SECOND_TL_BEGIN TYPE I,
L_TAB_START TYPE I,
L_PREV_SEL TYPE I.
CLEAR L_H_LINE WITH '-'. " A long string of --------
READ TABLE P_T_TAB WITH KEY SEL = 'X'.
L_PREV_SEL = SY-TABIX.
* We want only one row to have sel = 'X'. Clear all of them.
P_T_TAB-SEL = ''.
MODIFY P_T_TAB TRANSPORTING SEL WHERE LABEL <> ''.
* Now, set the appropriate tab
IF P_MODE = C_USER_ACTION.
L_V_POS = P_TOP + 1.
IF SY-CUCOL > P_LEFT AND SY-CUCOL < P_RIGHT AND
SY-CUROW = L_V_POS.
L_LENGTH = P_LEFT + 1.
LOOP AT P_T_TAB.
L_LENGTH = L_LENGTH + STRLEN( P_T_TAB-LABEL ) + 3.
IF SY-CUCOL < L_LENGTH.
P_T_TAB-SEL = 'X'.
MODIFY P_T_TAB TRANSPORTING SEL.
EXIT.
ENDIF.
ENDLOOP.
ENDIF.
READ TABLE P_T_TAB WITH KEY SEL = 'X'.
IF SY-SUBRC <> 0. "Hmmm. Let us set it to the previous tab
P_T_TAB-SEL = 'X'.
MODIFY P_T_TAB INDEX L_PREV_SEL TRANSPORTING SEL.
ENDIF.
ELSE. "p_mode = c_default : Set to the previous tab
P_T_TAB-SEL = 'X'.
MODIFY P_T_TAB INDEX L_PREV_SEL TRANSPORTING SEL.
ENDIF.
SKIP TO LINE P_TOP.
POSITION P_LEFT.
LOOP AT P_T_TAB.
L_LENGTH = STRLEN( P_T_TAB-LABEL ) + 2.
WRITE AT (L_LENGTH) L_H_LINE.
ENDLOOP.
L_V_POS = P_TOP + 1.
SKIP TO LINE L_V_POS.
POSITION P_LEFT.
LOOP AT P_T_TAB.
L_LENGTH = STRLEN( P_T_TAB-LABEL ).
IF P_T_TAB-SEL = 'X'.
L_FIRST_TL_END = SY-COLNO + 1.
WRITE: '|' NO-GAP,
AT (L_LENGTH) P_T_TAB-LABEL
COLOR COL_HEADING INTENSIFIED OFF NO-GAP,
'|'.
L_SECOND_TL_BEGIN = SY-COLNO - 2.
ELSE.
WRITE: '|' NO-GAP,
AT (L_LENGTH) P_T_TAB-LABEL HOTSPOT
COLOR COL_HEADING INTENSIFIED NO-GAP,
'|'.
ENDIF.
ENDLOOP.
G_TAB_HIDE_TEXT = P_TABNAME.
HIDE G_TAB_HIDE_TEXT.
ADD 1 TO L_V_POS.
SKIP TO LINE L_V_POS.
L_LENGTH = P_RIGHT - P_LEFT - 1.
WRITE: AT P_LEFT '|' NO-GAP, AT (L_LENGTH) L_H_LINE NO-GAP, '|'.
L_LENGTH = L_SECOND_TL_BEGIN - L_FIRST_TL_END.
WRITE: AT L_FIRST_TL_END(L_LENGTH) '' NO-GAP.
ADD 1 TO L_V_POS.
SKIP TO LINE L_V_POS.
WHILE SY-LINNO < P_BOTTOM.
WRITE: AT P_LEFT '|', AT P_RIGHT '|'.
ADD 1 TO L_V_POS.
SKIP TO LINE L_V_POS.
ENDWHILE.
L_LENGTH = P_RIGHT - P_LEFT + 1.
WRITE AT P_LEFT(L_LENGTH) L_H_LINE.
READ TABLE P_T_TAB WITH KEY SEL = 'X'.
PERFORM (P_T_TAB-FORM) IN PROGRAM (SY-CPROG).
ENDFORM. " BUILD_TAB
*&---------------------------------------------------------------------*
*& Form FILL_TABLE
*&---------------------------------------------------------------------*
FORM FILL_TABLE TABLES P_T_TAB TYPE TY_TAB
USING VALUE(P_LABEL)
VALUE(P_FORM)
VALUE(P_SEL).
P_T_TAB-LABEL = P_LABEL.
P_T_TAB-FORM = P_FORM.
P_T_TAB-SEL = P_SEL.
APPEND P_T_TAB.
ENDFORM. " FILL_TABLE
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Azure Functions - 새 함수 만들기📮 문의하기 🇧🇷 🇺🇸 🇫🇷 에 연결되면 새 함수 앱을 만들 수 있습니다. Microsoft의 제한된 무료 서비스에 포함되어 있으므로 새 기능에 대한 소비 계획을 사용자에게 권장합니다. Visual Studio Co...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.